-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the title of the generated report configurable (fixes #131)
- Loading branch information
Jan Schäfer
committed
Sep 28, 2015
1 parent
80edcb5
commit 0ed0622
Showing
12 changed files
with
129 additions
and
16 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
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
14 changes: 14 additions & 0 deletions
14
jgiven-tests/src/main/java/com/tngtech/jgiven/tags/BrowserTest.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.tngtech.jgiven.tags; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
|
||
import com.tngtech.jgiven.annotation.IsTag; | ||
|
||
@IsTag( | ||
description = "Tests with this tag use a browser for testing", | ||
color = "orange" ) | ||
@Retention( RetentionPolicy.RUNTIME ) | ||
public @interface BrowserTest { | ||
|
||
} |
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
30 changes: 29 additions & 1 deletion
30
jgiven-tests/src/test/java/com/tngtech/jgiven/report/html5/ThenHtml5ReportGenerator.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,5 +1,33 @@ | ||
package com.tngtech.jgiven.report.html5; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
|
||
import com.google.common.base.Charsets; | ||
import com.google.common.io.Files; | ||
import com.google.gson.Gson; | ||
import com.tngtech.jgiven.report.ThenReportGenerator; | ||
|
||
public class ThenHtml5ReportGenerator<SELF extends ThenHtml5ReportGenerator<SELF>> extends ThenReportGenerator<SELF> {} | ||
public class ThenHtml5ReportGenerator<SELF extends ThenHtml5ReportGenerator<SELF>> extends ThenReportGenerator<SELF> { | ||
|
||
public static final String META_DATA_PATTERN = "jgivenReport.setMetaData\\((.*)\\);"; | ||
|
||
public void the_metaData_file_has_title_set_to( String title ) throws IOException { | ||
String metaDataContent = Files.toString( new File( new File( targetReportDir, "data" ), "metaData.js" ), Charsets.UTF_8 ); | ||
|
||
Matcher matcher = Pattern.compile( META_DATA_PATTERN ).matcher( metaDataContent ); | ||
assertThat( metaDataContent ).matches( META_DATA_PATTERN ); | ||
|
||
matcher.matches(); | ||
String metaDataObject = matcher.group( 1 ); | ||
|
||
Html5ReportGenerator.MetaData metaData = new Gson() | ||
.fromJson( metaDataObject, Html5ReportGenerator.MetaData.class ); | ||
|
||
assertThat( metaData.title ).isEqualTo( title ); | ||
} | ||
} |
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