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
1 change: 0 additions & 1 deletion allure-cucumber-jvm/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ dependencies {
implementation("info.cukes:cucumber-java:$cucumberVersion")
implementation("info.cukes:gherkin:2.12.2")
testImplementation("commons-io:commons-io")
testImplementation("info.cukes:cucumber-testng:$cucumberVersion")
testImplementation("io.github.glytching:junit-extensions")
testImplementation("org.assertj:assertj-core")
testImplementation("org.junit.jupiter:junit-jupiter-api")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package io.qameta.allure.cucumberjvm;

import cucumber.api.testng.FeatureResultListener;
import cucumber.runtime.ClassFinder;
import cucumber.runtime.Runtime;
import cucumber.runtime.RuntimeOptions;
Expand Down Expand Up @@ -423,17 +422,12 @@ private AllureResults runFeature(final String featureResource,
final Runtime runtime = new Runtime(resourceLoader, classFinder, classLoader, options);

options.addPlugin(cucumberJvm);

final FeatureResultListener resultListener = new FeatureResultListener(
options.reporter(classLoader),
options.isStrict()
);
final List<CucumberFeature> features = options.cucumberFeatures(resourceLoader);
features.forEach(cucumberFeature -> cucumberFeature.run(
options.formatter(classLoader),
resultListener,
runtime)
);
options.reporter(classLoader),
runtime
));
return writer;
}
}
1 change: 0 additions & 1 deletion allure-cucumber4-jvm/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ dependencies {
implementation("io.cucumber:cucumber-core:$cucumberVersion")
implementation("io.cucumber:cucumber-java:$cucumberVersion")
testImplementation("commons-io:commons-io")
testImplementation("io.cucumber:cucumber-testng:$cucumberVersion")
testImplementation("io.github.glytching:junit-extensions")
testImplementation("org.assertj:assertj-core")
testImplementation("org.junit.jupiter:junit-jupiter-api")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,12 @@ void shouldSetStatusDetails() {
assertThat(testResults)
.extracting(TestResult::getStatusDetails)
.extracting(StatusDetails::getMessage)
.containsExactlyInAnyOrder("expected [123] but found [15]");
.containsExactlyInAnyOrder("\n"
+ "Expecting:\n"
+ " <15>\n"
+ "to be equal to:\n"
+ " <123>\n"
+ "but was not.");
}

@AllureFeatures.BrokenTests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import io.cucumber.java.After;
import io.cucumber.java.Before;
import org.testng.Assert;
import org.assertj.core.api.Assertions;

/**
* @author letsrokk (Dmitry Mayer).
Expand All @@ -36,12 +36,12 @@ public void afterHook(){

@Before("@BeforeHookWithException")
public void beforeHookWithException(){
Assert.fail("Exception in Hook step");
Assertions.fail("Exception in Hook step");
}

@After("@AfterHookWithException")
public void afterHookWithException(){
Assert.fail("Exception in Hook step");
Assertions.fail("Exception in Hook step");
}

@Before("@bp")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import org.testng.Assert;
import org.assertj.core.api.Assertions;

/**
* @author charlie (Dmitry Baev).
Expand Down Expand Up @@ -46,7 +46,8 @@ public void i_add_a_to_b() {

@Then("^result is (\\d+)$")
public void result_is(int arg1) {
Assert.assertEquals(this.c, arg1);
Assertions.assertThat(this.c)
.isEqualTo(arg1);
}

}
1 change: 0 additions & 1 deletion allure-cucumber5-jvm/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ dependencies {
testImplementation("io.cucumber:gherkin:$cucumberGherkinVersion")
testImplementation("io.cucumber:cucumber-core:$cucumberVersion")
testImplementation("io.cucumber:cucumber-java:$cucumberVersion")
testImplementation("io.cucumber:cucumber-testng:$cucumberVersion")
testImplementation("commons-io:commons-io")
testImplementation("io.github.glytching:junit-extensions")
testImplementation("org.assertj:assertj-core")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,12 @@ void shouldSetStatusDetails() {
assertThat(testResults)
.extracting(TestResult::getStatusDetails)
.extracting(StatusDetails::getMessage)
.containsExactlyInAnyOrder("expected [123] but found [15]");
.containsExactlyInAnyOrder("\n"
+ "Expecting:\n"
+ " <15>\n"
+ "to be equal to:\n"
+ " <123>\n"
+ "but was not.");
}

@AllureFeatures.BrokenTests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import io.cucumber.java.After;
import io.cucumber.java.Before;
import org.testng.Assert;
import org.assertj.core.api.Assertions;

/**
* @author letsrokk (Dmitry Mayer).
Expand All @@ -36,12 +36,12 @@ public void afterHook(){

@Before("@BeforeHookWithException")
public void beforeHookWithException(){
Assert.fail("Exception in Hook step");
Assertions.fail("Exception in Hook step");
}

@After("@AfterHookWithException")
public void afterHookWithException(){
Assert.fail("Exception in Hook step");
Assertions.fail("Exception in Hook step");
}

@Before("@bp")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import org.testng.Assert;
import org.assertj.core.api.Assertions;

/**
* @author charlie (Dmitry Baev).
Expand Down Expand Up @@ -46,7 +46,8 @@ public void i_add_a_to_b() {

@Then("^result is (\\d+)$")
public void result_is(int arg1) {
Assert.assertEquals(this.c, arg1);
Assertions.assertThat(this.c)
.isEqualTo(arg1);
}

}
5 changes: 2 additions & 3 deletions allure-cucumber6-jvm/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ description = "Allure CucumberJVM 6.0"

val agent: Configuration by configurations.creating

val cucumberVersion = "6.9.0"
val cucumberGherkinVersion = "15.0.2"
val cucumberVersion = "6.10.2"
val cucumberGherkinVersion = "18.0.0"

dependencies {
agent("org.aspectj:aspectjweaver")
Expand All @@ -13,7 +13,6 @@ dependencies {
testImplementation("io.cucumber:gherkin:$cucumberGherkinVersion")
testImplementation("io.cucumber:cucumber-core:$cucumberVersion")
testImplementation("io.cucumber:cucumber-java:$cucumberVersion")
testImplementation("io.cucumber:cucumber-testng:$cucumberVersion")
testImplementation("commons-io:commons-io")
testImplementation("io.github.glytching:junit-extensions")
testImplementation("org.assertj:assertj-core")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ private void handleTestCaseStarted(final TestCaseStarted event) {
.setLinks(labelBuilder.getScenarioLinks());

final Scenario scenarioDefinition =
testSources.getScenarioDefinition(currentFeatureFile.get(), currentTestCase.get().getLine());
testSources.getScenarioDefinition(
currentFeatureFile.get(),
currentTestCase.get().getLocation().getLine()
);

if (scenarioDefinition.getExamplesCount() > 0) {
result.setParameters(
Expand Down Expand Up @@ -278,7 +281,7 @@ private String getHookStepUuid(final HookTestStep step) {
private String getHistoryId(final TestCase testCase) {
final String testCaseLocation = testCase.getUri().toString()
.substring(testCase.getUri().toString().lastIndexOf('/') + 1)
+ ":" + testCase.getLine();
+ ":" + testCase.getLocation().getLine();
return md5(testCaseLocation);
}

Expand All @@ -302,24 +305,37 @@ private Status translateTestCaseStatus(final Result testCaseResult) {
private List<Parameter> getExamplesAsParameters(
final Scenario scenario, final TestCase localCurrentTestCase
) {
final Optional<Examples> examplesBlock =
final Optional<Examples> maybeExample =
scenario.getExamplesList().stream()
.filter(example -> example.getTableBodyList().stream()
.anyMatch(row -> row.getLocation().getLine() == localCurrentTestCase.getLine())
).findFirst();

if (examplesBlock.isPresent()) {
final TableRow row = examplesBlock.get().getTableBodyList().stream()
.filter(example -> example.getLocation().getLine() == localCurrentTestCase.getLine())
.findFirst().get();
return IntStream.range(0, examplesBlock.get().getTableHeader().getCellsList().size()).mapToObj(index -> {
final String name = examplesBlock.get().getTableHeader().getCellsList().get(index).getValue();
final String value = row.getCellsList().get(index).getValue();
return createParameter(name, value);
}).collect(Collectors.toList());
} else {
.anyMatch(row -> row.getLocation().getLine()
== localCurrentTestCase.getLocation().getLine())
)
.findFirst();

if (!maybeExample.isPresent()) {
return Collections.emptyList();
}

final Examples examples = maybeExample.get();

final Optional<TableRow> maybeRow = examples.getTableBodyList().stream()
.filter(example -> example.getLocation().getLine() == localCurrentTestCase.getLocation().getLine())
.findFirst();

if (!maybeRow.isPresent()) {
return Collections.emptyList();
}

final TableRow row = maybeRow.get();

return IntStream.range(0, examples.getTableHeader().getCellsList().size())
.mapToObj(index -> {
final String name = examples.getTableHeader().getCellsList().get(index).getValue();
final String value = row.getCellsList().get(index).getValue();
return createParameter(name, value);
})
.collect(Collectors.toList());
}

private void createDataTableAttachment(final DataTableArgument dataTableArgument) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,12 @@ void shouldSetStatusDetails() {
assertThat(testResults)
.extracting(TestResult::getStatusDetails)
.extracting(StatusDetails::getMessage)
.containsExactlyInAnyOrder("expected [123] but found [15]");
.containsExactlyInAnyOrder("\n"
+ "Expecting:\n"
+ " <15>\n"
+ "to be equal to:\n"
+ " <123>\n"
+ "but was not.");
}

@AllureFeatures.BrokenTests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import io.cucumber.java.After;
import io.cucumber.java.Before;
import org.testng.Assert;
import org.assertj.core.api.Assertions;

/**
* @author letsrokk (Dmitry Mayer).
Expand All @@ -36,12 +36,12 @@ public void afterHook(){

@Before("@BeforeHookWithException")
public void beforeHookWithException(){
Assert.fail("Exception in Hook step");
Assertions.fail("Exception in Hook step");
}

@After("@AfterHookWithException")
public void afterHookWithException(){
Assert.fail("Exception in Hook step");
Assertions.fail("Exception in Hook step");
}

@Before("@bp")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import org.testng.Assert;
import org.assertj.core.api.Assertions;

/**
* @author charlie (Dmitry Baev).
Expand Down Expand Up @@ -46,7 +46,8 @@ public void i_add_a_to_b() {

@Then("^result is (\\d+)$")
public void result_is(int arg1) {
Assert.assertEquals(this.c, arg1);
Assertions.assertThat(this.c)
.isEqualTo(arg1);
}

}