From 5fe0738c9869bc230f8bd72e8392d2d79995ab56 Mon Sep 17 00:00:00 2001 From: Correct Name Date: Wed, 27 Nov 2024 21:50:22 +0300 Subject: [PATCH 1/3] call & callonce functions fix --- .../main/java/io/qameta/allure/karate/AllureKarate.java | 8 ++++++++ 1 file changed, 8 insertions(+) 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 2c629a9f..37c62f2c 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 @@ -173,6 +173,10 @@ public boolean beforeStep(final Step step, return true; } + if (step.getText().startsWith("call") || step.getText().startsWith("callonce")) { + return true; + } + final String uuid = parentUuid + "-" + step.getIndex(); final io.qameta.allure.model.StepResult stepResult = new io.qameta.allure.model.StepResult() .setName(step.getText()); @@ -190,6 +194,10 @@ public void afterStep(final StepResult result, return; } + if (step.getText().startsWith("call") || step.getText().startsWith("callonce")) { + return; + } + final Step step = result.getStep(); final String uuid = parentUuid + "-" + step.getIndex(); From 2377f608e342924adfcdd56585d39890bb7c2401 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 2/3] 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 37c62f2c..6fa4e1cb 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 a1cf77b3..fedbd276 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 00000000..e6b0effe --- /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 From 39023b830a54920d96d11dddfe895d51521b25c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Cmit=20=C3=96zdemir?= Date: Fri, 29 Nov 2024 13:01:26 +0300 Subject: [PATCH 3/3] update global config --- allure-karate/src/test/resources/testdata/call-callonce.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/allure-karate/src/test/resources/testdata/call-callonce.feature b/allure-karate/src/test/resources/testdata/call-callonce.feature index e6b0effe..e64bbf04 100644 --- a/allure-karate/src/test/resources/testdata/call-callonce.feature +++ b/allure-karate/src/test/resources/testdata/call-callonce.feature @@ -10,4 +10,4 @@ Feature: Call & Call once Feature * call read('classpath:testdata/apiResponse.feature') * callonce read('classpath:testdata/api.feature') - Then print 'Main scenario completed.' \ No newline at end of file + Then print 'Main scenario completed.'