blob: d4fcda41f26c7efb5fa30d92ee3bf06f8fc60bac [file] [log] [blame]
Brad Bishopd7bf8c12018-02-25 22:55:05 -05001= OEQA (v2) Framework =
Brad Bishop6e60e8b2018-02-01 10:27:11 -05002
3== Introduction ==
4
Brad Bishopd7bf8c12018-02-25 22:55:05 -05005This is version 2 of the OEQA framework. Base clases are located in the
6'oeqa/core' directory and subsequent components must extend from these.
Brad Bishop6e60e8b2018-02-01 10:27:11 -05007
Brad Bishopd7bf8c12018-02-25 22:55:05 -05008The main design consideration was to implement the needed functionality on
9top of the Python unittest framework. To achieve this goal, the following
10modules are used:
Brad Bishop6e60e8b2018-02-01 10:27:11 -050011
Brad Bishopd7bf8c12018-02-25 22:55:05 -050012 * oeqa/core/runner.py: Provides OETestResult and OETestRunner base
13 classes extending the unittest class. These classes support exporting
14 results to different formats; currently RAW and XML support exist.
Brad Bishop6e60e8b2018-02-01 10:27:11 -050015
Brad Bishopd7bf8c12018-02-25 22:55:05 -050016 * oeqa/core/loader.py: Provides OETestLoader extending the unittest class.
17 It also features a unified implementation of decorator support and
18 filtering test cases.
Brad Bishop6e60e8b2018-02-01 10:27:11 -050019
Brad Bishopd7bf8c12018-02-25 22:55:05 -050020 * 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.
Brad Bishop6e60e8b2018-02-01 10:27:11 -050023
Brad Bishopd7bf8c12018-02-25 22:55:05 -050024 * oeqa/core/decorator: Provides OETestDecorator, a new class to implement
25 decorators for Test cases.
Brad Bishop6e60e8b2018-02-01 10:27:11 -050026
Brad Bishopd7bf8c12018-02-25 22:55:05 -050027 * 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.
Brad Bishop6e60e8b2018-02-01 10:27:11 -050031
Brad Bishopd7bf8c12018-02-25 22:55:05 -050032Also, a new 'oe-test' runner is located under 'scripts', allowing scans for components
33that supports OETestContextExecutor (see below).
Brad Bishop6e60e8b2018-02-01 10:27:11 -050034
Brad Bishopd7bf8c12018-02-25 22:55:05 -050035== 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; this additionally
43 provides access to the Test data and could have custom methods and/or attrs.
44
45== oe-test ==
46
47The new tool, oe-test, has the ability to scan the code base for test components and provide
48a unified way to run test cases. Internally it scans folders inside oeqa module in order to find
49specific classes that implement a test component.
50
51== Usage ==
52
53Executing the example test component
54
55 $ source oe-init-build-env
56 $ oe-test core
57
58Getting help
59
60 $ oe-test -h
61
62== Creating new Test Component ==
63
64Adding a new test component the developer needs to extend OETestContext/OETestContextExecutor
65(from context.py) and OETestCase (from case.py)
66
67== Selftesting the framework ==
Brad Bishop6e60e8b2018-02-01 10:27:11 -050068
69Run all tests:
70
Brad Bishopd7bf8c12018-02-25 22:55:05 -050071 $ PATH=$PATH:../../ python3 -m unittest discover -s tests
Brad Bishop6e60e8b2018-02-01 10:27:11 -050072
73Run some test:
74
Brad Bishopd7bf8c12018-02-25 22:55:05 -050075 $ cd tests/
76 $ ./test_data.py