-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: see-quick <[email protected]>
- Loading branch information
Showing
1 changed file
with
31 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,7 @@ To generate documentation of the test method, you can use the following annotati | |
|
||
Example of how the test can be annotated: | ||
```java | ||
@TestDoc( | ||
@TestDoc( | ||
description = @Desc("Test checking that the application works as expected."), | ||
contact = @Contact(name = "Jakub Stejskal", email = "[email protected]"), | ||
steps = { | ||
|
@@ -84,6 +84,34 @@ Example of how the test can be annotated: | |
} | ||
``` | ||
|
||
Syntax grammar (i.e., EBNF) of the test case | ||
```plain | ||
// Lexer rules | ||
WS : [ \t\r\n]+ -> skip; // Ignore whitespace, tabs, carriage returns, and newlines | ||
STRING : '"' (~["\\])* '"'; // Matches quoted strings correctly handling all characters | ||
NUMBER : [0-9]+; // For numbers, if needed | ||
// Parser rules | ||
testDocAnnotation : '@TestDoc' '(' testDocBody ')'; | ||
testDocBody : testDocAttribute ( ',' testDocAttribute )* ; | ||
testDocAttribute : descriptionAttribute | ||
| contactAttribute | ||
| stepsAttribute | ||
| useCasesAttribute | ||
| tagsAttribute | ||
; | ||
descriptionAttribute : 'description' '=' '@Desc' '(' STRING ')'; | ||
contactAttribute : 'contact' '=' '@Contact' '(' contactBody ')'; | ||
contactBody : 'name' '=' STRING ',' 'email' '=' STRING; | ||
stepsAttribute : 'steps' '=' '{' step ( ',' step )* '}'; | ||
step : '@Step' '(' 'value' '=' STRING ',' 'expected' '=' STRING ')'; | ||
useCasesAttribute : 'useCases' '=' '{' useCase ( ',' useCase )* '}'; | ||
useCase : '@UseCase' '(' 'id' '=' STRING ')'; | ||
tagsAttribute : 'tags' '=' '{' testTag ( ',' testTag )* '}'; | ||
testTag : '@TestTag' '(' 'value' '=' STRING ')'; | ||
``` | ||
|
||
## Generating the documentation | ||
|
||
The generation is handled by maven-plugin that is available at [Maven central](https://central.sonatype.com/artifact/io.skodjob/test-docs-generator-maven-plugin/overview). | ||
|
@@ -122,8 +150,8 @@ To start using the plugin, you will need to add it to your pom file together wit | |
</execution> | ||
</executions> | ||
<configuration> | ||
<filePath>./dummy-module/src/test/java/io/</filePath> | ||
<generatePath>./docs/</generatePath> | ||
<testsPath>./dummy-module/src/test/java/io/</testsPath> | ||
<docsPath>./docs/</docsPath> | ||
<generateFmf>true</generateFmf> | ||
</configuration> | ||
</plugin> | ||
|