Document specification from unittests.
-
Implement AbstractSpecFromTestReporter.
package im.toss.test.specdocs.examples import im.toss.test.specdocs.AbstractSpecFromTestReporter import im.toss.test.specdocs.SpecFilter class SpecFromTestReporter: AbstractSpecFromTestReporter() { }
-
Register it as a JUnit5 TestExecutionListener.
mkdir -p src/test/resources/META-INF/services echo 'im.toss.test.specdocs.examples.SpecFromTestReporter' > src/test/resources/META-INF/services/org.junit.platform.launcher.TestExecutionListener
See this for more details about registration of TestExecutionListener.
- Run your unittests
Then you can see the generated specification document at build/reports/specs/Specification.md
.
Run the examples in see the generated document at build/reports/specs/Specification.md
.
Copyright 2019 Viva Republica, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.