Skip to content

Commit

Permalink
configure maven to run run cucumber tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gerencsermate committed May 21, 2024
1 parent 80e06c7 commit 76dd796
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 11 deletions.
29 changes: 23 additions & 6 deletions Drumakomi_sivatag/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,23 @@
<artifactId>cucumber-core</artifactId>
<version>7.18.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
</plugin>
</plugins>
</pluginManagement>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -70,13 +85,15 @@
</plugin>
<!-- JUnit 5 requires Surefire version 2.22.1 or higher -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
<configuration>
<includes>
<include>RunCucumberTest</include>
</includes>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit4</artifactId>
<version>3.2.5</version>
</dependency>
</dependencies>
</plugin>
<!-- <plugin>-->
<!-- <groupId>org.jacoco</groupId>-->
Expand Down
13 changes: 10 additions & 3 deletions Drumakomi_sivatag/src/test/java/SaboteurStepDefinitions.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import org.junit.jupiter.api.Assertions;


import static org.junit.Assert.assertEquals;
Expand Down Expand Up @@ -40,11 +41,15 @@ public void the_pipe_is(String condition) {
if (condition.equals("sticky")) {
pipe.setStucky(10);
}
if (condition.equals("slippery")) {
pipe.setSlippery(10);
}
if (condition.equals("not slippery")) {
pipe.setSlippery(0);
}
if (condition.equals("not sticky")) {
pipe.setSlippery(0);
pipe.setStucky(0);
Assertions.assertEquals(pipe.isstucky(), false);
}
}

Expand All @@ -62,13 +67,13 @@ public void the_saboteur_is_on_a(String type) {
if (pipe == null) {
pipe = new Pipe();
}
saboteur = new Saboteur(1, 0, pipe);
saboteur.setElement(pipe);
}
else if (type.equals("pump")) {
if (pump == null) {
pump = new Pump();
}
saboteur = new Saboteur(1, 0, pump);
saboteur.setElement(pump);
}
}

Expand Down Expand Up @@ -148,9 +153,11 @@ public void theSaboteurStepsToAPump() {
@When("The saboteur make the element to {string}")
public void theSaboteurMakeTheElementTo(String condition) {
if(condition.equals("slippery")) {
pipe.setSlippery(10);
saboteur.SetSlippery();
}
if (condition.equals("sticky")) {
pipe.setStucky(10);
saboteur.SetStucky();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,15 @@ Feature: Saboteur test
And The pipe is "not slippery"
And The pipe is "not sticky"
When The saboteur make the element to "slippery"
Then The pipe should be "slippery"
Then The pipe should be "slippery"


Scenario: Set a pipe to sticky
Given A saboteur
And The saboteur is on a "pipe"
And The pipe is "not slippery"
And The pipe is "not sticky"
When The saboteur make the element to "sticky"
Then The pipe should be "sticky"
Then The pipe should be "sticky"


0 comments on commit 76dd796

Please sign in to comment.