Skip to content
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

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
* Copyright 2016-2024 Qameta Software Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.qameta.allure.cucumber4jvm.samples;

import io.cucumber.java.Before;
import io.cucumber.java.en.And;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import io.qameta.allure.Allure;

/**
* @author charlie (Dmitry Baev).
*/
public class RuntimeApiSteps {

@Before("@beforeScenario")
public void beforeScenario(){
// nothing
}

@Before("@beforeFeature")
public void beforeFeature(){
// nothing
}

@When("^step 1$")
public void step1() {
Allure.step("step1 nested");
Allure.link("step1", "https://example.org/step1");
Allure.getLifecycle().getCurrentTestCase().ifPresent(uuid -> {
System.out.println("step1: " + uuid);
});
}

@When("^step 2$")
public void step2() {
Allure.step("step2 nested");
Allure.link("step2", "https://example.org/step2");
Allure.getLifecycle().getCurrentTestCase().ifPresent(uuid -> {
System.out.println("step2: " + uuid);
});
}

@And("^step 3$")
public void step3() {
Allure.step("step3 nested");
Allure.link("step3", "https://example.org/step3");
Allure.getLifecycle().getCurrentTestCase().ifPresent(uuid -> {
System.out.println("step3: " + uuid);
});
}

@Then("^step 4$")
public void step4() {
Allure.step("step4 nested");
Allure.link("step4", "https://example.org/step4");
Allure.getLifecycle().getCurrentTestCase().ifPresent(uuid -> {
System.out.println("step4: " + uuid);
});
}

@And("^step 5$")
public void step5() {
Allure.step("step5 nested");
Allure.link("step5", "https://example.org/step5");
Allure.getLifecycle().getCurrentTestCase().ifPresent(uuid -> {
System.out.println("step5: " + uuid);
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@beforeFeature
Feature: Should support runtime API in all steps

@beforeScenario
Scenario: Scenario with Runtime API usage
When step 1
When step 2
And step 3
Then step 4
And step 5
2 changes: 2 additions & 0 deletions allure-cucumber5-jvm/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ dependencies {
testImplementation("org.assertj:assertj-core")
testImplementation("org.junit.jupiter:junit-jupiter-api")
testImplementation("org.slf4j:slf4j-simple")
testImplementation(project(":allure-assertj"))
testImplementation(project(":allure-java-commons-test"))
testImplementation(project(":allure-junit-platform"))
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
}

Expand Down
Loading