diff options
Diffstat (limited to 'meta/lib/oeqa/core')
| -rw-r--r-- | meta/lib/oeqa/core/README | 81 |
1 files changed, 60 insertions, 21 deletions
diff --git a/meta/lib/oeqa/core/README b/meta/lib/oeqa/core/README index 0c859fd788..f67dff7cff 100644 --- a/meta/lib/oeqa/core/README +++ b/meta/lib/oeqa/core/README | |||
| @@ -1,38 +1,77 @@ | |||
| 1 | = OEQA Framework = | 1 | = OEQA (v2) Framework = |
| 2 | 2 | ||
| 3 | == Introduction == | 3 | == Introduction == |
| 4 | 4 | ||
| 5 | This is the new OEQA framework the base clases of the framework | 5 | This is the new (version 2) OEQA framework. Base clases are located inside the |
| 6 | are in this module oeqa/core the subsequent components needs to | 6 | 'oeqa/core' folder and subsequent components needs to extend from these. |
| 7 | extend this classes. | ||
| 8 | 7 | ||
| 9 | A new/unique runner was created called oe-test and is under scripts/ | 8 | The main design consideration was to implement the needed functionality |
| 10 | oe-test, this new runner scans over oeqa module searching for test | 9 | on top of Python unittest framework. To archive the latter, the following |
| 11 | components that supports OETestContextExecutor implemented in context | 10 | modules are present: |
| 12 | module (i.e. oeqa/core/context.py). | ||
| 13 | 11 | ||
| 14 | For execute an example: | 12 | * oeqa/core/runner.py: Provides OETestResult and OETestRunner base |
| 13 | classes extending the unittest ones. This class has the support for | ||
| 14 | export results to different formats currently RAW and XML. | ||
| 15 | 15 | ||
| 16 | $ source oe-init-build-env | 16 | * oeqa/core/loader.py: Provides OETestLoader extending unittest ones, |
| 17 | $ oe-test core | 17 | also implements unified way for decorator support and for filtering test |
| 18 | cases. | ||
| 18 | 19 | ||
| 19 | For list supported components: | 20 | * oeqa/core/case.py: Provides OETestCase base class extending |
| 21 | unittest.TestCase and provides access to the Test data (td), Test context | ||
| 22 | and Logger functionality. | ||
| 20 | 23 | ||
| 21 | $ oe-test -h | 24 | * oeqa/core/decorator: Provides OETestDecorator a new class to implement |
| 25 | decorators for Test cases. | ||
| 22 | 26 | ||
| 23 | == Create new Test component == | 27 | * oeqa/core/context: Provides OETestContext a high-level API for |
| 28 | loadTests and runTests of certain Test component and | ||
| 29 | OETestContextExecutor a base class to enable oe-test to discover/use | ||
| 30 | the Test component. | ||
| 24 | 31 | ||
| 25 | Usally for add a new Test component the developer needs to extend | 32 | In the other hand, a new 'oe-test' runner is located under 'scripts', allowing scans for components |
| 26 | OETestContext/OETestContextExecutor in context.py and OETestCase in | 33 | that supports OETestContextExecutor (see below). |
| 27 | case.py. | ||
| 28 | 34 | ||
| 29 | == How to run the testing of the OEQA framework == | 35 | == Terminology == |
| 36 | |||
| 37 | * Test component: The area of testing in the Project, for example: runtime, SDK, eSDK, selftest. | ||
| 38 | |||
| 39 | * Test data: Data associated with the Test component. Currently we use bitbake datastore as | ||
| 40 | a Test data input. | ||
| 41 | |||
| 42 | * Test context: A context of what tests needs to be run and how to do it, additionally provides | ||
| 43 | access to the Test data and could have custom methods, attrs. | ||
| 44 | |||
| 45 | == oe-test == | ||
| 46 | |||
| 47 | The new tool oe-test (located at scripts) has the ability to scan the code base for test | ||
| 48 | components and provide a unified way to run test cases. Internally it scans folders inside | ||
| 49 | oeqa module in order to find specific classes that | ||
| 50 | implements a test component. | ||
| 51 | |||
| 52 | == Usage == | ||
| 53 | |||
| 54 | Executing the example test component | ||
| 55 | |||
| 56 | $ source oe-init-build-env | ||
| 57 | $ oe-test core | ||
| 58 | |||
| 59 | Getting help | ||
| 60 | |||
| 61 | $ oe-test -h | ||
| 62 | |||
| 63 | == Creating new Test Component == | ||
| 64 | |||
| 65 | Adding a new test component the developer needs to extend OETestContext/OETestContextExecutor | ||
| 66 | (from context.py) and OETestCase (from case.py) | ||
| 67 | |||
| 68 | == Selftesting the framework == | ||
| 30 | 69 | ||
| 31 | Run all tests: | 70 | Run all tests: |
| 32 | 71 | ||
| 33 | $ PATH=$PATH:../../ python3 -m unittest discover -s tests | 72 | $ PATH=$PATH:../../ python3 -m unittest discover -s tests |
| 34 | 73 | ||
| 35 | Run some test: | 74 | Run some test: |
| 36 | 75 | ||
| 37 | $ cd tests/ | 76 | $ cd tests/ |
| 38 | $ ./test_data.py | 77 | $ ./test_data.py |
