You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As opposed to examples and api documentation, tests won't be picked up automatically and it is the responsibility of the author to register it on the test suite.
94
-
_This may change as the project evolves._
95
-
96
-
To add a test to the suite, you need to import it inside `Sources/tests.js`.
93
+
Tests are automatically picked up by Karma, our test runner.
97
94
98
95
## Running all the tests
99
96
@@ -103,11 +100,20 @@ In order to run all the registered test, run the following command:
103
100
$ npm run test
104
101
```
105
102
106
-
That command can also be written as `npm t` or `npm test` however it will run all tests.
103
+
That command can also be written as `npm t` or `npm test`.
104
+
105
+
## Test reporting
106
+
107
+
After running tests, a report file will be written to `Utilities/TestResults/Test-Report.html`. Opening this file in a browser will show which tests have passed, which tests have failed, and which tests have associated images.
107
108
108
109
## Running a single test for debugging
109
110
110
-
Since we have single entry points for all the tests we run, you can comment out every file except the one you want to run inside `Sources/tests.js`.
111
+
In your test file, specifying `test.only(...)` will tell the test harness to only run your test. Don't forget to remove it once your test is ready!
112
+
113
+
```diff
114
+
-test('my test description', (t) => {})
115
+
+test.only('my test description', (t) => {})
116
+
```
111
117
112
118
Then executing `npm t` will only run that file, but if you want to open a browser and debug the actual code, you can do it with the following command:
113
119
@@ -126,9 +132,8 @@ Follow the following procedure to create a new baseline or change an existing ba
126
132
- Add an invalid baseline (any PNG file) and rename it as the required baseline.
127
133
For example, to create a baseline for `testCylinder.js` copy *testCone.png* to *Sources/Filters/Sources/CylinderSource/test/testCylinder.png*.
128
134
- Run the test as per [Running a single test for debugging](#Running-a-single-test-for-debugging). The test should fail because of the invalid baseline.
129
-
- The test execution creates a file **Documentation/content/coverage/tests.md**.
130
-
Rename this file as **tests.html** and open it in the browser.
131
-
- The file should show the test output versus the invalid baseline image.
135
+
- The test execution creates a file **Utilities/TestResults/Test-Report.html**. Open this in the browser.
136
+
- The file should show the test output versus the invalid baseline image, as well as a diff.
132
137
Right-click on the test output image and save it as the valid baseline.
133
138
- Re-run the test to ensure that it passes with the valid baseline.
134
139
- Commit the baseline image to the git source tree.
0 commit comments