Skip to content

Commit

Permalink
fix README.md little bit
Browse files Browse the repository at this point in the history
Signed-off-by: see-quick <[email protected]>
  • Loading branch information
see-quick committed May 18, 2024
1 parent 3823dbb commit 5b3b261
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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).
Expand Down Expand Up @@ -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>
Expand Down

0 comments on commit 5b3b261

Please sign in to comment.