Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 # Buildtools unit tests | 1 # Buildtools unit tests |
2 | 2 |
3 ## Introduction | 3 ## Introduction |
4 | 4 |
5 Unit tests for buildtools, using the pytest framework. | 5 Unit tests for buildtools, using the pytest framework. |
6 | 6 |
7 ## Approach | 7 ## Approach |
8 | 8 |
9 In order to test the buildtools capability of creating WebExtension-packages | 9 In order to test the buildtools capability of creating WebExtension-packages |
10 for Chrome, Edge and Firefox, an example configuration for each platform is | 10 for Chrome, Edge and Firefox, an example configuration for each platform is |
11 provided. | 11 provided. |
12 Running the tests calls the same API as the cli would, except for releases | 12 Running the tests calls the same API as the cli would, except for releases |
13 (we don't want to trigger our releaseAutomation during tests) - in this case, | 13 (we don't want to trigger our releaseAutomation during tests) - in this case, |
14 a build is manually created and verified) | 14 a build is manually created and verified). |
15 | 15 |
16 Each extension is build with different parameters, the resulting package and | 16 Each extension is build with different parameters, the resulting package and |
17 it's content is compared against provided expected results: | 17 it's content is compared against provided expected results: |
18 | 18 |
19 - Release or build-only, with or without a specific build-number (Edge) | 19 - Release or build-only, with or without a specific build-number (Edge) |
20 - Release, build-only or developement environment, with or without a specifc | 20 - Release, build-only or developement environment, with or without a specifc |
21 build-number (Chrome, Firefox), with or without a predefined signing key | 21 build-number (Chrome, Firefox), with or without a predefined signing key |
22 (Chrome) | 22 (Chrome) |
23 | 23 |
24 The expected results for each manifest are provided with the files in | 24 The expected results for each manifest are provided with the files in |
25 `expecteddata/`. | 25 `expecteddata/`. |
26 | 26 |
27 ## Test cases | 27 ## Test cases |
28 | 28 |
29 _(covered platforms are referred to as C=Chrome, E=Edge, F=Firefox)_ | 29 _(Covered platforms are referred to as C=Chrome, E=Edge, F=Firefox.)_ |
30 | 30 |
31 - Metadata inheritance (EF) | 31 - Metadata inheritance (EF) |
32 - correct package filename (CEF) | 32 - Correct package filename (CEF) |
33 - Printed warning about non-square icons (CF) | 33 - Printed warning about non-square icons (CEF) |
34 - Presence of javascript unit test files in developement environment (CF) | 34 - Presence of JavaScript unit test files in developement environment (CEF) |
35 - Absence of javascript unit test files in build-only or release (CF) | 35 - Absence of JavaScript unit test files in build-only or release (CEF) |
36 - Inlcusion of defined contentScripts into the manifest (CF) | 36 - Inlcusion of defined contentScripts into the manifest (CEF) |
37 - Packaging (and moving) of included icons / scripts / htmls (CEF) | 37 - Packaging (and moving) of included icons / scripts / HTML files (CEF) |
38 - Presence of files for all configured locales (CEF) | 38 - Presence of files for all configured locales (CEF) |
39 - Correct import of translations with or without placeholders, with or without | 39 - Correct import of translations with or without placeholders, with or without |
40 access keys (CF) | 40 access keys (CEF) |
41 - Translation presence and validity for the Chrome Web Store (C) | 41 - Translation presence and validity for the Chrome Web Store (C) |
42 - Packaging of modularized script files (CF) | 42 - Packaging of modularized script files with webpack (CEF) |
43 - Adherence to provided build-number in the manifest (CEF) | 43 - Adherence to provided build-number in the manifest (CEF) |
44 - Other content in the manifest (CEF) | 44 - Other content in the manifest (CEF) |
45 - Correct encrypted signature of the package (C) | 45 - Correct encrypted signature of the package (C) |
46 | 46 |
47 ## Requirements | 47 ## Requirements |
48 | 48 |
49 - [Tox](https://pypi.python.org/pypi/tox) (>= 2.7.0) | 49 - [Tox](https://pypi.python.org/pypi/tox) (>= 2.7.0) |
50 | 50 |
51 _(Tox will take care of installing the other dependencies such as flake8 and | 51 _(Tox will take care of installing the other dependencies such as flake8 and |
52 flake8-abp inside a virtualenv.)_ | 52 flake8-abp inside a virtualenv.)_ |
53 | 53 |
54 ## Usage | 54 ## Usage |
55 | 55 |
56 To run the tests simply run | 56 To run the tests simply run |
57 | 57 |
58 `tox` | 58 ``` |
Vasily Kuznetsov
2017/09/19 17:52:26
You can use a 4 space indent here instead, and I w
Sebastian Noack
2017/09/20 00:58:01
Actually, since the whole paragraph consists of co
tlucas
2017/09/20 08:52:50
Done.
Vasily Kuznetsov
2017/09/20 14:53:04
Seems like it's more cluttered and harder to read
Sebastian Noack
2017/09/20 21:36:09
The output is usually not the same (it might depen
Vasily Kuznetsov
2017/09/21 09:29:02
I agree about the single backticks, but my proposa
Sebastian Noack
2017/09/21 19:09:02
Oh, I didn't know of that syntax, I was assuming y
| |
59 $ tox | |
60 ``` | |
59 | 61 |
60 in the buildtools' rootfolder. | 62 in the buildtools' root folder. |
Sebastian Noack
2017/09/20 00:58:01
In English, you can not make up new words by putti
tlucas
2017/09/20 08:52:51
Done.
| |
61 | 63 |
62 ## Coverage | 64 ## Coverage |
63 | 65 |
64 Pytest will create a coverage report as output to the terminal, using the | 66 Pytest will create a coverage report as output to the terminal, using the |
65 pytest plugin `pytest-cov`. | 67 pytest plugin `pytest-cov`. |
66 | 68 |
67 In order to get an html report you can add `--cov-report=html` to the | 69 In order to get an html report you can add `--cov-report=html` to the |
68 pytest-command in tox.ini. | 70 pytest-command in tox.ini. |
69 | 71 |
70 For more information please refer to the | 72 For more information please refer to the |
71 [coverage documentation](https://coverage.readthedocs.io/) | 73 [coverage documentation](https://coverage.readthedocs.io/) |
LEFT | RIGHT |