Skip to content

Commit ee3e35d

Browse files
committed
docs(develop_test): update testing docs
1 parent 831a43f commit ee3e35d

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

Documentation/content/docs/develop_test.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,7 @@ test.onlyIfWebGL('Test vtkClassName Rendering', (t) => {
9090

9191
## Registering a test
9292

93-
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.
9794

9895
## Running all the tests
9996

@@ -103,11 +100,20 @@ In order to run all the registered test, run the following command:
103100
$ npm run test
104101
```
105102

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.
107108

108109
## Running a single test for debugging
109110

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+
```
111117

112118
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:
113119

@@ -126,9 +132,8 @@ Follow the following procedure to create a new baseline or change an existing ba
126132
- Add an invalid baseline (any PNG file) and rename it as the required baseline.
127133
For example, to create a baseline for `testCylinder.js` copy *testCone.png* to *Sources/Filters/Sources/CylinderSource/test/testCylinder.png*.
128134
- 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.
132137
Right-click on the test output image and save it as the valid baseline.
133138
- Re-run the test to ensure that it passes with the valid baseline.
134139
- Commit the baseline image to the git source tree.

0 commit comments

Comments
 (0)