From 50c17bcaa3ad1691ebce3e6df1c447ce7d713841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Cmit=20=C3=96zdemir?= Date: Fri, 29 Nov 2024 12:57:00 +0300 Subject: [PATCH] Call & callonce bugfix test --- .../java/io/qameta/allure/karate/AllureKarate.java | 2 +- .../io/qameta/allure/karate/AllureKarateTest.java | 10 ++++++++++ .../test/resources/testdata/call-callonce.feature | 13 +++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 allure-karate/src/test/resources/testdata/call-callonce.feature diff --git a/allure-karate/src/main/java/io/qameta/allure/karate/AllureKarate.java b/allure-karate/src/main/java/io/qameta/allure/karate/AllureKarate.java index 37c62f2ce..6fa4e1cb8 100644 --- a/allure-karate/src/main/java/io/qameta/allure/karate/AllureKarate.java +++ b/allure-karate/src/main/java/io/qameta/allure/karate/AllureKarate.java @@ -194,11 +194,11 @@ public void afterStep(final StepResult result, return; } + final Step step = result.getStep(); if (step.getText().startsWith("call") || step.getText().startsWith("callonce")) { return; } - final Step step = result.getStep(); final String uuid = parentUuid + "-" + step.getIndex(); final Result stepResult = result.getResult(); diff --git a/allure-karate/src/test/java/io/qameta/allure/karate/AllureKarateTest.java b/allure-karate/src/test/java/io/qameta/allure/karate/AllureKarateTest.java index a1cf77b39..fedbd276f 100644 --- a/allure-karate/src/test/java/io/qameta/allure/karate/AllureKarateTest.java +++ b/allure-karate/src/test/java/io/qameta/allure/karate/AllureKarateTest.java @@ -322,6 +322,16 @@ void shouldCreateAttachments() { .isGreaterThan(Long.parseLong(firstAttachmentDateCreated)); } + @Test + void shouldSkipCallAndCallOnceStepsInBeforeStep() { + final AllureResults results = runApi("classpath:testdata/call-callonce.feature"); + + assertThat(results.getTestResults()) + .flatExtracting(TestResult::getSteps) + .extracting(StepResult::getName) + .doesNotContain("call", "callonce"); + } + @Test void buildTest() { Runner.builder() diff --git a/allure-karate/src/test/resources/testdata/call-callonce.feature b/allure-karate/src/test/resources/testdata/call-callonce.feature new file mode 100644 index 000000000..e6b0effe2 --- /dev/null +++ b/allure-karate/src/test/resources/testdata/call-callonce.feature @@ -0,0 +1,13 @@ +Feature: Call & Call once Feature + This feature calls another feature and demonstrates Allure reporting issue. + + @smoke + Scenario: Main Scenario with a call + Given url 'https://jsonplaceholder.typicode.com' + When method GET + Then status 200 + + * call read('classpath:testdata/apiResponse.feature') + * callonce read('classpath:testdata/api.feature') + + Then print 'Main scenario completed.' \ No newline at end of file