Skip to content

Commit cb13530

Browse files
committed
feat: Update to cucumber-jvm 5 & JUnit 5
Minimum JDK version is now 11. Other dependencies have also been updated.
1 parent 6b7a7a9 commit cb13530

File tree

11 files changed

+94
-203
lines changed

11 files changed

+94
-203
lines changed

.editorconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[*]
2+
indent_style = tab
3+
charset = utf-8
4+
trim_trailing_whitespace = true
5+
insert_final_newline = true
6+
end_of_line = lf
7+
8+
[{*.yml,*.yaml}]
9+
indent_style = space
10+
tab_width = 2

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
/target/
22
/.classpath
33
/.project
4+
.DS_Store
5+
.idea/

.settings/org.eclipse.jdt.core.prefs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
eclipse.preferences.version=1
22
org.eclipse.jdt.core.compiler.codegen.methodParameters=generate
3-
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4-
org.eclipse.jdt.core.compiler.compliance=1.8
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
4+
org.eclipse.jdt.core.compiler.compliance=11
55
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
66
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
77
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
88
org.eclipse.jdt.core.compiler.release=disabled
9-
org.eclipse.jdt.core.compiler.source=1.8
9+
org.eclipse.jdt.core.compiler.source=11
1010
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
1111
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
1212
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16

README.md

Lines changed: 37 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,27 @@
33
## BDD automation testing made simple
44
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.kripaliz/unifiedbdd-automation-framework/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.kripaliz/unifiedbdd-automation-framework)
55

6-
UI Automation framework / solution implemented in Java to support web browser as well as mobile browser / App automation. This includes
6+
Automation framework / solution implemented in Java to support web browser as well as mobile browser / App automation. This includes
77

88
* abstraction for PageObject
99
* ContextLoader for Spring context initialisation
10-
* TestNg test runner that kicks off cucumber
10+
* Junit5 test runner that kicks off cucumber
1111
* Spring Boot application configuration
1212
* Webdriver properties, test data properties
1313

1414
## Built With
1515

