Skip to content

Commit 8d9ce97

Browse files
committed
updated allure report logic
1 parent 88b32e8 commit 8d9ce97

4 files changed

Lines changed: 55 additions & 30 deletions

File tree

pom.xml

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
<json-simple.version>1.1.1</json-simple.version>
1717
<comslang.version>3.11</comslang.version>
1818
<alluretestng.version>2.12.0</alluretestng.version>
19-
<slf4j.version>1.7.30</slf4j.version>
19+
<allure.version>2.10.0</allure.version>
20+
<slf4j.version>1.7.30</slf4j.version>
2021
<cucumber.version>6.9.1</cucumber.version>
2122
<logback.version>1.2.3</logback.version>
2223
<testng.version>6.14.3</testng.version>
@@ -62,6 +63,11 @@
6263
<artifactId>allure-testng</artifactId>
6364
<version>${alluretestng.version}</version>
6465
</dependency>
66+
<dependency>
67+
<groupId>io.qameta.allure</groupId>
68+
<artifactId>allure-maven</artifactId>
69+
<version>${allure.version}</version>
70+
</dependency>
6571

6672
<dependency>
6773
<groupId>org.slf4j</groupId>
@@ -130,7 +136,7 @@
130136
</argLine>
131137
<systemPropertyVariables>
132138
<environment>local</environment>
133-
<application_endpoint>${application-url}</application_endpoint>
139+
<application_endpoint>${application-url}</application_endpoint>
134140
</systemPropertyVariables>
135141
<suiteXmlFiles>
136142
<suiteXmlFile>src/test/resources/conf/TestNG_Single.xml</suiteXmlFile>
@@ -151,7 +157,7 @@
151157
<configuration>
152158
<systemPropertyVariables>
153159
<environment>local</environment>
154-
<application_endpoint>${application-url}</application_endpoint>
160+
<application_endpoint>${application-url}</application_endpoint>
155161
</systemPropertyVariables>
156162
<suiteXmlFiles>
157163
<suiteXmlFile>src/test/resources/conf/TestNG_Single.xml</suiteXmlFile>
@@ -175,7 +181,7 @@
175181
</argLine>
176182
<systemPropertyVariables>
177183
<environment>docker</environment>
178-
<application_endpoint>${application-url}</application_endpoint>
184+
<application_endpoint>${application-url}</application_endpoint>
179185
</systemPropertyVariables>
180186
<suiteXmlFiles>
181187
<suiteXmlFile>src/test/resources/conf/TestNG_Single.xml</suiteXmlFile>
@@ -196,15 +202,15 @@
196202
<configuration>
197203
<systemPropertyVariables>
198204
<environment>docker</environment>
199-
<application_endpoint>${application-url}</application_endpoint>
205+
<application_endpoint>${application-url}</application_endpoint>
200206
</systemPropertyVariables>
201207
<suiteXmlFiles>
202208
<suiteXmlFile>src/test/resources/conf/TestNG_Parallel.xml</suiteXmlFile>
203209
</suiteXmlFiles>
204-
<argLine>
205-
-Ddataproviderthreadcount=${parallel-count}
206-
</argLine>
207-
</configuration>
210+
<argLine>
211+
-Ddataproviderthreadcount=${parallel-count}
212+
</argLine>
213+
</configuration>
208214
</plugin>
209215
</plugins>
210216
</build>
@@ -223,7 +229,7 @@
223229
</argLine>
224230
<systemPropertyVariables>
225231
<environment>remote</environment>
226-
<application_endpoint>${application-url}</application_endpoint>
232+
<application_endpoint>${application-url}</application_endpoint>
227233
</systemPropertyVariables>
228234
<suiteXmlFiles>
229235
<suiteXmlFile>src/test/resources/conf/TestNG_Single.xml</suiteXmlFile>
@@ -247,7 +253,7 @@
247253

248254
<systemPropertyVariables>
249255
<environment>remote</environment>
250-
<application_endpoint>${application-localhost-url}</application_endpoint>
256+
<application_endpoint>${application-localhost-url}</application_endpoint>
251257
<caps_type>local</caps_type>
252258
<env_cap_id>2</env_cap_id>
253259
</systemPropertyVariables>
@@ -269,15 +275,15 @@
269275
<configuration>
270276
<systemPropertyVariables>
271277
<environment>remote</environment>
272-
<application_endpoint>${application-localhost-url}</application_endpoint>
278+
<application_endpoint>${application-localhost-url}</application_endpoint>
273279
<caps_type>local</caps_type>
274280
</systemPropertyVariables>
275281
<suiteXmlFiles>
276282
<suiteXmlFile>src/test/resources/conf/TestNG_Parallel.xml</suiteXmlFile>
277283
</suiteXmlFiles>
278-
<argLine>
279-
-Ddataproviderthreadcount=${parallel-count}
280-
</argLine>
284+
<argLine>
285+
-Ddataproviderthreadcount=${parallel-count}
286+
</argLine>
281287
</configuration>
282288
</plugin>
283289
</plugins>
@@ -293,14 +299,14 @@
293299
<configuration>
294300
<systemPropertyVariables>
295301
<environment>remote</environment>
296-
<application_endpoint>${application-url}</application_endpoint>
302+
<application_endpoint>${application-url}</application_endpoint>
297303
</systemPropertyVariables>
298304
<suiteXmlFiles>
299305
<suiteXmlFile>src/test/resources/conf/TestNG_Parallel.xml</suiteXmlFile>
300306
</suiteXmlFiles>
301-
<argLine>
302-
-Ddataproviderthreadcount=${parallel-count}
303-
</argLine>
307+
<argLine>
308+
-Ddataproviderthreadcount=${parallel-count}
309+
</argLine>
304310
</configuration>
305311
</plugin>
306312
</plugins>
@@ -316,15 +322,15 @@
316322
<configuration>
317323
<systemPropertyVariables>
318324
<environment>remote</environment>
319-
<application_endpoint>${application-localhost-url}</application_endpoint>
325+
<application_endpoint>${application-localhost-url}</application_endpoint>
320326
<caps_type>local</caps_type>
321327
</systemPropertyVariables>
322328
<suiteXmlFiles>
323329
<suiteXmlFile>src/test/resources/conf/TestNG_MultipleParallel.xml</suiteXmlFile>
324330
</suiteXmlFiles>
325-
<argLine>
326-
-Ddataproviderthreadcount=${parallel-count}
327-
</argLine>
331+
<argLine>
332+
-Ddataproviderthreadcount=${parallel-count}
333+
</argLine>
328334
</configuration>
329335
</plugin>
330336
</plugins>
@@ -340,19 +346,19 @@
340346
<configuration>
341347
<systemPropertyVariables>
342348
<environment>remote</environment>
343-
<application_endpoint>${application-url}</application_endpoint>
349+
<application_endpoint>${application-url}</application_endpoint>
344350
</systemPropertyVariables>
345351
<suiteXmlFiles>
346352
<suiteXmlFile>src/test/resources/conf/TestNG_MultipleParallel.xml</suiteXmlFile>
347353
</suiteXmlFiles>
348-
<argLine>
349-
-Ddataproviderthreadcount=${parallel-count}
350-
</argLine>
354+
<argLine>
355+
-Ddataproviderthreadcount=${parallel-count}
356+
</argLine>
351357
</configuration>
352358
</plugin>
353359
</plugins>
354360
</build>
355361
</profile>
356-
362+
357363
</profiles>
358364
</project>

src/test/java/browserstack/stepdefs/BaseTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ public void tearDown() throws Exception {
175175
if (local != null) {
176176
local.stop();
177177
}
178+
Utility.moveFolder();
178179

179180
}
180181

src/test/java/browserstack/utils/AllureReportConfigurationSetup.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@
1212
public class AllureReportConfigurationSetup {
1313

1414
// folders params
15-
static String allureReportResultsFolder = "allure-results";
15+
static String allureReportResultsFolder = System.getProperty("user.dir")+ "/target/"+"allure-results";
1616
static String allureReportPropertiesFileName = "environment.properties";
1717
static String allureReportPropertiesFilePath = allureReportResultsFolder + "/" + allureReportPropertiesFileName;
18-
static String allureReportScreenshotsFolder = "Screenshots";
18+
static String allureReportScreenshotsFolder = System.getProperty("user.dir")+ "/target/"+"Screenshots";
1919

2020
static File allureReportPropertiesFile = new File(allureReportPropertiesFilePath);
2121

2222
public static void prepareAllureResultsFolder() {
23+
System.out.println("allure location "+allureReportResultsFolder);
2324

2425
// step 1. delete allure results folder
2526
File allureResultsFolder = new File(allureReportResultsFolder);

src/test/java/browserstack/utils/Utility.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package browserstack.utils;
22

3+
import org.apache.commons.io.FileUtils;
34
import org.json.simple.JSONObject;
45
import org.json.simple.parser.JSONParser;
56
import org.json.simple.parser.ParseException;
@@ -14,6 +15,7 @@
1415

1516
import browserstack.stepdefs.ThreadLocalDriver;
1617

18+
import java.io.File;
1719
import java.io.FileReader;
1820
import java.io.IOException;
1921
import java.time.Instant;
@@ -82,4 +84,19 @@ public Boolean apply(WebDriver driver) {
8284
};
8385
return wait.until(jsLoad);
8486
}
87+
88+
public static void moveFolder()
89+
{
90+
File from = new File(System.getProperty("user.dir")+"/allure-results");
91+
File to = new File(System.getProperty("user.dir")+"/target/"+"allure-results");
92+
93+
try {
94+
FileUtils.copyDirectory(from, to);
95+
FileUtils.deleteDirectory(new File(System.getProperty("user.dir")+"/allure-results"));
96+
97+
}
98+
catch (IOException ex) {
99+
ex.printStackTrace();
100+
}
101+
}
85102
}

0 commit comments

Comments
 (0)