Skip to content
This repository has been archived by the owner on Jan 15, 2023. It is now read-only.

Commit

Permalink
Fixed the system info when execute from multiple runners (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
email2vimalraj authored Mar 10, 2017
1 parent 280b5a4 commit c3ba300
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

### v2.0.2
- Fixed the system info when execute from multiple runners

### v2.0.1
- Added a feature to display the data table in the step
- Fixed the thread safe issue when run in parallel
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.vimalselvam</groupId>
<artifactId>cucumber-extentsreport</artifactId>
<version>2.0.1</version>
<version>2.0.2</version>
<packaging>jar</packaging>

<name>Cucumber Extents Report</name>
Expand Down
15 changes: 14 additions & 1 deletion src/main/java/com/cucumber/listener/Reporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@

import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* This class houses few utilities required for the report
*/
public class Reporter {
private static Map<String, Boolean> systemInfoKeyMap = new HashMap<String, Boolean>();

private Reporter() {
// Defeat instantiation
Expand Down Expand Up @@ -104,15 +107,24 @@ public static void addScreenCast(String screenCastPath) throws IOException {

/**
* Sets the system information with the given key value pair
* @param key The name of the key
*
* @param key The name of the key
* @param value The value of the given key
*/
public static void setSystemInfo(String key, String value) {
if (systemInfoKeyMap.isEmpty() || !systemInfoKeyMap.containsKey(key)) {
systemInfoKeyMap.put(key, false);
}
if (systemInfoKeyMap.get(key)) {
return;
}
getExtentReport().setSystemInfo(key, value);
systemInfoKeyMap.put(key, true);
}

/**
* Sets the test runner output with the given list of strings
*
* @param log The list of string messages
*/
public static void setTestRunnerOutput(List<String> log) {
Expand All @@ -121,6 +133,7 @@ public static void setTestRunnerOutput(List<String> log) {

/**
* Sets the test runner output with the given string
*
* @param outputMessage The message to be shown in the test runner output screen
*/
public static void setTestRunnerOutput(String outputMessage) {
Expand Down

0 comments on commit c3ba300

Please sign in to comment.