This repository has been archived by the owner on Feb 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #321 from catenax-ng/feature/TRI-600-integrate-Cuc…
…umber-execution Feature/tri 600 integrate cucumber execution
- Loading branch information
Showing
9 changed files
with
224 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: IRS Cucumber Xray execution | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches-ignore: | ||
- 'main' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
- name: Cache maven packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.m2 | ||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: ${{ runner.os }}-m2 | ||
|
||
- name: Download Feature Files | ||
env: | ||
JIRA_USERNAME: ${{ secrets.ORG_IRS_JIRA_USERNAME }} | ||
JIRA_PASSWORD: ${{ secrets.ORG_IRS_JIRA_PASSWORD }} | ||
# JIRA filter 11349: project = TRI AND type = Test AND "Test Type" = Cucumber | ||
# Downloads all feature files of cucumber tests inside TRI project | ||
run: | | ||
curl -u $JIRA_USERNAME:$JIRA_PASSWORD "https://jira.catena-x.net/rest/raven/1.0/export/test?filter=11349" -o features.zip | ||
unzip -o features.zip -d cucumber-tests/src/test/resources/features | ||
- name: Build with Maven | ||
run: mvn --batch-mode clean compile test -pl cucumber-tests | ||
|
||
- name: Submit results to Xray | ||
env: | ||
JIRA_USERNAME: ${{ secrets.ORG_IRS_JIRA_USERNAME }} | ||
JIRA_PASSWORD: ${{ secrets.ORG_IRS_JIRA_PASSWORD }} | ||
run: | | ||
curl --request POST \ | ||
-u $JIRA_USERNAME:$JIRA_PASSWORD \ | ||
--header 'Content-Type: application/json' \ | ||
--data-binary '@cucumber-tests/report.json' \ | ||
"https://jira.catena-x.net/rest/raven/1.0/import/execution/cucumber" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.eclipse.tractusx.irs</groupId> | ||
<artifactId>irs-parent-spring-boot</artifactId> | ||
<version>${revision}</version> | ||
<relativePath>../irs-parent-spring-boot</relativePath> | ||
</parent> | ||
|
||
<artifactId>cucumber-tests</artifactId> | ||
|
||
<name>IRS Cucumber</name> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.cucumber</groupId> | ||
<artifactId>cucumber-bom</artifactId> | ||
<version>7.5.0</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit</groupId> | ||
<artifactId>junit-bom</artifactId> | ||
<version>5.9.0</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>net.javacrumbs.json-unit</groupId> | ||
<artifactId>json-unit-assertj</artifactId> | ||
<version>${json-unit-assertj.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.cucumber</groupId> | ||
<artifactId>cucumber-java</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.cucumber</groupId> | ||
<artifactId>cucumber-junit-platform-engine</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.junit.platform</groupId> | ||
<artifactId>junit-platform-suite</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.10.1</version> | ||
<configuration> | ||
<encoding>${project.build.sourceEncoding}</encoding> | ||
<source>${maven.compiler.source}</source> | ||
<target>${maven.compiler.target}</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>3.0.0-M7</version> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
16 changes: 16 additions & 0 deletions
16
cucumber-tests/src/test/java/org/eclipse/tractusx/irs/cucumber/RunCucumberTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.eclipse.tractusx.irs.cucumber; | ||
|
||
import org.junit.platform.suite.api.ConfigurationParameter; | ||
import org.junit.platform.suite.api.IncludeEngines; | ||
import org.junit.platform.suite.api.SelectClasspathResource; | ||
import org.junit.platform.suite.api.Suite; | ||
|
||
import static io.cucumber.junit.platform.engine.Constants.PLUGIN_PROPERTY_NAME; | ||
|
||
@Suite | ||
@IncludeEngines("cucumber") | ||
@SelectClasspathResource("features") | ||
@ConfigurationParameter(key = PLUGIN_PROPERTY_NAME, value = "pretty") | ||
@ConfigurationParameter(key = PLUGIN_PROPERTY_NAME, value = "json:report.json") | ||
public class RunCucumberTest { | ||
} |
22 changes: 22 additions & 0 deletions
22
cucumber-tests/src/test/java/org/eclipse/tractusx/irs/cucumber/SampleStepDefinitions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.eclipse.tractusx.irs.cucumber; | ||
|
||
import io.cucumber.java.en.Given; | ||
import io.cucumber.java.en.Then; | ||
import io.cucumber.java.en.When; | ||
|
||
public class SampleStepDefinitions { | ||
|
||
@Given("request for list of jobs \\/irs\\/jobs") | ||
public void requestForListOfJobs() { | ||
} | ||
|
||
@When("\\/irs\\/jobs is executed without any parameter") | ||
public void irsJobsIsExecutedWithoutAnyParameter() { | ||
|
||
} | ||
|
||
@Then("list of jobs with any status is returned.") | ||
public void listOfJobsWithAnyStatusIsReturned() { | ||
|
||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
cucumber-tests/src/test/java/org/eclipse/tractusx/irs/cucumber/TestStepDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.eclipse.tractusx.irs.cucumber; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import io.cucumber.java.en.Given; | ||
import io.cucumber.java.en.Then; | ||
import io.cucumber.java.en.When; | ||
|
||
public class TestStepDefinition { | ||
private Integer int1; | ||
private Integer int2; | ||
private Integer result; | ||
|
||
@Given("I have entered {int} into the calculator") | ||
public void iHaveEnteredIntoTheCalculator(Integer int1) { | ||
this.int2 = this.int1; | ||
this.int1 = int1; | ||
} | ||
|
||
@When("I press add") | ||
public void iPressAdd() { | ||
this.result = this.int1 + this.int2; | ||
} | ||
|
||
@When("I press multiply") | ||
public void iPressMultiply() { | ||
this.result = this.int1 * this.int2; | ||
} | ||
|
||
@Then("the result should be {int} on the screen") | ||
public void theResultShouldBeOnTheScreen(Integer value) { | ||
assertThat(this.result).isEqualTo(value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
cucumber.publish.quiet=true |
10 changes: 10 additions & 0 deletions
10
cucumber-tests/src/test/resources/features/1_TRI-686.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
@TRI-686 | ||
Feature: Cucumber Test Story | ||
|
||
|
||
@TRI-687 | ||
Scenario: Test Cucumber Test Story | ||
Given I have entered 1 into the calculator | ||
And I have entered 2 into the calculator | ||
When I press add | ||
Then the result should be 3 on the screen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters