|
1 | 1 | # Adding tests |
2 | 2 |
|
3 | | -For more detailed information see [an_introduction_to_unit_testing.rst](An-Introduction-to-Unit-Testing). |
| 3 | +:::{seealso} |
| 4 | +- [Introduction to unit testing](An-Introduction-to-Unit-Testing) |
| 5 | +::: |
4 | 6 |
|
5 | | -It is relatively simple to add unit tests for a plug-in in such a way that maven can run them as part of the build. |
6 | | - |
7 | | -Here are the steps required in Eclipse: |
| 7 | +The steps required to add unit tests for a plugin are: |
8 | 8 |
|
9 | 9 | * Create a new Fragment Project |
10 | 10 | * File > New > Project... > Plug-in Development > Fragment Project |
11 | | - * Set the project name to `\<the full name of the plug-in to test\>.tests` |
12 | | - * Change the location to the repository rather than the workspace: `xxx\ibex_gui\base\\\<project_name>` (don't forget the project name!!) |
| 11 | + * Set the project name to `<the full name of the plug-in to test\>.tests` |
| 12 | + * Change the location to the repository rather than the workspace: `ibex_gui\base\<project_name>` (don't |
| 13 | +forget the project name!) |
13 | 14 | * Click "Next" |
14 | | - * Make sure the Execution Environment points at the correct version of Java (currently JavaSE-11) |
| 15 | + * Make sure the Execution Environment points at the correct version of Java |
15 | 16 | * Click the "Browse" button next to "Plug-in ID" |
16 | 17 | * Select the plug-in to test and click "OK" |
17 | 18 | * Finish |
18 | 19 |
|
19 | | -* In the newly created plug-in, add a new Package with the same name as the plug-in or something equally sensible. |
| 20 | +* In the newly created plug-in, add a new Package with the same name or structure as the plug-in. |
20 | 21 | * Select the plug-in |
21 | 22 | * File > New > Package |
22 | 23 | * Enter the name and click "Finish" |
23 | 24 |
|
24 | 25 | * In the new Package create a class for adding test |
25 | 26 | * Select the Package |
26 | 27 | * File > New > Class |
27 | | - * The class name **must** end in Test to be picked up by the automated build |
| 28 | + * The class name **must** end with `Test` to be picked up by the automated build |
28 | 29 |
|
29 | 30 | * Add tests to the class |
30 | | - * Add `org.junit` and `org.mockito` (if required) to the 'Required Plug-ins', under the Dependencies tab for the manifest |
| 31 | + * Add `org.junit` and `org.mockito` (if required) to the 'Required Plug-ins', under the Dependencies tab for the |
| 32 | +manifest (`MANIFEST.MF`) |
31 | 33 |
|
32 | 34 | * Add the test plug-in to the Maven build by [following these steps](../coding/Adding-a-Plugin-or-Feature-to-Maven-Build) |
33 | 35 |
|
|
0 commit comments