Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIXED JENKINS-31337] Update to JGiven 0.9.4 and support --exclude-em…
…pty-scenarios option
- Loading branch information
Showing
8 changed files
with
90 additions
and
19 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
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
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
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
3 changes: 2 additions & 1 deletion
3
src/main/resources/org/jenkinsci/plugins/jgiven/JgivenReportGenerator/config.properties
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
jgiven.json.files=JGiven result json files | ||
reports.to.generate=Reports to generate | ||
reports.to.generate=Reports to generate | ||
exclude.empty.scenarios=Exclude empty Scenarios from reports |
3 changes: 2 additions & 1 deletion
3
src/main/resources/org/jenkinsci/plugins/jgiven/JgivenReportGenerator/config_de.properties
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
reports.to.generate=zu erzeugende Berichte | ||
jgiven.json.files=JGiven Json-Dateien | ||
jgiven.json.files=JGiven Json-Dateien | ||
exclude.empty.scenarios=Leere Szenarios aus den Berichten ausschlie\u00DFen |
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
26 changes: 25 additions & 1 deletion
26
src/test/java/org/jenkinsci/plugins/jgiven/JgivenReportGeneratorTest.java
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 |
---|---|---|
@@ -1,17 +1,41 @@ | ||
package org.jenkinsci.plugins.jgiven; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import com.tngtech.jgiven.report.ReportGenerator; | ||
import com.tngtech.jgiven.report.ReportGenerator.Config; | ||
import org.jenkinsci.plugins.jgiven.JgivenReportGenerator.ReportConfig; | ||
import org.junit.Test; | ||
|
||
import java.io.File; | ||
import java.util.ArrayList; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.mockito.BDDMockito.given; | ||
import static org.mockito.BDDMockito.then; | ||
import static org.mockito.Mockito.mock; | ||
|
||
public class JgivenReportGeneratorTest { | ||
@Test | ||
public void when_no_report_is_configured_then_html_is_added_by_default() { | ||
JgivenReportGenerator jgivenReportGenerator = new JgivenReportGenerator(new ArrayList<JgivenReportGenerator.ReportConfig>()); | ||
JgivenReportGenerator jgivenReportGenerator = new JgivenReportGenerator(new ArrayList<ReportConfig>()); | ||
|
||
assertThat(jgivenReportGenerator.getReportConfigs()).hasSize(1); | ||
assertThat(jgivenReportGenerator.getReportConfigs().iterator().next()).isInstanceOf(JgivenReportGenerator.HtmlReportConfig.class); | ||
} | ||
|
||
@Test | ||
public void excludeEmptyScenarios_is_set_into_the_Configuration() throws Exception { | ||
ReportConfig config = mock(ReportConfig.class); | ||
given(config.getReportDirectory()).willReturn("testDir"); | ||
Config jgivenConfig = mock(Config.class); | ||
given(config.getJgivenConfig(null)).willReturn(jgivenConfig); | ||
ReportGenerator reportGenerator = mock(ReportGenerator.class); | ||
|
||
JgivenReportGenerator jgivenReportGenerator = new JgivenReportGenerator(ImmutableList.of(config)); | ||
jgivenReportGenerator.setExcludeEmptyScenarios(true); | ||
jgivenReportGenerator.configureReportGenerator(new File("."), new File("."), config, reportGenerator, null); | ||
|
||
then(reportGenerator).should().setConfig(jgivenConfig); | ||
then(jgivenConfig).should().setExcludeEmptyScenarios(true); | ||
} | ||
} |