16-
* [Cucumber](https://docs.cucumber.io/guides/bdd-tutorial/) – BDD tests
16+
* [Cucumber](https://cucumber.io/docs/cucumber/) – BDD tests
1717
* [Allure Reports](https://docs.qameta.io/allure/) - test report
1818
* [Selenium](https://www.seleniumhq.org/) – web automation
1919
* [Appium](http://appium.io/) – mobile automation
20-
* [Page Object Model](https://www.seleniumhq.org/docs/06_test_design_considerations.jsp) – design pattern to abstract page behaviour
20+
* [Page Object Model](https://www.selenium.dev/documentation/test_practices/encouraged/page_object_models/) – design pattern to abstract page behaviour
2121
* [Spring Boot](http://spring.io/projects/spring-boot) – cleaner code
2222
* [Webdriver Manager](https://github.com/bonigarcia/webdrivermanager) – manage webdriver executables automatically
2323

2424
## Prerequisites
2525

26-
* [Java 8](https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
26+
* [JDK 11](https://openjdk.org/projects/jdk/11)
2727
* [Maven](https://maven.apache.org/download.cgi)
2828

2929
## Usage
@@ -39,11 +39,17 @@ To use this automation framework in your test suite:
3939
<parent>
4040
<groupId>com.github.kripaliz</groupId>
4141
<artifactId>unifiedbdd-automation-parent</artifactId>
42-
<version>0.1.3</version>
42+
<version>0.1.6</version>
4343
</parent>
4444
<groupId>com.company.testing</groupId>
4545
<artifactId>uiautomation-suite</artifactId>
4646
<version>0.0.1-SNAPSHOT</version>
47+
48+
<properties>
49+
<cucumber.execution.parallel.enabled>true</cucumber.execution.parallel.enabled>
50+
<cucumber.glue>com.company.testing.step</cucumber.glue>
51+
<cucumber.plugin>json:target/cucumber-reports/result.json,junit:target/cucumber-reports/result.xml</cucumber.plugin>
52+
</properties>
4753
</project>
4854
```
4955

@@ -55,12 +61,12 @@ To use this automation framework in your test suite:
5561
spring.profiles.active: chrome
5662

5763
---
58-
spring.profiles: chrome
64+
spring.config.activate.on-profile: chrome
5965
webdriver:
6066
type: chrome
6167

6268
---
63-
spring.profiles: saucelabs
69+
spring.config.activate.on-profile: saucelabs
6470
webdriver:
6571
type: remote
6672
url: http://user:[email protected]:80/wd/hub
@@ -75,28 +81,29 @@ To use this automation framework in your test suite:
7581
```xml
7682
<?xml version="1.0" encoding="UTF-8"?>
7783
<configuration>
78-
84+
7985
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
80-
<!-- encoders are assigned the type ch.qos.logback.classic.encoder.PatternLayoutEncoder
86+
<!-- encoders are assigned the type ch.qos.logback.classic.encoder.PatternLayoutEncoder
8187
by default -->
8288
<encoder>
8389
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
8490
</encoder>
8591
</appender>
86-
92+
93+
<logger name="org.apache.http" level="INFO" />
8794
<logger name="org.springframework" level="INFO" />
88-
95+
8996
<root level="debug">
9097
<appender-ref ref="STDOUT" />
9198
</root>
9299
</configuration>
93100
```
94-
4. Create a testng runner file which extends `com.github.kripaliz.automation.AbstractAutomationTests`
101+
4. Create a Tests class
95102

96103
```java
97-
@CucumberOptions(glue = { "com.company.testing.step" })
98-
public class AutomationTests extends AbstractAutomationTests {
99-
104+
@Cucumber
105+
public class AutomationTests {
106+
100107
}
101108
```
102109

@@ -107,10 +114,10 @@ To use this automation framework in your test suite:
107114
```java
108115
@PageObject
109116
public class AnukoHomePage extends AbstractPage {
110-
117+
111118
@FindBy(css = AnukoHomePageConstants.LOGIN_LINK_CSS)
112119
private WebElement loginLink;
113-
120+
114121
public void visitUrl() {
115122
webDriver.get("https://timetracker.anuko.com/");
116123
}
@@ -123,7 +130,7 @@ To use this automation framework in your test suite:
123130

124131
@Autowired
125132
private AnukoHomePage anukoHomePage;
126-
133+
127134
@Given("^I visit Anuko Home Page$")
128135
public void i_visit_Anuko_Home_Page() throws Exception {
129136
anukoHomePage.visitUrl();
@@ -135,13 +142,18 @@ To use this automation framework in your test suite:
135142
8. To run the suite
136143

137144
```sh
138-
mvn clean test -Dcucumber.options="--tags not @wip" -Dspring.profiles.active=chrome -DthreadCount=4
145+
mvn clean test \
146+
-Dcucumber.execution.parallel.config.fixed.parallelism=10 \
147+
-Dcucumber.filter.tags="not @wip" \
148+
-Dspring.profiles.active=chrome \
149+
-Dsurefire.rerunFailingTestsCount=0
139150
```
140-
151+
141152
options:
142-
- tags: specify [cucumber tags](https://cucumber.io/docs/cucumber/api/#tags) that you need to run
143-
- spring.profiles.active: switch between [spring profiles](https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-profiles.html) created in application.yml
144-
- threadCount: specify the number of concurrent scenarios to execute
153+
- `cucumber.execution.parallel.config.fixed.parallelism`: specify the number of concurrent scenarios to execute
154+
- `cucumber.filter.tags`: specify [cucumber tags](https://cucumber.io/docs/cucumber/api/#tags) that you need to run
155+
- `spring.profiles.active`: switch between [spring profiles](https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.profiles) created in application.yml
156+
- `surefire.rerunFailingTestsCount`: reruns for any failed tests
145157

146158
9. To view the [allure report](https://github.com/allure-framework/allure-maven)
147159

@@ -171,5 +183,5 @@ Here's some more info on ServiceLoader; https://www.baeldung.com/java-spi
171183
172184
* Download [eclipse](https://www.eclipse.org/downloads/)
173185
* Follow instructions [here](https://projectlombok.org/setup/eclipse) for lombok setup
174-
* Install eclipse plugins from the [eclipse marketplace](https://marketplace.eclipse.org/content/welcome-eclipse-marketplace) or using their [update site](https://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Ftasks%2Ftasks-127.htm) - [TestNG](https://dl.bintray.com/testng-team/testng-eclipse-release/6.14.3/), [YEdit](http://dadacoalition.org/yedit/), [Cucumber](https://cucumber.github.io/cucumber-eclipse-update-site-snapshot)
186+
* Install eclipse plugins from the [eclipse marketplace](https://marketplace.eclipse.org/content/welcome-eclipse-marketplace) or using their [update site](https://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Ftasks%2Ftasks-127.htm) - [YEdit](http://dadacoalition.org/yedit/), [Cucumber](https://cucumber.github.io/cucumber-eclipse-update-site-snapshot)
175187
* Follow instructions in the answer [here](https://stackoverflow.com/questions/1886185/eclipse-and-windows-newlines) to use Unix style line endings for new files

pom.xml

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,56 @@
44
<parent>
55
<groupId>org.springframework.boot</groupId>
66
<artifactId>spring-boot-starter-parent</artifactId>
7-
<version>2.1.8.RELEASE</version>
7+
<version>2.7.10</version>
88
</parent>
99
<groupId>com.github.kripaliz</groupId>
1010
<artifactId>unifiedbdd-automation-framework</artifactId>
11-
<version>0.1.5</version>
11+
<version>0.1.6</version>
1212

1313
<properties>
14-
<allure.version>2.13.0</allure.version>
14+
<allure.version>2.21.0</allure.version>
1515
<appium.version>7.2.0</appium.version>
16-
<cucumber.version>4.7.2</cucumber.version>
17-
<java.version>1.8</java.version>
18-
<lombok.version>1.18.10</lombok.version>
16+
<cucumber.version>5.7.0</cucumber.version>
17+
<java.version>11</java.version>
18+
<lombok.version>1.18.26</lombok.version>
19+
<okhttp.version>3.12.0</okhttp.version>
1920
<selenium.version>3.141.59</selenium.version>
2021
<webdrivermanager.version>3.7.1</webdrivermanager.version>
2122
</properties>
2223

24+
<dependencyManagement>
25+
<dependencies>
26+
<dependency>
27+
<groupId>com.google.guava</groupId>
28+
<artifactId>guava</artifactId>
29+
<version>25.0-jre</version>
30+
</dependency>
31+
</dependencies>
32+
</dependencyManagement>
33+
2334
<dependencies>
35+
<dependency>
36+
<groupId>io.cucumber</groupId>
37+
<artifactId>cucumber-java</artifactId>
38+
<version>${cucumber.version}</version>
39+
</dependency>
2440
<dependency>
2541
<groupId>io.cucumber</groupId>
2642
<artifactId>cucumber-spring</artifactId>
2743
<version>${cucumber.version}</version>
2844
</dependency>
2945
<dependency>
3046
<groupId>io.cucumber</groupId>
31-
<artifactId>cucumber-testng</artifactId>
47+
<artifactId>cucumber-junit-platform-engine</artifactId>
3248
<version>${cucumber.version}</version>
3349
</dependency>
50+
<dependency>
51+
<groupId>org.junit.platform</groupId>
52+
<artifactId>junit-platform-suite</artifactId>
53+
</dependency>
3454
<dependency>
3555
<groupId>io.qameta.allure</groupId>
36-
<artifactId>allure-cucumber4-jvm</artifactId>
56+
<artifactId>allure-cucumber5-jvm</artifactId>
3757
<version>${allure.version}</version>
3858
</dependency>
3959
<dependency>
@@ -187,4 +207,4 @@
187207
</build>
188208
</profile>
189209
</profiles>
190-
</project>
210+
</project>

src/main/java/com/github/kripaliz/automation/AbstractAutomationTests.java

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/main/java/com/github/kripaliz/automation/cucumber/DataTableTypeProvider.java

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/main/java/com/github/kripaliz/automation/cucumber/ParameterTypeProvider.java

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/main/java/com/github/kripaliz/automation/cucumber/glue/ContextLoader.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
package com.github.kripaliz.automation.cucumber.glue;
22

3-
import org.junit.runner.RunWith;
43
import org.springframework.boot.test.context.SpringBootTest;
5-
import org.springframework.test.context.junit4.SpringRunner;
64

75
import com.github.kripaliz.automation.AutomationApplication;
86

97
import io.cucumber.java.Before;
8+
import io.cucumber.spring.CucumberContextConfiguration;
109

1110
/**
1211
* This class loads the spring context for cucumber execution. This package is
@@ -15,7 +14,7 @@
1514
* @author kkurian
1615
*
1716
*/
18-
@RunWith(SpringRunner.class)
17+
@CucumberContextConfiguration
1918
@SpringBootTest(classes = AutomationApplication.class)
2019
public class ContextLoader {
2120

0 commit comments

Comments
 (0)