diff --git a/src/main/java/com/aventstack/extentreports/service/ExtentService.java b/src/main/java/com/aventstack/extentreports/service/ExtentService.java index 82b8217..564a340 100644 --- a/src/main/java/com/aventstack/extentreports/service/ExtentService.java +++ b/src/main/java/com/aventstack/extentreports/service/ExtentService.java @@ -49,6 +49,7 @@ private static class ExtentReportsLoader { "extent.properties", "com/aventstack/adapter/extent.properties" }; + private static final String SYS_INFO_MARKER = "systeminfo."; private static final String OUTPUT_PATH = "test-output/"; private static final String EXTENT_REPORTER = "extent.reporter"; private static final String START = "start"; @@ -140,6 +141,8 @@ private static void createViaProperties() { if (properties.containsKey(INIT_TABULAR_KEY) && "true".equals(String.valueOf(properties.get(INIT_TABULAR_KEY)))) initTabular(properties); + + addSystemInfo(properties); } catch (Exception e) { e.printStackTrace(); } @@ -173,6 +176,8 @@ private static void createViaSystem() { if ("true".equals(System.getProperty(INIT_TABULAR_KEY))) initTabular(null); + + addSystemInfo(System.getProperties()); } private static void initAvent(Properties properties) { @@ -263,6 +268,15 @@ private static void attach(ConfigurableReporter r, Properties properties, String r.loadXMLConfig(String.valueOf(configPath)); INSTANCE.attachReporter(r); } - } - + + private static void addSystemInfo(Properties properties) { + properties.forEach((k,v) -> { + String key = String.valueOf(k); + if(key.startsWith(SYS_INFO_MARKER)) { + key = key.substring(key.indexOf('.')+1); + INSTANCE.setSystemInfo(key, String.valueOf(v)); + } + }); + } + } } diff --git a/src/test/resources/com/aventstack/adapter/extent.properties b/src/test/resources/com/aventstack/adapter/extent.properties index 7246dcb..30a76be 100644 --- a/src/test/resources/com/aventstack/adapter/extent.properties +++ b/src/test/resources/com/aventstack/adapter/extent.properties @@ -29,3 +29,6 @@ extent.reporter.tabular.out=test-output/TabularReport/ screenshot.dir=test-output/ screenshot.rel.path=../ + +systeminfo.os=Windows +systeminfo.version=10