Skip to content
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.

Feature/tri 600 integrate cucumber execution #321

Merged
merged 13 commits into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/CI-xray-cucumber.yaml
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"
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ COPY irs-models irs-models
COPY irs-parent-spring-boot irs-parent-spring-boot
COPY irs-testing irs-testing
COPY irs-report-aggregate irs-report-aggregate
COPY cucumber-tests cucumber-tests

# the --mount option requires BuildKit.
RUN --mount=type=cache,target=/root/.m2 mvn -B clean package -pl :$BUILD_TARGET -am -DskipTests
Expand Down
88 changes: 88 additions & 0 deletions cucumber-tests/pom.xml
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>
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 {
}
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() {

}
}
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);
}
}
1 change: 1 addition & 0 deletions cucumber-tests/src/test/resources/cucumber.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cucumber.publish.quiet=true
10 changes: 10 additions & 0 deletions cucumber-tests/src/test/resources/features/1_TRI-686.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@TRI-686
ds-jkreutzfeld marked this conversation as resolved.
Show resolved Hide resolved
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
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<module>irs-models</module>
<module>integration-tests</module>
<module>irs-report-aggregate</module>
<module>cucumber-tests</module>
</modules>

<properties>
Expand Down