AutoBuilder/Adding Automated Tests

From Yocto Project
Revision as of 18:54, 15 June 2016 by Benjamin (talk | contribs) (→‎AutoBuilder Adding Automated Tests Guide)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Preparation

Adding automated tests to the AutoBuilder assumes that the testing is done in either of the following formats:

The AutoBuilder interfaces with the test tool via a calling command. Such test calling command is used to start executing a given set of tests. The test set description can come in the way of a configuration (file, variable, argument, etc) and it ultimately explicitly lists which tests are to be run. It is an expectation of the test tool that it procures the execution of the list of tests that has been specified at the moment of calling the starting command.

Sample Test for Instructions

For the purpose of this guide, the following test calling command will be used:

$ oe-selftest -r bbtests.BitbakeTests.test_warnings_errors

The test tool used is in the OpenEmbedded Selftest format and the calling line selects a single test from the BBTests suite. The reason for this choice is merely simplicity for writing this guide.

You can see the code of this particular test here (referencing the Krogoth release):

http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/lib/oeqa/selftest/bbtests.py?id=krogoth-15.0.0#n58

There should be about 5 lines of code there, the test can be simply explained as: execute a bitbake build from a file that doesn't exist and verify that it shows an error. It's a negative test.

Getting familiar with the output of the test is a good idea. Preparing the environment for running such test can be seen at the Oe-selftest#How_to_use section.