From 5b3b261950010dd2419834041f0eb6df0c49a09c Mon Sep 17 00:00:00 2001 From: see-quick Date: Sat, 18 May 2024 19:20:34 +0200 Subject: [PATCH] fix README.md little bit Signed-off-by: see-quick --- README.md | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6ccd4cd..4b85c40 100644 --- a/README.md +++ b/README.md @@ -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 = "ja@kub.io"), 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 - ./dummy-module/src/test/java/io/ - ./docs/ + ./dummy-module/src/test/java/io/ + ./docs/ true