From 5812b14b89b37b748999a34fad1c9b013a866fb9 Mon Sep 17 00:00:00 2001 From: savkk Date: Thu, 26 Oct 2023 00:37:49 +0300 Subject: [PATCH 1/4] cucumber 7 parameterization support --- pom.xml | 2 +- qase-api/README.md | 2 +- qase-api/pom.xml | 2 +- .../java/io/qase/api/utils/CucumberUtils.java | 5 + qase-cucumber3-jvm/README.md | 2 +- qase-cucumber3-jvm/pom.xml | 2 +- qase-cucumber4-jvm/README.md | 2 +- qase-cucumber4-jvm/pom.xml | 2 +- qase-cucumber5-jvm/README.md | 2 +- qase-cucumber5-jvm/pom.xml | 2 +- qase-cucumber6-jvm/README.md | 2 +- qase-cucumber6-jvm/pom.xml | 2 +- qase-cucumber7-jvm/README.md | 2 +- qase-cucumber7-jvm/pom.xml | 2 +- .../io/qase/cucumber7/QaseEventListener.java | 73 ++++++++++++-- .../cucumber7/QaseEventListenerTests.java | 97 ++++++++++++++++++- .../test/java/io/qase/cucumber7/Steps.java | 4 + .../resources/features/with_examples.feature | 15 +++ qase-junit4-aspect/pom.xml | 2 +- qase-junit4/README.md | 8 +- qase-junit4/pom.xml | 2 +- qase-junit5/README.md | 4 +- qase-junit5/pom.xml | 2 +- qase-testng/README.md | 4 +- qase-testng/pom.xml | 2 +- 25 files changed, 209 insertions(+), 35 deletions(-) create mode 100644 qase-cucumber7-jvm/src/test/resources/features/with_examples.feature diff --git a/pom.xml b/pom.xml index ce4b76a5..7a0d5362 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ io.qase qase-java pom - 3.1.1 + 3.2.0 qase-api qase-testng diff --git a/qase-api/README.md b/qase-api/README.md index 1ae0a41a..7c4237b0 100644 --- a/qase-api/README.md +++ b/qase-api/README.md @@ -8,7 +8,7 @@ Add the following dependency and repository to your pom.xml: io.qase qase-api - 3.1.1 + 3.2.0 ``` diff --git a/qase-api/pom.xml b/qase-api/pom.xml index a58f31c3..65c1648d 100644 --- a/qase-api/pom.xml +++ b/qase-api/pom.xml @@ -5,7 +5,7 @@ qase-java io.qase - 3.1.1 + 3.2.0 4.0.0 diff --git a/qase-api/src/main/java/io/qase/api/utils/CucumberUtils.java b/qase-api/src/main/java/io/qase/api/utils/CucumberUtils.java index 8cffb2e6..eca5789c 100644 --- a/qase-api/src/main/java/io/qase/api/utils/CucumberUtils.java +++ b/qase-api/src/main/java/io/qase/api/utils/CucumberUtils.java @@ -1,5 +1,6 @@ package io.qase.api.utils; +import java.net.URI; import java.util.List; import static io.qase.api.utils.IntegrationUtils.CASE_TAGS; @@ -20,4 +21,8 @@ public static Long getCaseId(List tags) { } return null; } + + public static int getHash(URI uri, Long line) { + return (uri.toString() + line).hashCode(); + } } diff --git a/qase-cucumber3-jvm/README.md b/qase-cucumber3-jvm/README.md index 3eb5d017..0d034463 100644 --- a/qase-cucumber3-jvm/README.md +++ b/qase-cucumber3-jvm/README.md @@ -42,7 +42,7 @@ Add the following dependency and repository to your pom.xml: io.qase qase-cucumber3-jvm - 3.1.1 + 3.2.0 diff --git a/qase-cucumber3-jvm/pom.xml b/qase-cucumber3-jvm/pom.xml index c27395a9..20c4cfec 100644 --- a/qase-cucumber3-jvm/pom.xml +++ b/qase-cucumber3-jvm/pom.xml @@ -5,7 +5,7 @@ qase-java io.qase - 3.1.1 + 3.2.0 4.0.0 diff --git a/qase-cucumber4-jvm/README.md b/qase-cucumber4-jvm/README.md index 33805594..42b4f51e 100644 --- a/qase-cucumber4-jvm/README.md +++ b/qase-cucumber4-jvm/README.md @@ -42,7 +42,7 @@ Add the following dependency and repository to your pom.xml: io.qase qase-cucumber4-jvm - 3.1.1 + 3.2.0 diff --git a/qase-cucumber4-jvm/pom.xml b/qase-cucumber4-jvm/pom.xml index 01233292..20474e81 100644 --- a/qase-cucumber4-jvm/pom.xml +++ b/qase-cucumber4-jvm/pom.xml @@ -5,7 +5,7 @@ qase-java io.qase - 3.1.1 + 3.2.0 4.0.0 diff --git a/qase-cucumber5-jvm/README.md b/qase-cucumber5-jvm/README.md index 7a3c1368..8a07653a 100644 --- a/qase-cucumber5-jvm/README.md +++ b/qase-cucumber5-jvm/README.md @@ -42,7 +42,7 @@ Add the following dependency and repository to your pom.xml: io.qase qase-cucumber5-jvm - 3.1.1 + 3.2.0 diff --git a/qase-cucumber5-jvm/pom.xml b/qase-cucumber5-jvm/pom.xml index 21c6cbd4..2005df61 100644 --- a/qase-cucumber5-jvm/pom.xml +++ b/qase-cucumber5-jvm/pom.xml @@ -5,7 +5,7 @@ qase-java io.qase - 3.1.1 + 3.2.0 4.0.0 diff --git a/qase-cucumber6-jvm/README.md b/qase-cucumber6-jvm/README.md index c75376c1..6ca3e2f2 100644 --- a/qase-cucumber6-jvm/README.md +++ b/qase-cucumber6-jvm/README.md @@ -42,7 +42,7 @@ Add the following dependency and repository to your pom.xml: io.qase qase-cucumber6-jvm - 3.1.1 + 3.2.0 diff --git a/qase-cucumber6-jvm/pom.xml b/qase-cucumber6-jvm/pom.xml index 7e2a2344..5711386d 100644 --- a/qase-cucumber6-jvm/pom.xml +++ b/qase-cucumber6-jvm/pom.xml @@ -5,7 +5,7 @@ qase-java io.qase - 3.1.1 + 3.2.0 4.0.0 diff --git a/qase-cucumber7-jvm/README.md b/qase-cucumber7-jvm/README.md index 7d16297f..03a8aeef 100644 --- a/qase-cucumber7-jvm/README.md +++ b/qase-cucumber7-jvm/README.md @@ -42,7 +42,7 @@ Add the following dependency and repository to your pom.xml: io.qase qase-cucumber7-jvm - 3.1.1 + 3.2.0 diff --git a/qase-cucumber7-jvm/pom.xml b/qase-cucumber7-jvm/pom.xml index c81443b1..4fb4cee7 100644 --- a/qase-cucumber7-jvm/pom.xml +++ b/qase-cucumber7-jvm/pom.xml @@ -5,7 +5,7 @@ qase-java io.qase - 3.1.1 + 3.2.0 4.0.0 diff --git a/qase-cucumber7-jvm/src/main/java/io/qase/cucumber7/QaseEventListener.java b/qase-cucumber7-jvm/src/main/java/io/qase/cucumber7/QaseEventListener.java index b401a024..e8366489 100644 --- a/qase-cucumber7-jvm/src/main/java/io/qase/cucumber7/QaseEventListener.java +++ b/qase-cucumber7-jvm/src/main/java/io/qase/cucumber7/QaseEventListener.java @@ -1,6 +1,14 @@ package io.qase.cucumber7; +import io.cucumber.gherkin.GherkinParser; +import io.cucumber.messages.types.*; import io.cucumber.plugin.ConcurrentEventListener; +import io.cucumber.plugin.event.TestCase; +import io.cucumber.plugin.event.TestCaseFinished; +import io.cucumber.plugin.event.TestCaseStarted; +import io.cucumber.plugin.event.TestRunFinished; +import io.cucumber.plugin.event.TestStepFinished; +import io.cucumber.plugin.event.TestStepStarted; import io.cucumber.plugin.event.*; import io.qase.api.QaseClient; import io.qase.api.StepStorage; @@ -15,17 +23,24 @@ import io.qase.cucumber7.guice.module.Cucumber7Module; import lombok.AccessLevel; import lombok.Getter; +import lombok.extern.slf4j.Slf4j; -import java.util.LinkedList; -import java.util.List; -import java.util.Optional; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.*; +import java.util.stream.Stream; +import static io.qase.api.utils.CucumberUtils.getHash; import static io.qase.api.utils.IntegrationUtils.getStacktrace; +@Slf4j public class QaseEventListener implements ConcurrentEventListener { + private static final Map> EXAMPLES = new HashMap<>(); private static final String REPORTER_NAME = "Cucumber 7-JVM"; - @Getter(lazy = true, value = AccessLevel.PRIVATE) private final QaseTestCaseListener qaseTestCaseListener = createQaseListener(); @@ -40,11 +55,37 @@ public void setEventPublisher(EventPublisher publisher) { publisher.registerHandlerFor(TestCaseFinished.class, this::testCaseFinished); publisher.registerHandlerFor(TestRunFinished.class, this::testRunFinished); publisher.registerHandlerFor(TestStepFinished.class, this::testStepFinished); - publisher.registerHandlerFor(TestStepStarted.class, this::testCaseStarted); + publisher.registerHandlerFor(TestStepStarted.class, this::testStepStarted); } } - private void testCaseStarted(TestStepStarted testStepStarted) { + private void parseExamples(URI uri, Envelope envelope) { + envelope.getGherkinDocument() + .flatMap(GherkinDocument::getFeature) + .ifPresent(feature -> { + for (int i = 0; i < feature.getChildren().size(); i++) { + Scenario scenario = feature.getChildren().get(i).getScenario().get(); + for (Examples exampleItem : scenario.getExamples()) { + List headers = new ArrayList<>(); + exampleItem.getTableHeader() + .ifPresent(headerCell -> + headerCell.getCells().forEach(h -> headers.add(h.getValue()))); + List tableBody = exampleItem.getTableBody(); + for (TableRow tableRow : tableBody) { + List cells = tableRow.getCells(); + HashMap example = new HashMap<>(); + for (int k = 0; k < cells.size(); k++) { + String value = cells.get(k).getValue(); + example.put(headers.get(k), value); + } + EXAMPLES.put(getHash(uri, tableRow.getLocation().getLine()), example); + } + } + } + }); + } + + private void testStepStarted(TestStepStarted testStepStarted) { if (testStepStarted.getTestStep() instanceof PickleStepTestStep) { StepStorage.startStep(); } @@ -88,6 +129,19 @@ private void testRunFinished(TestRunFinished testRunFinished) { } private void testCaseStarted(TestCaseStarted event) { + if (EXAMPLES.get(getHash(event.getTestCase().getUri(), (long) event.getTestCase().getLocation().getLine())) == null) { + TestCase testCase = event.getTestCase(); + URI uri = testCase.getUri(); + GherkinParser gherkinParser = GherkinParser.builder().build(); + try { + Path path = Paths.get(this.getClass().getClassLoader() + .getResource(uri.toString().replace("classpath:", "")).toURI()); + Stream envelopes = gherkinParser.parse(path); + envelopes.forEach(e -> parseExamples(uri, e)); + } catch (IOException | URISyntaxException e) { + log.error(e.getMessage()); + } + } getQaseTestCaseListener().onTestCaseStarted(); } @@ -96,12 +150,13 @@ private void testCaseFinished(TestCaseFinished event) { } private void setupResultItem(ResultCreate resultCreate, TestCaseFinished event) { - List tags = event.getTestCase().getTags(); + TestCase testCase = event.getTestCase(); + List tags = testCase.getTags(); Long caseId = CucumberUtils.getCaseId(tags); String caseTitle = null; if (caseId == null) { - caseTitle = event.getTestCase().getName(); + caseTitle = testCase.getName(); } StatusEnum status = convertStatus(event.getResult().getStatus()); @@ -122,6 +177,8 @@ private void setupResultItem(ResultCreate resultCreate, TestCaseFinished event) .stacktrace(stacktrace) .steps(steps.isEmpty() ? null : steps) .defect(isDefect); + Map params = EXAMPLES.get(getHash(testCase.getUri(), (long) testCase.getLocation().getLine())); + resultCreate.param(params); } private StatusEnum convertStatus(Status status) { diff --git a/qase-cucumber7-jvm/src/test/java/io/qase/cucumber7/QaseEventListenerTests.java b/qase-cucumber7-jvm/src/test/java/io/qase/cucumber7/QaseEventListenerTests.java index 243738a1..0e6d87eb 100644 --- a/qase-cucumber7-jvm/src/test/java/io/qase/cucumber7/QaseEventListenerTests.java +++ b/qase-cucumber7-jvm/src/test/java/io/qase/cucumber7/QaseEventListenerTests.java @@ -74,7 +74,8 @@ void bulk() { String[] args = new String[]{ "-g", "io.qase.cucumber7", "--plugin", "io.qase.cucumber7.QaseEventListener", - "classpath:features/" + "classpath:features/", + "--threads", "2" }; Main.run(args, Thread.currentThread().getContextClassLoader()); @@ -155,8 +156,100 @@ void bulk() { " \"status\" : \"passed\",\n" + " \"action\" : \"Given success step\"\n" + " } ]\n" + + " }, {\n" + + " \"case\" : {\n" + + " \"title\" : \"success with Positive Examples\"\n" + + " },\n" + + " \"status\" : \"passed\",\n" + + " \"time_ms\" : \"${json-unit.ignore}\",\n" + + " \"defect\" : false,\n" + + " \"param\" : {\n" + + " \"a\" : \"\\\"1\\\"\",\n" + + " \"b\" : \"\\\"2\\\"\"\n" + + " },\n" + + " \"steps\" : [ {\n" + + " \"position\" : 1,\n" + + " \"status\" : \"passed\",\n" + + " \"action\" : \"Given success step with parameter \\\"1\\\"\"\n" + + " }, {\n" + + " \"position\" : 2,\n" + + " \"status\" : \"passed\",\n" + + " \"action\" : \"Given success step with parameter \\\"2\\\"\"\n" + + " } ]\n" + + " }, {\n" + + " \"case\" : {\n" + + " \"title\" : \"success with Positive Examples\"\n" + + " },\n" + + " \"status\" : \"passed\",\n" + + " \"time_ms\" : \"${json-unit.ignore}\",\n" + + " \"defect\" : false,\n" + + " \"param\" : {\n" + + " \"a\" : \"\\\"3\\\"\",\n" + + " \"b\" : \"\\\"4\\\"\"\n" + + " },\n" + + " \"steps\" : [ {\n" + + " \"position\" : 1,\n" + + " \"status\" : \"passed\",\n" + + " \"action\" : \"Given success step with parameter \\\"3\\\"\"\n" + + " }, {\n" + + " \"position\" : 2,\n" + + " \"status\" : \"passed\",\n" + + " \"action\" : \"Given success step with parameter \\\"4\\\"\"\n" + + " } ]\n" + + " }, {\n" + + " \"case\" : {\n" + + " \"title\" : \"success with Positive Examples\"\n" + + " },\n" + + " \"status\" : \"passed\",\n" + + " \"time_ms\" : \"${json-unit.ignore}\",\n" + + " \"defect\" : false,\n" + + " \"param\" : {\n" + + " \"a\" : \"\\\"5\\\"\",\n" + + " \"b\" : \"\\\"6\\\"\"\n" + + " },\n" + + " \"steps\" : [ {\n" + + " \"position\" : 1,\n" + + " \"status\" : \"passed\",\n" + + " \"action\" : \"Given success step with parameter \\\"5\\\"\"\n" + + " }, {\n" + + " \"position\" : 2,\n" + + " \"status\" : \"passed\",\n" + + " \"action\" : \"Given success step with parameter \\\"6\\\"\"\n" + + " } ]\n" + + " }, {\n" + + " \"case\" : {\n" + + " \"title\" : \"success with Positive Examples\"\n" + + " },\n" + + " \"status\" : \"passed\",\n" + + " \"time_ms\" : \"${json-unit.ignore}\",\n" + + " \"defect\" : false,\n" + + " \"param\" : {\n" + + " \"a\" : \"\\\"7\\\"\",\n" + + " \"b\" : \"\\\"8\\\"\"\n" + + " },\n" + + " \"steps\" : [ {\n" + + " \"position\" : 1,\n" + + " \"status\" : \"passed\",\n" + + " \"action\" : \"Given success step with parameter \\\"7\\\"\"\n" + + " }, {\n" + + " \"position\" : 2,\n" + + " \"status\" : \"passed\",\n" + + " \"action\" : \"Given success step with parameter \\\"8\\\"\"\n" + + " } ]\n" + + " }, {\n" + + " \"case\" : {\n" + + " \"title\" : \"Success scenario\"\n" + + " },\n" + + " \"status\" : \"passed\",\n" + + " \"time_ms\" : \"${json-unit.ignore}\",\n" + + " \"defect\" : false,\n" + + " \"steps\" : [ {\n" + + " \"position\" : 1,\n" + + " \"status\" : \"passed\",\n" + + " \"action\" : \"Given success step\"\n" + + " } ]\n" + " } ]\n" + - "}"))); + "}", true, false))); } @Test diff --git a/qase-cucumber7-jvm/src/test/java/io/qase/cucumber7/Steps.java b/qase-cucumber7-jvm/src/test/java/io/qase/cucumber7/Steps.java index b60c543b..598b8da3 100644 --- a/qase-cucumber7-jvm/src/test/java/io/qase/cucumber7/Steps.java +++ b/qase-cucumber7-jvm/src/test/java/io/qase/cucumber7/Steps.java @@ -10,6 +10,10 @@ public class Steps { public void success() { } + @Given("success step with parameter {string}") + public void success_step_with_parameter(String string) { + } + @Given("timeout {int} seconds") public void success(int integer) throws InterruptedException { TimeUnit.SECONDS.sleep(integer); diff --git a/qase-cucumber7-jvm/src/test/resources/features/with_examples.feature b/qase-cucumber7-jvm/src/test/resources/features/with_examples.feature new file mode 100644 index 00000000..44e7b688 --- /dev/null +++ b/qase-cucumber7-jvm/src/test/resources/features/with_examples.feature @@ -0,0 +1,15 @@ +Feature: New case with examples + + Scenario Outline: success with Positive Examples + Given success step with parameter + Given success step with parameter + + Examples: + | a | b | + | "1" | "2" | + | "3" | "4" | + | "5" | "6" | + | "7" | "8" | + + Scenario: Success scenario + Given success step \ No newline at end of file diff --git a/qase-junit4-aspect/pom.xml b/qase-junit4-aspect/pom.xml index 8f8fcfd0..1ee7dff7 100644 --- a/qase-junit4-aspect/pom.xml +++ b/qase-junit4-aspect/pom.xml @@ -6,7 +6,7 @@ io.qase qase-java - 3.1.1 + 3.2.0 qase-junit4-aspect diff --git a/qase-junit4/README.md b/qase-junit4/README.md index 6e3bfb91..9bb51c48 100644 --- a/qase-junit4/README.md +++ b/qase-junit4/README.md @@ -12,7 +12,7 @@ Add the following dependency and repository to your pom.xml: io.qase qase-junit4 - 3.1.1 + 3.2.0 test @@ -63,9 +63,9 @@ configurations { dependencies { aspectjweaver "org.aspectj:aspectjweaver:1.9.8" - testImplementation 'io.qase:qase-api:3.1.1' - testImplementation 'io.qase:qase-junit4:3.1.1' - testImplementation 'io.qase:qase-junit4-aspect:3.1.1' + testImplementation 'io.qase:qase-api:3.2.0' + testImplementation 'io.qase:qase-junit4:3.2.0' + testImplementation 'io.qase:qase-junit4-aspect:3.2.0' testImplementation 'junit:junit:4.13.2' } diff --git a/qase-junit4/pom.xml b/qase-junit4/pom.xml index 6c9ec320..e34d759e 100644 --- a/qase-junit4/pom.xml +++ b/qase-junit4/pom.xml @@ -5,7 +5,7 @@ qase-java io.qase - 3.1.1 + 3.2.0 4.0.0 diff --git a/qase-junit5/README.md b/qase-junit5/README.md index 6cc19052..21531b81 100644 --- a/qase-junit5/README.md +++ b/qase-junit5/README.md @@ -12,7 +12,7 @@ Add the following dependency and repository to your pom.xml: io.qase qase-junit5 - 3.1.1 + 3.2.0 @@ -55,7 +55,7 @@ add the below code to build.gradle: ``` dependencies { ... - testImplementation 'io.qase:qase-junit5:3.1.1' + testImplementation 'io.qase:qase-junit5:3.2.0' } test { diff --git a/qase-junit5/pom.xml b/qase-junit5/pom.xml index 00119d59..1a33b5b3 100644 --- a/qase-junit5/pom.xml +++ b/qase-junit5/pom.xml @@ -5,7 +5,7 @@ qase-java io.qase - 3.1.1 + 3.2.0 4.0.0 diff --git a/qase-testng/README.md b/qase-testng/README.md index 69ea7d81..ee4ac525 100644 --- a/qase-testng/README.md +++ b/qase-testng/README.md @@ -22,7 +22,7 @@ Add the following dependency to your pom.xml: io.qase qase-testng - 3.1.1 + 3.2.0 test @@ -67,7 +67,7 @@ configurations { dependencies { aspectjweaver "org.aspectj:aspectjweaver:1.9.8" - testImplementation 'io.qase:qase-testng:3.1.1' + testImplementation 'io.qase:qase-testng:3.2.0' testImplementation 'org.testng:testng:7.1.0' } diff --git a/qase-testng/pom.xml b/qase-testng/pom.xml index ba2053d9..6b6cb901 100644 --- a/qase-testng/pom.xml +++ b/qase-testng/pom.xml @@ -5,7 +5,7 @@ qase-java io.qase - 3.1.1 + 3.2.0 4.0.0 From a13afdbea28d8970d2d9a0657c3af2414413aec1 Mon Sep 17 00:00:00 2001 From: savkk Date: Wed, 8 Nov 2023 23:58:20 +0300 Subject: [PATCH 2/4] cucumber 5 parameterization support --- qase-cucumber5-jvm/pom.xml | 5 + .../io/qase/cucumber5/QaseEventListener.java | 64 +++++++++++-- .../cucumber5/QaseEventListenerTests.java | 92 +++++++++++++++++++ .../test/java/io/qase/cucumber5/Steps.java | 4 + .../resources/features/with_examples.feature | 15 +++ 5 files changed, 172 insertions(+), 8 deletions(-) create mode 100644 qase-cucumber5-jvm/src/test/resources/features/with_examples.feature diff --git a/qase-cucumber5-jvm/pom.xml b/qase-cucumber5-jvm/pom.xml index 2005df61..a6dbc107 100644 --- a/qase-cucumber5-jvm/pom.xml +++ b/qase-cucumber5-jvm/pom.xml @@ -34,6 +34,11 @@ cucumber-java ${cucumber5-java.version} + + io.cucumber + gherkin + 5.1.0 + org.projectlombok lombok diff --git a/qase-cucumber5-jvm/src/main/java/io/qase/cucumber5/QaseEventListener.java b/qase-cucumber5-jvm/src/main/java/io/qase/cucumber5/QaseEventListener.java index b262a425..63d153e5 100644 --- a/qase-cucumber5-jvm/src/main/java/io/qase/cucumber5/QaseEventListener.java +++ b/qase-cucumber5-jvm/src/main/java/io/qase/cucumber5/QaseEventListener.java @@ -1,5 +1,8 @@ package io.qase.cucumber5; +import gherkin.AstBuilder; +import gherkin.Parser; +import gherkin.ast.*; import io.cucumber.plugin.ConcurrentEventListener; import io.cucumber.plugin.event.*; import io.qase.api.QaseClient; @@ -15,17 +18,23 @@ import io.qase.cucumber5.guice.module.Cucumber5Module; import lombok.AccessLevel; import lombok.Getter; +import lombok.extern.slf4j.Slf4j; -import java.util.LinkedList; -import java.util.List; -import java.util.Optional; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.*; +import static io.qase.api.utils.CucumberUtils.getHash; import static io.qase.api.utils.IntegrationUtils.getStacktrace; +@Slf4j public class QaseEventListener implements ConcurrentEventListener { + private static final Map> EXAMPLES = new HashMap<>(); private static final String REPORTER_NAME = "Cucumber 5-JVM"; - @Getter(lazy = true, value = AccessLevel.PRIVATE) private final QaseTestCaseListener qaseTestCaseListener = createQaseListener(); @@ -44,12 +53,48 @@ public void setEventPublisher(EventPublisher publisher) { } } - private void testCaseStarted(TestStepStarted testStepStarted) { - if (testStepStarted.getTestStep() instanceof PickleStepTestStep) { + private void testCaseStarted(TestStepStarted event) { + if (EXAMPLES.get(getHash(event.getTestCase().getUri(), (long) event.getTestCase().getLine())) == null) { + TestCase testCase = event.getTestCase(); + URI uri = testCase.getUri(); + Parser gherkinParser = new Parser<>(new AstBuilder()); + try { + GherkinDocument gherkinDocument = gherkinParser.parse(new String(Files.readAllBytes(Paths.get(this.getClass().getClassLoader() + .getResource(uri.toString().replace("classpath:", "")).toURI())))); + parseExamples(uri, gherkinDocument); + } catch (URISyntaxException | IOException e) { + log.error(e.getMessage()); + } + } + if (event.getTestStep() instanceof PickleStepTestStep) { StepStorage.startStep(); } } + private void parseExamples(URI uri, GherkinDocument gherkinDocument) { + Feature feature = gherkinDocument.getFeature(); + List children = feature.getChildren(); + for (ScenarioDefinition child : children) { + if (child instanceof ScenarioOutline) { + ScenarioOutline scenario = (ScenarioOutline) child; + for (Examples exampleItem : scenario.getExamples()) { + List headers = new ArrayList<>(); + exampleItem.getTableHeader().getCells().forEach(h -> headers.add(h.getValue())); + List tableBody = exampleItem.getTableBody(); + for (TableRow tableRow : tableBody) { + List cells = tableRow.getCells(); + HashMap example = new HashMap<>(); + for (int k = 0; k < cells.size(); k++) { + String value = cells.get(k).getValue(); + example.put(headers.get(k), value); + } + EXAMPLES.put(getHash(uri, (long) tableRow.getLocation().getLine()), example); + } + } + } + } + } + private void testStepFinished(TestStepFinished testStepFinished) { if (testStepFinished.getTestStep() instanceof PickleStepTestStep) { PickleStepTestStep step = (PickleStepTestStep) testStepFinished.getTestStep(); @@ -96,12 +141,13 @@ private void testCaseFinished(TestCaseFinished event) { } private void setupResultItem(ResultCreate resultCreate, TestCaseFinished event) { - List tags = event.getTestCase().getTags(); + TestCase testCase = event.getTestCase(); + List tags = testCase.getTags(); Long caseId = CucumberUtils.getCaseId(tags); String caseTitle = null; if (caseId == null) { - caseTitle = event.getTestCase().getName(); + caseTitle = testCase.getName(); } StatusEnum status = convertStatus(event.getResult().getStatus()); @@ -122,6 +168,8 @@ private void setupResultItem(ResultCreate resultCreate, TestCaseFinished event) .stacktrace(stacktrace) .steps(steps.isEmpty() ? null : steps) .defect(isDefect); + Map params = EXAMPLES.get(getHash(testCase.getUri(), (long) testCase.getLine())); + resultCreate.param(params); } private StatusEnum convertStatus(Status status) { diff --git a/qase-cucumber5-jvm/src/test/java/io/qase/cucumber5/QaseEventListenerTests.java b/qase-cucumber5-jvm/src/test/java/io/qase/cucumber5/QaseEventListenerTests.java index d2830ce9..52cca5c4 100644 --- a/qase-cucumber5-jvm/src/test/java/io/qase/cucumber5/QaseEventListenerTests.java +++ b/qase-cucumber5-jvm/src/test/java/io/qase/cucumber5/QaseEventListenerTests.java @@ -154,6 +154,98 @@ void bulk() { " \"status\" : \"passed\",\n" + " \"action\" : \"Given success step\"\n" + " } ]\n" + + " }, {\n" + + " \"case\" : {\n" + + " \"title\" : \"success with Positive Examples\"\n" + + " },\n" + + " \"status\" : \"passed\",\n" + + " \"time_ms\" : \"${json-unit.ignore}\",\n" + + " \"defect\" : false,\n" + + " \"param\" : {\n" + + " \"a\" : \"\\\"1\\\"\",\n" + + " \"b\" : \"\\\"2\\\"\"\n" + + " },\n" + + " \"steps\" : [ {\n" + + " \"position\" : 1,\n" + + " \"status\" : \"passed\",\n" + + " \"action\" : \"Given success step with parameter \\\"1\\\"\"\n" + + " }, {\n" + + " \"position\" : 2,\n" + + " \"status\" : \"passed\",\n" + + " \"action\" : \"Given success step with parameter \\\"2\\\"\"\n" + + " } ]\n" + + " }, {\n" + + " \"case\" : {\n" + + " \"title\" : \"success with Positive Examples\"\n" + + " },\n" + + " \"status\" : \"passed\",\n" + + " \"time_ms\" : \"${json-unit.ignore}\",\n" + + " \"defect\" : false,\n" + + " \"param\" : {\n" + + " \"a\" : \"\\\"3\\\"\",\n" + + " \"b\" : \"\\\"4\\\"\"\n" + + " },\n" + + " \"steps\" : [ {\n" + + " \"position\" : 1,\n" + + " \"status\" : \"passed\",\n" + + " \"action\" : \"Given success step with parameter \\\"3\\\"\"\n" + + " }, {\n" + + " \"position\" : 2,\n" + + " \"status\" : \"passed\",\n" + + " \"action\" : \"Given success step with parameter \\\"4\\\"\"\n" + + " } ]\n" + + " }, {\n" + + " \"case\" : {\n" + + " \"title\" : \"success with Positive Examples\"\n" + + " },\n" + + " \"status\" : \"passed\",\n" + + " \"time_ms\" : \"${json-unit.ignore}\",\n" + + " \"defect\" : false,\n" + + " \"param\" : {\n" + + " \"a\" : \"\\\"5\\\"\",\n" + + " \"b\" : \"\\\"6\\\"\"\n" + + " },\n" + + " \"steps\" : [ {\n" + + " \"position\" : 1,\n" + + " \"status\" : \"passed\",\n" + + " \"action\" : \"Given success step with parameter \\\"5\\\"\"\n" + + " }, {\n" + + " \"position\" : 2,\n" + + " \"status\" : \"passed\",\n" + + " \"action\" : \"Given success step with parameter \\\"6\\\"\"\n" + + " } ]\n" + + " }, {\n" + + " \"case\" : {\n" + + " \"title\" : \"success with Positive Examples\"\n" + + " },\n" + + " \"status\" : \"passed\",\n" + + " \"time_ms\" : \"${json-unit.ignore}\",\n" + + " \"defect\" : false,\n" + + " \"param\" : {\n" + + " \"a\" : \"\\\"7\\\"\",\n" + + " \"b\" : \"\\\"8\\\"\"\n" + + " },\n" + + " \"steps\" : [ {\n" + + " \"position\" : 1,\n" + + " \"status\" : \"passed\",\n" + + " \"action\" : \"Given success step with parameter \\\"7\\\"\"\n" + + " }, {\n" + + " \"position\" : 2,\n" + + " \"status\" : \"passed\",\n" + + " \"action\" : \"Given success step with parameter \\\"8\\\"\"\n" + + " } ]\n" + + " }, {\n" + + " \"case\" : {\n" + + " \"title\" : \"Success scenario\"\n" + + " },\n" + + " \"status\" : \"passed\",\n" + + " \"time_ms\" : \"${json-unit.ignore}\",\n" + + " \"defect\" : false,\n" + + " \"steps\" : [ {\n" + + " \"position\" : 1,\n" + + " \"status\" : \"passed\",\n" + + " \"action\" : \"Given success step\"\n" + + " } ]\n" + " } ]\n" + "}"))); } diff --git a/qase-cucumber5-jvm/src/test/java/io/qase/cucumber5/Steps.java b/qase-cucumber5-jvm/src/test/java/io/qase/cucumber5/Steps.java index 37f5933d..679592ea 100644 --- a/qase-cucumber5-jvm/src/test/java/io/qase/cucumber5/Steps.java +++ b/qase-cucumber5-jvm/src/test/java/io/qase/cucumber5/Steps.java @@ -10,6 +10,10 @@ public class Steps { public void success() { } + @Given("success step with parameter {string}") + public void success_step_with_parameter(String string) { + } + @Given("timeout {int} seconds") public void success(int integer) throws InterruptedException { TimeUnit.SECONDS.sleep(integer); diff --git a/qase-cucumber5-jvm/src/test/resources/features/with_examples.feature b/qase-cucumber5-jvm/src/test/resources/features/with_examples.feature new file mode 100644 index 00000000..44e7b688 --- /dev/null +++ b/qase-cucumber5-jvm/src/test/resources/features/with_examples.feature @@ -0,0 +1,15 @@ +Feature: New case with examples + + Scenario Outline: success with Positive Examples + Given success step with parameter + Given success step with parameter + + Examples: + | a | b | + | "1" | "2" | + | "3" | "4" | + | "5" | "6" | + | "7" | "8" | + + Scenario: Success scenario + Given success step \ No newline at end of file From 5faba3ff1a976548a88b6b7e3d43d7e7702f764f Mon Sep 17 00:00:00 2001 From: savkk Date: Sun, 19 Nov 2023 01:30:59 +0300 Subject: [PATCH 3/4] cucumber 6 parameterization support --- .../cucumber5/QaseEventListenerTests.java | 5 +- qase-cucumber6-jvm/pom.xml | 5 + .../io/qase/cucumber6/QaseEventListener.java | 67 ++++++++++++- .../cucumber6/QaseEventListenerTests.java | 97 ++++++++++++++++++- .../test/java/io/qase/cucumber6/Steps.java | 4 + .../resources/features/with_examples.feature | 15 +++ .../cucumber7/QaseEventListenerTests.java | 2 +- 7 files changed, 185 insertions(+), 10 deletions(-) create mode 100644 qase-cucumber6-jvm/src/test/resources/features/with_examples.feature diff --git a/qase-cucumber5-jvm/src/test/java/io/qase/cucumber5/QaseEventListenerTests.java b/qase-cucumber5-jvm/src/test/java/io/qase/cucumber5/QaseEventListenerTests.java index 52cca5c4..28ba7f54 100644 --- a/qase-cucumber5-jvm/src/test/java/io/qase/cucumber5/QaseEventListenerTests.java +++ b/qase-cucumber5-jvm/src/test/java/io/qase/cucumber5/QaseEventListenerTests.java @@ -73,7 +73,8 @@ void bulk() { String[] args = new String[]{ "-g", "io.qase.cucumber5", "--add-plugin", "io.qase.cucumber5.QaseEventListener", - "classpath:features/" + "classpath:features/", + "--threads", "4" }; Main.run(args, Thread.currentThread().getContextClassLoader()); @@ -247,7 +248,7 @@ void bulk() { " \"action\" : \"Given success step\"\n" + " } ]\n" + " } ]\n" + - "}"))); + "}", true, false))); } @Test diff --git a/qase-cucumber6-jvm/pom.xml b/qase-cucumber6-jvm/pom.xml index 5711386d..d141eefb 100644 --- a/qase-cucumber6-jvm/pom.xml +++ b/qase-cucumber6-jvm/pom.xml @@ -34,6 +34,11 @@ cucumber-java ${cucumber6-java.version} + + io.cucumber + gherkin + 18.0.0 + org.projectlombok lombok diff --git a/qase-cucumber6-jvm/src/main/java/io/qase/cucumber6/QaseEventListener.java b/qase-cucumber6-jvm/src/main/java/io/qase/cucumber6/QaseEventListener.java index e9a933dd..9ce5f764 100644 --- a/qase-cucumber6-jvm/src/main/java/io/qase/cucumber6/QaseEventListener.java +++ b/qase-cucumber6-jvm/src/main/java/io/qase/cucumber6/QaseEventListener.java @@ -1,5 +1,8 @@ package io.qase.cucumber6; +import io.cucumber.gherkin.Gherkin; +import io.cucumber.messages.IdGenerator; +import io.cucumber.messages.Messages; import io.cucumber.plugin.ConcurrentEventListener; import io.cucumber.plugin.event.*; import io.qase.api.QaseClient; @@ -16,18 +19,22 @@ import lombok.AccessLevel; import lombok.Getter; -import java.util.LinkedList; -import java.util.List; -import java.util.Optional; +import java.net.URI; +import java.util.*; +import java.util.stream.Stream; +import static io.cucumber.gherkin.Gherkin.makeSourceEnvelope; +import static io.qase.api.utils.CucumberUtils.getHash; import static io.qase.api.utils.IntegrationUtils.getStacktrace; public class QaseEventListener implements ConcurrentEventListener { + private static final Map> EXAMPLES = new HashMap<>(); private static final String REPORTER_NAME = "Cucumber 6-JVM"; @Getter(lazy = true, value = AccessLevel.PRIVATE) private final QaseTestCaseListener qaseTestCaseListener = createQaseListener(); + private final Map sources = new HashMap<>(); static { System.setProperty(QaseConfig.QASE_CLIENT_REPORTER_NAME_KEY, REPORTER_NAME); @@ -36,6 +43,7 @@ public class QaseEventListener implements ConcurrentEventListener { @Override public void setEventPublisher(EventPublisher publisher) { if (QaseClient.isEnabled()) { + publisher.registerHandlerFor(TestSourceRead.class, this::testSourceRead); publisher.registerHandlerFor(TestCaseStarted.class, this::testCaseStarted); publisher.registerHandlerFor(TestCaseFinished.class, this::testCaseFinished); publisher.registerHandlerFor(TestRunFinished.class, this::testRunFinished); @@ -44,6 +52,10 @@ public void setEventPublisher(EventPublisher publisher) { } } + private void testSourceRead(TestSourceRead testSourceRead) { + sources.put(testSourceRead.getUri(), testSourceRead.getSource()); + } + private void testCaseStarted(TestStepStarted testStepStarted) { if (testStepStarted.getTestStep() instanceof PickleStepTestStep) { StepStorage.startStep(); @@ -88,20 +100,63 @@ private void testRunFinished(TestRunFinished testRunFinished) { } private void testCaseStarted(TestCaseStarted event) { + URI uri = event.getTestCase().getUri(); + if (EXAMPLES.get(getHash(uri, (long) event.getTestCase().getLine())) == null && sources.containsKey(uri)) { + + Messages.Envelope envelope = makeSourceEnvelope(this.sources.get(uri), uri.toString()); + + Stream envelopes = Gherkin.fromSources( + Collections.singletonList(envelope), + true, + true, + true, + new IdGenerator.UUID()); + + envelopes + .filter(Messages.Envelope::hasGherkinDocument) + .map(Messages.Envelope::getGherkinDocument) + .findFirst() + .ifPresent(gherkinDocument -> parseExamples(uri, gherkinDocument)); + } getQaseTestCaseListener().onTestCaseStarted(); } + private void parseExamples(URI uri, Messages.GherkinDocument gherkinDocument) { + Messages.GherkinDocument.Feature feature = gherkinDocument.getFeature(); + List childrenList = feature.getChildrenList(); + for (int i = 0; i < childrenList.size(); i++) { + List examplesList = childrenList.get(i).getScenario().getExamplesList(); + for (int j = 0; j < examplesList.size(); j++) { + List headers = new ArrayList<>(); + Messages.GherkinDocument.Feature.TableRow tableHeader = examplesList.get(j).getTableHeader(); + tableHeader.getCellsList().forEach(h -> headers.add(h.getValue())); + List tableBodyList = examplesList.get(j).getTableBodyList(); + for (int k = 0; k < tableBodyList.size(); k++) { + Messages.GherkinDocument.Feature.TableRow tableRow = tableBodyList.get(k); + List cellsList = tableRow.getCellsList(); + HashMap example = new HashMap<>(); + for (int l = 0; l < cellsList.size(); l++) { + String value = cellsList.get(l).getValue(); + example.put(headers.get(l), value); + } + EXAMPLES.put(getHash(uri, (long) tableRow.getLocation().getLine()), example); + } + } + } + } + private void testCaseFinished(TestCaseFinished event) { getQaseTestCaseListener().onTestCaseFinished(resultCreate -> setupResultItem(resultCreate, event)); } private void setupResultItem(ResultCreate resultCreate, TestCaseFinished event) { - List tags = event.getTestCase().getTags(); + TestCase testCase = event.getTestCase(); + List tags = testCase.getTags(); Long caseId = CucumberUtils.getCaseId(tags); String caseTitle = null; if (caseId == null) { - caseTitle = event.getTestCase().getName(); + caseTitle = testCase.getName(); } StatusEnum status = convertStatus(event.getResult().getStatus()); @@ -122,6 +177,8 @@ private void setupResultItem(ResultCreate resultCreate, TestCaseFinished event) .stacktrace(stacktrace) .steps(steps.isEmpty() ? null : steps) .defect(isDefect); + Map params = EXAMPLES.get(getHash(testCase.getUri(), (long) testCase.getLocation().getLine())); + resultCreate.param(params); } private StatusEnum convertStatus(Status status) { diff --git a/qase-cucumber6-jvm/src/test/java/io/qase/cucumber6/QaseEventListenerTests.java b/qase-cucumber6-jvm/src/test/java/io/qase/cucumber6/QaseEventListenerTests.java index e73c83b7..a6bf6df4 100644 --- a/qase-cucumber6-jvm/src/test/java/io/qase/cucumber6/QaseEventListenerTests.java +++ b/qase-cucumber6-jvm/src/test/java/io/qase/cucumber6/QaseEventListenerTests.java @@ -74,7 +74,8 @@ void bulk() { String[] args = new String[]{ "-g", "io.qase.cucumber6", "--plugin", "io.qase.cucumber6.QaseEventListener", - "classpath:features/" + "classpath:features/", + "--threads", "4" }; Main.run(args, Thread.currentThread().getContextClassLoader()); @@ -155,8 +156,100 @@ void bulk() { " \"status\" : \"passed\",\n" + " \"action\" : \"Given success step\"\n" + " } ]\n" + + " }, {\n" + + " \"case\" : {\n" + + " \"title\" : \"success with Positive Examples\"\n" + + " },\n" + + " \"status\" : \"passed\",\n" + + " \"time_ms\" : \"${json-unit.ignore}\",\n" + + " \"defect\" : false,\n" + + " \"param\" : {\n" + + " \"a\" : \"\\\"1\\\"\",\n" + + " \"b\" : \"\\\"2\\\"\"\n" + + " },\n" + + " \"steps\" : [ {\n" + + " \"position\" : 1,\n" + + " \"status\" : \"passed\",\n" + + " \"action\" : \"Given success step with parameter \\\"1\\\"\"\n" + + " }, {\n" + + " \"position\" : 2,\n" + + " \"status\" : \"passed\",\n" + + " \"action\" : \"Given success step with parameter \\\"2\\\"\"\n" + + " } ]\n" + + " }, {\n" + + " \"case\" : {\n" + + " \"title\" : \"success with Positive Examples\"\n" + + " },\n" + + " \"status\" : \"passed\",\n" + + " \"time_ms\" : \"${json-unit.ignore}\",\n" + + " \"defect\" : false,\n" + + " \"param\" : {\n" + + " \"a\" : \"\\\"3\\\"\",\n" + + " \"b\" : \"\\\"4\\\"\"\n" + + " },\n" + + " \"steps\" : [ {\n" + + " \"position\" : 1,\n" + + " \"status\" : \"passed\",\n" + + " \"action\" : \"Given success step with parameter \\\"3\\\"\"\n" + + " }, {\n" + + " \"position\" : 2,\n" + + " \"status\" : \"passed\",\n" + + " \"action\" : \"Given success step with parameter \\\"4\\\"\"\n" + + " } ]\n" + + " }, {\n" + + " \"case\" : {\n" + + " \"title\" : \"success with Positive Examples\"\n" + + " },\n" + + " \"status\" : \"passed\",\n" + + " \"time_ms\" : \"${json-unit.ignore}\",\n" + + " \"defect\" : false,\n" + + " \"param\" : {\n" + + " \"a\" : \"\\\"5\\\"\",\n" + + " \"b\" : \"\\\"6\\\"\"\n" + + " },\n" + + " \"steps\" : [ {\n" + + " \"position\" : 1,\n" + + " \"status\" : \"passed\",\n" + + " \"action\" : \"Given success step with parameter \\\"5\\\"\"\n" + + " }, {\n" + + " \"position\" : 2,\n" + + " \"status\" : \"passed\",\n" + + " \"action\" : \"Given success step with parameter \\\"6\\\"\"\n" + + " } ]\n" + + " }, {\n" + + " \"case\" : {\n" + + " \"title\" : \"success with Positive Examples\"\n" + + " },\n" + + " \"status\" : \"passed\",\n" + + " \"time_ms\" : \"${json-unit.ignore}\",\n" + + " \"defect\" : false,\n" + + " \"param\" : {\n" + + " \"a\" : \"\\\"7\\\"\",\n" + + " \"b\" : \"\\\"8\\\"\"\n" + + " },\n" + + " \"steps\" : [ {\n" + + " \"position\" : 1,\n" + + " \"status\" : \"passed\",\n" + + " \"action\" : \"Given success step with parameter \\\"7\\\"\"\n" + + " }, {\n" + + " \"position\" : 2,\n" + + " \"status\" : \"passed\",\n" + + " \"action\" : \"Given success step with parameter \\\"8\\\"\"\n" + + " } ]\n" + + " }, {\n" + + " \"case\" : {\n" + + " \"title\" : \"Success scenario\"\n" + + " },\n" + + " \"status\" : \"passed\",\n" + + " \"time_ms\" : \"${json-unit.ignore}\",\n" + + " \"defect\" : false,\n" + + " \"steps\" : [ {\n" + + " \"position\" : 1,\n" + + " \"status\" : \"passed\",\n" + + " \"action\" : \"Given success step\"\n" + + " } ]\n" + " } ]\n" + - "}"))); + "}", true, false))); } @Test diff --git a/qase-cucumber6-jvm/src/test/java/io/qase/cucumber6/Steps.java b/qase-cucumber6-jvm/src/test/java/io/qase/cucumber6/Steps.java index 668e45e5..6615252b 100644 --- a/qase-cucumber6-jvm/src/test/java/io/qase/cucumber6/Steps.java +++ b/qase-cucumber6-jvm/src/test/java/io/qase/cucumber6/Steps.java @@ -10,6 +10,10 @@ public class Steps { public void success() { } + @Given("success step with parameter {string}") + public void success_step_with_parameter(String string) { + } + @Given("timeout {int} seconds") public void success(int integer) throws InterruptedException { TimeUnit.SECONDS.sleep(integer); diff --git a/qase-cucumber6-jvm/src/test/resources/features/with_examples.feature b/qase-cucumber6-jvm/src/test/resources/features/with_examples.feature new file mode 100644 index 00000000..44e7b688 --- /dev/null +++ b/qase-cucumber6-jvm/src/test/resources/features/with_examples.feature @@ -0,0 +1,15 @@ +Feature: New case with examples + + Scenario Outline: success with Positive Examples + Given success step with parameter + Given success step with parameter + + Examples: + | a | b | + | "1" | "2" | + | "3" | "4" | + | "5" | "6" | + | "7" | "8" | + + Scenario: Success scenario + Given success step \ No newline at end of file diff --git a/qase-cucumber7-jvm/src/test/java/io/qase/cucumber7/QaseEventListenerTests.java b/qase-cucumber7-jvm/src/test/java/io/qase/cucumber7/QaseEventListenerTests.java index 0e6d87eb..ef03eba8 100644 --- a/qase-cucumber7-jvm/src/test/java/io/qase/cucumber7/QaseEventListenerTests.java +++ b/qase-cucumber7-jvm/src/test/java/io/qase/cucumber7/QaseEventListenerTests.java @@ -75,7 +75,7 @@ void bulk() { "-g", "io.qase.cucumber7", "--plugin", "io.qase.cucumber7.QaseEventListener", "classpath:features/", - "--threads", "2" + "--threads", "4" }; Main.run(args, Thread.currentThread().getContextClassLoader()); From 8e1f0aa106017f44e2eaa05c27ff2ba28f8e2dcd Mon Sep 17 00:00:00 2001 From: savkk Date: Mon, 27 Nov 2023 00:41:39 +0300 Subject: [PATCH 4/4] replace IllegalStateException to logging --- qase-api/src/main/java/io/qase/api/QaseClient.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/qase-api/src/main/java/io/qase/api/QaseClient.java b/qase-api/src/main/java/io/qase/api/QaseClient.java index 8e3c3a8f..f9bc827c 100644 --- a/qase-api/src/main/java/io/qase/api/QaseClient.java +++ b/qase-api/src/main/java/io/qase/api/QaseClient.java @@ -48,13 +48,14 @@ private static ApiClient initApiClient() { .description(getConfig().runDescription()) .isAutotest(true)) .getResult().getId(); + getConfig().setProperty(RUN_ID_KEY, String.valueOf(id)); + logger.info("Qase run id - {}", getConfig().runId()); } catch (QaseException e) { - throw new IllegalStateException(e); + isEnabled = false; + logger.error(e.getMessage()); } - getConfig().setProperty(RUN_ID_KEY, String.valueOf(id)); } } - logger.info("Qase run id - {}", getConfig().runId()); return client; }