Skip to content

Commit

Permalink
#1 Update pom.xml + several dependencies: Cucumber, Spring, ...
Browse files Browse the repository at this point in the history
-> Updating several dependencies...
-> New Annotation needed to use Cucumber + Spring:
--> See CucumberSpringConfiguration.class for the configuration
--> Add the testconfiguration-folder to the glue list (in TestRunnerTestNG.class)
-> New Configuration: Use UTF-8 for Source Encoding
  • Loading branch information
helkv committed Nov 11, 2020
1 parent f74ba8c commit af4a457
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 19 deletions.
33 changes: 19 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
<groupId>org.keeper.ui.test</groupId>
<artifactId>keeper-ui-tests</artifactId>
<version>0.0.1-SNAPSHOT</version>


<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<resources>
<resource>
Expand All @@ -15,7 +19,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
Expand All @@ -24,7 +28,8 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<!-- Tests are not executed with newer versions of surefire: <version>3.0.0-M5</version>-->
<version>2.22.2</version>
<configuration>
<skipTests>false</skipTests>
<properties>
Expand All @@ -43,49 +48,49 @@
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-core</artifactId>
<version>5.0.0-RC1</version>
<version>6.8.2</version>
</dependency>

<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>5.0.0-RC1</version>
<version>6.8.2</version>
</dependency>

<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-testng</artifactId>
<version>5.0.0-RC1</version>
<version>6.8.2</version>
</dependency>

<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-spring</artifactId>
<version>5.0.0-RC1</version>
<version>6.8.2</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>5.2.2.RELEASE</version>
<version>5.3.1</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.2.2.RELEASE</version>
<version>5.3.1</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>2.2.2.RELEASE</version>
<version>2.3.5.RELEASE</version>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.0.0</version>
<version>7.3.0</version>
<scope>test</scope>
</dependency>

Expand All @@ -98,14 +103,14 @@
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.14.0</version>
<version>3.18.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>3.8.0</version>
<version>4.2.2</version>
</dependency>

<dependency>
Expand All @@ -128,4 +133,4 @@
</profile>
</profiles>

</project>
</project>
3 changes: 0 additions & 3 deletions src/test/java/stepdefinitions/AuthenticationSteps.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@
import org.openqa.selenium.WebDriver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Lazy;

import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import testconfiguration.TestConfiguration;
import ui.pages.HomePage;
import ui.pages.LoginPage;

Expand All @@ -23,7 +21,6 @@
* @author helk
*
*/
@SpringBootTest(classes = TestConfiguration.class)
public class AuthenticationSteps {

@Autowired
Expand Down
23 changes: 23 additions & 0 deletions src/test/java/testconfiguration/CucumberSpringConfiguration.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package testconfiguration;

import io.cucumber.java.Before;
import io.cucumber.spring.CucumberContextConfiguration;
import org.springframework.boot.test.context.SpringBootTest;

/**
* Class to configure Cucumber to use SpringBoot to manage the application context.
*
* @author helk
*
*/
@CucumberContextConfiguration
@SpringBootTest(classes = TestConfiguration.class)
public class CucumberSpringConfiguration {

@Before
public void setupCucumberSpringContext(){
// Dummy method so cucumber will recognize this class as glue
// and use its context configuration.
}

}
4 changes: 2 additions & 2 deletions src/test/java/testrunner/TestRunnerTestNG.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*
*/
@CucumberOptions(plugin = "pretty", glue = { "stepdefinitions",
"hookdefinitions" }, features = "src/test/resources/features")
"hookdefinitions", "testconfiguration" }, features = "src/test/resources/features")
public class TestRunnerTestNG extends AbstractTestNGCucumberTests {

@Override
Expand All @@ -21,4 +21,4 @@ public Object[][] scenarios() {
return super.scenarios();
}

}
}

0 comments on commit af4a457

Please sign in to comment.