feature/54-asciiDocReporter-tags#1945
Conversation
These will be used prepare a hierarchical tag overview. Issue: TNG#54 Signed-off-by: Johannes Thorn <2544827+johthor@users.noreply.github.com>
Issue: TNG#54 Signed-off-by: Johannes Thorn <2544827+johthor@users.noreply.github.com>
Issue: TNG#54 Signed-off-by: Johannes Thorn <2544827+johthor@users.noreply.github.com>
Issue: TNG#54 Signed-off-by: Johannes Thorn <2544827+johthor@users.noreply.github.com>
Issue: TNG#54 Signed-off-by: Johannes Thorn <2544827+johthor@users.noreply.github.com>
Issue: TNG#54 Signed-off-by: Johannes Thorn <2544827+johthor@users.noreply.github.com>
Issue: TNG#54 Signed-off-by: Johannes Thorn <2544827+johthor@users.noreply.github.com>
Issue: TNG#54 Signed-off-by: Johannes Thorn <2544827+johthor@users.noreply.github.com>
Signed-off-by: Johannes Thorn <2544827+johthor@users.noreply.github.com> # Conflicts: # jgiven-core/src/main/java/com/tngtech/jgiven/report/asciidoc/AsciiDocReportGenerator.java
Signed-off-by: Johannes Thorn <2544827+johthor@users.noreply.github.com>
|
Moinmoin! Many thanks -- in the meantime, I had already opened #1940 to extract the generator into a module of its own... let me check how we can combine the two. |
Signed-off-by: Johannes Thorn <2544827+johthor@users.noreply.github.com>
Signed-off-by: Johannes Thorn <2544827+johthor@users.noreply.github.com>
Signed-off-by: Johannes Thorn <2544827+johthor@users.noreply.github.com> # Conflicts: # jgiven-asciidoc-report/src/main/java/com/tngtech/jgiven/report/asciidoc/AsciiDocReportGenerator.java # jgiven-asciidoc-report/src/main/java/com/tngtech/jgiven/report/asciidoc/HierarchyCalculator.java # jgiven-asciidoc-report/src/test/java/com/tngtech/jgiven/report/asciidoc/AsciiDocIntroSnippetGeneratorTest.java
Signed-off-by: Johannes Thorn <2544827+johthor@users.noreply.github.com>
Also reformat Signed-off-by: Johannes Thorn <2544827+johthor@users.noreply.github.com>
Also optimize some tag prefixes to improve the understanding. Issue: TNG#54 Signed-off-by: Johannes Thorn <2544827+johthor@users.noreply.github.com>
fcf4be9 to
1866f6a
Compare
|
Hey @hvennekate, I had tried to rebase these commits onto #1940 but it got to confusing for me to finish it. Now after the extraction has been merged I have merged the current I believe that everything is now working as expected. At a later date I might still add the tag hierarchy tree as it is shown in the HTML report. |
| import org.junit.runner.RunWith; | ||
| import org.junit.runners.Parameterized; | ||
|
|
||
| @RunWith(Parameterized.class) |
There was a problem hiding this comment.
Can we have JUnit5 tests?
l-1squared
left a comment
There was a problem hiding this comment.
Output looks fine
but for some reason the report says "There are 999 tagged scenarios" when no test was executed
| } | ||
|
|
||
| static String toAsciiDocTagStart(ExecutionStatus executionStatus) { | ||
| public static String toAsciiDocStartTag(final String scenarioName) { |
There was a problem hiding this comment.
This looks eerily similar to what the TagMapper does. is that intended?
There was a problem hiding this comment.
Well, TagMapper deals with Tags, while this mapper deals with scenario names and executionStatuses. That being said, I do wonder if we can somehow combine the two aspects...
There was a problem hiding this comment.
Looking at this in greater detail, I come to the conclusion that probably ReportBlockConverter is not entirely necessary: it is an Interface in between two inherently "custom plugin" classes restricting the flexibility in custom code.
| this.allTags = allTags; | ||
| } | ||
|
|
||
| Map<String, Map<String, List<String>>> computeGroupedTag() { |
There was a problem hiding this comment.
can we potentially return something that is easier to decypher?
There was a problem hiding this comment.
also isn't the groupoing files by their Tag (but then why the double map?)
so would groupScenarioFilesByTag not be a better name?
There was a problem hiding this comment.
I... cleaned it up a little bit, but I still have to really understand what is going on in the caller.
| tagNames.add(mkTag("Best Tag")); | ||
| final long nineMilliseconds = 10_000_000L; | ||
| List<Tag> tags = List.of(mkTag("BestTag")); | ||
| long nineMilliseconds = 10_000_000L; |
There was a problem hiding this comment.
why does nine millis start with 10?
| @Test | ||
| public void convert_scenario_footer_with_multiple_tags() { | ||
| // given | ||
| List<Tag> tags = List.of(mkTag("BestTag"), mkTag("OtherTag"), mkTag("NicestTag")); |
There was a problem hiding this comment.
"OtherTag" must be really intimidated by it fabulous company :D
There was a problem hiding this comment.
shouldn't this, of all things, have some tests?
|
Hi @johthor ! Did you have a chance to have a look at @l-1squared 's comments? |
| @Override | ||
| public String convertScenarioFooterBlock(final ExecutionStatus executionStatus) { | ||
| return MetadataMapper.toAsciiDocTagEnd(executionStatus); | ||
| public String convertScenarioFooterBlock(final String identifier, final ExecutionStatus executionStatus, final List<Tag> tags) { |
| private void writeIndexFileForAllTags(final Map<String, Map<String, List<String>>> strings) { | ||
| final var tagFiles = strings.entrySet().stream() | ||
| .sorted((o1, o2) -> { | ||
| final var tag1 = allTags.get(o1.getValue().keySet().stream().findFirst().orElse("")); |
There was a problem hiding this comment.
This can likely be simplified
|
|
||
| List<String> generateIndexSnippet() { | ||
| final ArrayList<String> result = new ArrayList<>(); | ||
| List<String> generateIntroSnippet(final String description) { |
There was a problem hiding this comment.
See #1945 (comment) -> we could probably introduce some specific wrapper classes
| case SCENARIO_PENDING, SOME_STEPS_PENDING -> "status-is-pending"; | ||
| case ABORTED -> "status-is-aborted"; | ||
| case FAILED -> "status-is-failed"; | ||
| }; |
| } | ||
|
|
||
| static String toAsciiDocStartTag(final Tag tag) { | ||
| return "// tag::" + toAsciiDocTagName(tag) + "[]"; |
There was a problem hiding this comment.
Did I not see this somewhere already?
| import org.junit.runner.RunWith; | ||
| import org.junit.runners.Parameterized; | ||
|
|
||
| @RunWith(Parameterized.class) |
| tagNames.add(mkTag("Best Tag")); | ||
| final long nineMilliseconds = 10_000_000L; | ||
| List<Tag> tags = List.of(mkTag("BestTag")); | ||
| long nineMilliseconds = 10_000_000L; |
| } | ||
|
|
||
| static String toAsciiDocTagStart(ExecutionStatus executionStatus) { | ||
| public static String toAsciiDocStartTag(final String scenarioName) { |
There was a problem hiding this comment.
Well, TagMapper deals with Tags, while this mapper deals with scenario names and executionStatuses. That being said, I do wonder if we can somehow combine the two aspects...
| } | ||
|
|
||
| static String toAsciiDocTagStart(ExecutionStatus executionStatus) { | ||
| public static String toAsciiDocStartTag(final String scenarioName) { |
There was a problem hiding this comment.
Looking at this in greater detail, I come to the conclusion that probably ReportBlockConverter is not entirely necessary: it is an Interface in between two inherently "custom plugin" classes restricting the flexibility in custom code.
| @Test | ||
| public void convert_scenario_footer_with_multiple_tags() { | ||
| // given | ||
| List<Tag> tags = List.of(mkTag("BestTag"), mkTag("OtherTag"), mkTag("NicestTag")); |
Create index files for all used JGiven tags.
These pages distinguish between single-valued and multi-valued tags.