Creating a custom Checkbox application for Ubuntu Core testing¶
This guide describes how to create a custom Checkbox application for testing a new project (project meaning a new system that we want to test with Checkbox).
Preparing a new Checkbox Project snap¶
Checkbox-Configure is a tool that generates a snap skeleton for a project. It uses autoconf, so make sure you’ve got it installed.
$ sudo apt install autoconf
Getting the tool.
$ git clone https://git.launchpad.net/~checkbox-dev/checkbox/+git/checkbox-configure
$ cd checkbox-configure
Let’s create a Checkbox Snap for project called “myproject”.
$ ./configure --with-provider-included project=myproject base=18 && ./cleanup.sh
This creates all the files necessary to use Snapcraft to build the new snap.
The skeleton comes with some units defined, but you need to add the project-specific ones.
Adding new test jobs¶
Edit the checkbox-provider-myproject provider by adding jobs and particularly test plans that list all the jobs that you want to run.
By convention units reside in .pxu files in the
units directory of the
$ cd checkbox-provider-myproject
Let’s add a job from Checkbox tutorials
_summary: Is 10GB available in $HOME
this test checks if there's at least 10gb of free space in user's home
command: [ `df -B 1G --output=avail $HOME |tail -n1` -gt 10 ]
You may read more on how to write jobs here: Job Unit
Reusing existing provider(s)¶
It’s best not to duplicate stuff, so if the test you want to run already exists in another provider it is best to reference that provider in the snap, and include the test, or whole test plans from that provider in your new testing project.
Let’s reuse disk tests from the “plainbox-provider-snappy” provider that we
can use from the checkbox generic snap. All we need to do is add chosen tests
include field of the test plan.
unit: test plan
_name: Automated only QA tests for myproject
QA test plan for the myproject hardware. This test plan contains
all of the automated tests used to validate the aproject device.
You can also include the whole external test plan. Let’s reuse the CPU testing suite from plainbox-provider-snappy.
# com.canonical.certification::audio-automated # no working auto tests
Snapping the new checkbox-myproject snap¶
What’s left is to snap it all together!