JGiven
JGiven copied to clipboard
reporting test scenario with multiple cases
Sometimes cases are rendered as a table and sometimes the scenario is repeated for each case. Any suggestion(s) about how to control this behavior?
Does that actually happen at random? 😦 Because test cases should always render as table...
@DataProvider(parallel = true)
public static Object[][] cutoffTimesPerNetwork() {
return new Object[][] {
{ "Star", LocalTime.of(16, 59, 59) },
{ "NYCE", LocalTime.of(14, 29, 59) },
{ "Pulse", LocalTime.of(23, 59, 59) },
...
};
}
@Reference("882016")
@Test(dataProvider = "cutoffTimesPerNetwork")
// ISSUE see https://github.com/TNG/JGiven/issues/1173
public void shouldAllowAfterNetworkCutoffTransaction(
final String network,
final LocalTime cutoffTime) {
given()
...
Is rendered like this:
Found that there was a @CasesAsTable
annotation -- https://github.com/TNG/JGiven/blob/master/CHANGELOG.md
In my report JSON it appears like this:
Interesting. I will have a look at that once I got that java 11 upgrade going. Those broken PRs bother me a lot.
Hi @adrian-herscu , so I have found this neat little method https://github.com/TNG/JGiven/blob/5419a0ac7d3682ccb6109ef93a6706f5dc25ab11/jgiven-core/src/main/java/com/tngtech/jgiven/report/analysis/CaseArgumentAnalyser.java#L49 I would assume that it may be the culprit for setting that value erroneously. Could you support me by providing the actual test case that produces the udesired behavior (or an equivalent abstraction). Please note that the CaseArgument analyzer wants the amount of words to be equal, the number of attachemnts to be comparable, the words to be the same and the steps to be equal.
Hi @adrian-herscu could you please provide additional informaition on the subject? Otherwise I'll have to close this issue as there is nothing with which I can help.
In same project I have a test class which is reported as a table while others are reported as separated cases. Unfortunately, I have not enough time now to simplify them as you would expect :( You may close this issue for now, and when, and if, it will become critical for me then I will get back to it.
This one produces a table: https://github.com/QA-Automation-Starter/qa-automation/blob/main/qa-testing-example/src/test/java/dev/aherscu/qa/testing/example/scenarios/tutorial3/TestingWebWithJGiven.java
However, it derives from other class. Its steps are also deriving from other classes. So producing a clean example is not a one minute task.
The other test classes which report separate cases look similar but work over REST. They are part of my current work project, so even harder to cleanup :(