diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 000000000..dd84ea782
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,38 @@
+---
+name: Bug report
+about: Create a report to help us improve
+title: ''
+labels: ''
+assignees: ''
+
+---
+
+**Describe the bug**
+A clear and concise description of what the bug is.
+
+**To Reproduce**
+Steps to reproduce the behavior:
+1. Go to '...'
+2. Click on '....'
+3. Scroll down to '....'
+4. See error
+
+**Expected behavior**
+A clear and concise description of what you expected to happen.
+
+**Screenshots**
+If applicable, add screenshots to help explain your problem.
+
+**Desktop (please complete the following information):**
+ - OS: [e.g. iOS]
+ - Browser [e.g. chrome, safari]
+ - Version [e.g. 22]
+
+**Smartphone (please complete the following information):**
+ - Device: [e.g. iPhone6]
+ - OS: [e.g. iOS8.1]
+ - Browser [e.g. stock browser, safari]
+ - Version [e.g. 22]
+
+**Additional context**
+Add any other context about the problem here.
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100644
index 000000000..bbcbbe7d6
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,20 @@
+---
+name: Feature request
+about: Suggest an idea for this project
+title: ''
+labels: ''
+assignees: ''
+
+---
+
+**Is your feature request related to a problem? Please describe.**
+A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
+
+**Describe the solution you'd like**
+A clear and concise description of what you want to happen.
+
+**Describe alternatives you've considered**
+A clear and concise description of any alternative solutions or features you've considered.
+
+**Additional context**
+Add any other context or screenshots about the feature request here.
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 000000000..240d09840
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,15 @@
+version: 2
+updates:
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "daily"
+ labels:
+ - "type:dependencies"
+
+ - package-ecosystem: "gradle"
+ directory: "/"
+ schedule:
+ interval: "daily"
+ labels:
+ - "type:dependencies"
diff --git a/.github/labeler.yml b/.github/labeler.yml
new file mode 100644
index 000000000..ca8c814d0
--- /dev/null
+++ b/.github/labeler.yml
@@ -0,0 +1,82 @@
+"theme:workflow":
+ - ".github/**"
+
+"theme:build":
+ - "gradle/**"
+ - "build.gradle.kts"
+ - "**/build.gradle.kts"
+ - "gradle.properties"
+ - ".gitignore"
+
+"theme:assertj":
+ - "allure-assertj/**"
+
+"theme:attachments":
+ - "allure-attachments/**"
+
+"theme:citrus":
+ - "allure-citrus/**"
+
+"theme:cucumber-jvm":
+ - "allure-cucumber*-jvm/**"
+
+"theme:descriptions-javadoc":
+ - "allure-descriptions-javadoc/**"
+
+"theme:httpclient":
+ - "allure-httpclient/**"
+
+"theme:model":
+ - "allure-model/**"
+
+"theme:core":
+ - "allure-java-commons/**"
+ - "allure-java-commons-test/**"
+ - "allure-test-filter/**"
+
+"theme:jax-rs":
+ - "allure-jax-rs/**"
+
+"theme:jbehave":
+ - "allure-jbehave/**"
+
+"theme:jsonunit":
+ - "allure-jsonunit/**"
+
+"theme:junit4":
+ - "allure-junit4/**"
+ - "allure-junit4-aspect/**"
+
+"theme:junit-platform":
+ - "allure-junit5/**"
+ - "allure-junit5-assert/**"
+ - "allure-junit-platform/**"
+
+"theme:karate":
+ - "allure-karate/**"
+
+"theme:okhttp":
+ - "allure-okhttp/**"
+ - "allure-okhttp3/**"
+
+"theme:rest-assured":
+ - "allure-rest-assured/**"
+
+"theme:scalatest":
+ - "allure-scalatest/**"
+
+"theme:selenide":
+ - "allure-selenide/**"
+
+"theme:servlet-api":
+ - "allure-servlet-api/**"
+
+"theme:spock":
+ - "allure-spock/**"
+
+"theme:spring":
+ - "allure-spring-web/**"
+
+"theme:testng":
+ - "allure-testng/**"
+
diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml
index a2939dd11..c17d77dbe 100644
--- a/.github/release-drafter.yml
+++ b/.github/release-drafter.yml
@@ -6,15 +6,20 @@ categories:
- 'type:new feature'
- title: '🔬 Improvements'
labels:
- - 'type:enhancement'
+ - 'type:improvement'
- title: '🐞 Bug Fixes'
labels:
- 'type:bug'
+ - title: '⬆️ Dependency Updates'
+ labels:
+ - 'type:dependencies'
change-template: '* $TITLE (via #$NUMBER) - @$AUTHOR'
+exclude-labels:
+ - 'type:internal'
template: |
$CHANGES
## 👀 Links
- [Commits since $PREVIOUS_TAG](https://github.com/allure-framework/allure2/compare/$PREVIOUS_TAG...master)
+ [Commits since $PREVIOUS_TAG](https://github.com/allure-framework/allure-java/compare/$PREVIOUS_TAG...master)
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 10b3c0bb3..f1870eb9f 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -8,13 +8,14 @@ on:
push:
branches:
- 'master'
+ - 'hotfix-*'
jobs:
build_8:
name: "Build JDK 1.8"
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v2.3.4
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
@@ -25,7 +26,7 @@ jobs:
name: "Build JDK 11"
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v2.3.4
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml
new file mode 100644
index 000000000..956bf2f95
--- /dev/null
+++ b/.github/workflows/labeler.yml
@@ -0,0 +1,12 @@
+name: "Set theme labels"
+
+on:
+ - pull_request_target
+
+jobs:
+ triage:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/labeler@v3
+ with:
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/labels-verify.yml b/.github/workflows/labels-verify.yml
index faf8586e1..2c3bd2a1f 100644
--- a/.github/workflows/labels-verify.yml
+++ b/.github/workflows/labels-verify.yml
@@ -8,6 +8,6 @@ jobs:
triage:
runs-on: ubuntu-latest
steps:
- - uses: zwaldowski/match-label-action@v2
+ - uses: baev/match-label-action@master
with:
- allowed: 'type:bug, type:enhancement, type:new feature'
\ No newline at end of file
+ allowed: 'type:bug,type:new feature,type:improvement,type:dependencies,type:internal,type:invalid'
diff --git a/.github/workflows/release-draft.yml b/.github/workflows/release-draft.yml
index 363a31018..caef7cf56 100644
--- a/.github/workflows/release-draft.yml
+++ b/.github/workflows/release-draft.yml
@@ -9,6 +9,6 @@ jobs:
update_draft_release:
runs-on: ubuntu-latest
steps:
- - uses: toolmantim/release-drafter@v5.2.0
+ - uses: toolmantim/release-drafter@v5.15.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 074cd577c..1df69505c 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -8,7 +8,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v2.3.4
- name: Set up JDK
uses: actions/setup-java@v1
with:
diff --git a/.gitignore b/.gitignore
index fe90411d6..b85107a90 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,7 +7,9 @@ out
.gradletasknamecache
#IDEA Files
-.idea
+.idea/*
+!.idea/vcs.xml
+!.idea/icon.png
*.iml
*.ipr
@@ -21,4 +23,4 @@ out
.DS_Store
#Netbeans files
-/.nb-gradle/
\ No newline at end of file
+/.nb-gradle/
diff --git a/.idea/icon.png b/.idea/icon.png
new file mode 100644
index 000000000..621c0930b
Binary files /dev/null and b/.idea/icon.png differ
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 000000000..aeaa9e459
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
diff --git a/LICENSE b/LICENSE
index a5ff24fc6..e078585bf 100644
--- a/LICENSE
+++ b/LICENSE
@@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
- Copyright 2019 Qameta Software OÜ
+ Copyright 2021 Qameta Software OÜ
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -198,4 +198,4 @@
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.
\ No newline at end of file
+ limitations under the License.
diff --git a/README.md b/README.md
index e96e77409..fa8419abf 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,9 @@
[CONTRIBUTING.md]: .github/CONTRIBUTING.md
[docs]: https://docs.qameta.io/allure/2.0/
-# Allure Java Integrations [![bintray-badge][]][bintray]
+# Allure Java Integrations
+
+[](https://github.com/allure-framework/allure-java/actions/workflows/build.yaml) [![bintray-badge][]][bintray]
The repository contains new versions of adaptors for JVM-based test frameworks.
diff --git a/allure-assertj/src/main/java/io/qameta/allure/assertj/AllureAspectJ.java b/allure-assertj/src/main/java/io/qameta/allure/assertj/AllureAspectJ.java
index e54ca815e..4ecea1dd8 100644
--- a/allure-assertj/src/main/java/io/qameta/allure/assertj/AllureAspectJ.java
+++ b/allure-assertj/src/main/java/io/qameta/allure/assertj/AllureAspectJ.java
@@ -60,6 +60,11 @@ public void anyAssertCreation() {
//pointcut body, should be empty
}
+ @Pointcut("execution(public * org.assertj.core.api.AssertionsForClassTypes.*(..))")
+ public void anyAssertCreation2() {
+ //pointcut body, should be empty
+ }
+
@Pointcut("execution(* org.assertj.core.api.AssertJProxySetup.*(..))")
public void proxyMethod() {
//pointcut body, should be empty
@@ -70,7 +75,7 @@ public void anyAssert() {
//pointcut body, should be empty
}
- @After("anyAssertCreation()")
+ @After("anyAssertCreation() || anyAssertCreation2()")
public void logAssertCreation(final JoinPoint joinPoint) {
final String actual = joinPoint.getArgs().length > 0
? ObjectUtils.toString(joinPoint.getArgs()[0])
diff --git a/allure-cucumber-jvm/build.gradle.kts b/allure-cucumber-jvm/build.gradle.kts
index 20d2608ac..3bde4ddfc 100644
--- a/allure-cucumber-jvm/build.gradle.kts
+++ b/allure-cucumber-jvm/build.gradle.kts
@@ -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")
diff --git a/allure-cucumber-jvm/src/test/java/io/qameta/allure/cucumberjvm/AllureCucumberJvmTest.java b/allure-cucumber-jvm/src/test/java/io/qameta/allure/cucumberjvm/AllureCucumberJvmTest.java
index 5b63d63ba..ea5db2632 100644
--- a/allure-cucumber-jvm/src/test/java/io/qameta/allure/cucumberjvm/AllureCucumberJvmTest.java
+++ b/allure-cucumber-jvm/src/test/java/io/qameta/allure/cucumberjvm/AllureCucumberJvmTest.java
@@ -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;
@@ -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 features = options.cucumberFeatures(resourceLoader);
features.forEach(cucumberFeature -> cucumberFeature.run(
options.formatter(classLoader),
- resultListener,
- runtime)
- );
+ options.reporter(classLoader),
+ runtime
+ ));
return writer;
}
}
diff --git a/allure-cucumber4-jvm/build.gradle.kts b/allure-cucumber4-jvm/build.gradle.kts
index e445dcec8..28e68c347 100644
--- a/allure-cucumber4-jvm/build.gradle.kts
+++ b/allure-cucumber4-jvm/build.gradle.kts
@@ -10,12 +10,12 @@ 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")
testImplementation("org.slf4j:slf4j-simple")
testImplementation(project(":allure-java-commons-test"))
+ testImplementation(project(":allure-junit-platform"))
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
}
diff --git a/allure-cucumber4-jvm/src/test/java/io/qameta/allure/cucumber4jvm/AllureCucumber4JvmTest.java b/allure-cucumber4-jvm/src/test/java/io/qameta/allure/cucumber4jvm/AllureCucumber4JvmTest.java
index a24160f02..4ddbb50eb 100644
--- a/allure-cucumber4-jvm/src/test/java/io/qameta/allure/cucumber4jvm/AllureCucumber4JvmTest.java
+++ b/allure-cucumber4-jvm/src/test/java/io/qameta/allure/cucumber4jvm/AllureCucumber4JvmTest.java
@@ -123,7 +123,7 @@ void shouldSetStatusDetails() {
assertThat(testResults)
.extracting(TestResult::getStatusDetails)
.extracting(StatusDetails::getMessage)
- .containsExactlyInAnyOrder("expected [123] but found [15]");
+ .containsExactlyInAnyOrder("expecting 15 to be equal to 123");
}
@AllureFeatures.BrokenTests
diff --git a/allure-cucumber4-jvm/src/test/java/io/qameta/allure/cucumber4jvm/samples/HookSteps.java b/allure-cucumber4-jvm/src/test/java/io/qameta/allure/cucumber4jvm/samples/HookSteps.java
index 3a2f55c93..ee2d6a5b6 100644
--- a/allure-cucumber4-jvm/src/test/java/io/qameta/allure/cucumber4jvm/samples/HookSteps.java
+++ b/allure-cucumber4-jvm/src/test/java/io/qameta/allure/cucumber4jvm/samples/HookSteps.java
@@ -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).
@@ -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")
diff --git a/allure-cucumber4-jvm/src/test/java/io/qameta/allure/cucumber4jvm/samples/SimpleFeatureSteps.java b/allure-cucumber4-jvm/src/test/java/io/qameta/allure/cucumber4jvm/samples/SimpleFeatureSteps.java
index 7325cc855..44e64a45f 100644
--- a/allure-cucumber4-jvm/src/test/java/io/qameta/allure/cucumber4jvm/samples/SimpleFeatureSteps.java
+++ b/allure-cucumber4-jvm/src/test/java/io/qameta/allure/cucumber4jvm/samples/SimpleFeatureSteps.java
@@ -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).
@@ -46,7 +46,10 @@ public void i_add_a_to_b() {
@Then("^result is (\\d+)$")
public void result_is(int arg1) {
- Assert.assertEquals(this.c, arg1);
+ // use manual fail for more stable message format
+ if (this.c != arg1) {
+ Assertions.fail("expecting %d to be equal to %d", this.c, arg1);
+ }
}
}
diff --git a/allure-cucumber5-jvm/build.gradle.kts b/allure-cucumber5-jvm/build.gradle.kts
index c74c9a200..3899bbf31 100644
--- a/allure-cucumber5-jvm/build.gradle.kts
+++ b/allure-cucumber5-jvm/build.gradle.kts
@@ -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")
diff --git a/allure-cucumber5-jvm/src/test/java/io/qameta/allure/cucumber5jvm/AllureCucumber5JvmTest.java b/allure-cucumber5-jvm/src/test/java/io/qameta/allure/cucumber5jvm/AllureCucumber5JvmTest.java
index 15509de7e..afd6c9567 100644
--- a/allure-cucumber5-jvm/src/test/java/io/qameta/allure/cucumber5jvm/AllureCucumber5JvmTest.java
+++ b/allure-cucumber5-jvm/src/test/java/io/qameta/allure/cucumber5jvm/AllureCucumber5JvmTest.java
@@ -108,7 +108,7 @@ void shouldSetStatusDetails() {
assertThat(testResults)
.extracting(TestResult::getStatusDetails)
.extracting(StatusDetails::getMessage)
- .containsExactlyInAnyOrder("expected [123] but found [15]");
+ .containsExactlyInAnyOrder("expecting 15 to be equal to 123");
}
@AllureFeatures.BrokenTests
diff --git a/allure-cucumber5-jvm/src/test/java/io/qameta/allure/cucumber5jvm/samples/HookSteps.java b/allure-cucumber5-jvm/src/test/java/io/qameta/allure/cucumber5jvm/samples/HookSteps.java
index ece9f875b..00f96ebc3 100644
--- a/allure-cucumber5-jvm/src/test/java/io/qameta/allure/cucumber5jvm/samples/HookSteps.java
+++ b/allure-cucumber5-jvm/src/test/java/io/qameta/allure/cucumber5jvm/samples/HookSteps.java
@@ -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).
@@ -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")
diff --git a/allure-cucumber5-jvm/src/test/java/io/qameta/allure/cucumber5jvm/samples/SimpleFeatureSteps.java b/allure-cucumber5-jvm/src/test/java/io/qameta/allure/cucumber5jvm/samples/SimpleFeatureSteps.java
index a81c7a212..3c7c2fd0a 100644
--- a/allure-cucumber5-jvm/src/test/java/io/qameta/allure/cucumber5jvm/samples/SimpleFeatureSteps.java
+++ b/allure-cucumber5-jvm/src/test/java/io/qameta/allure/cucumber5jvm/samples/SimpleFeatureSteps.java
@@ -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).
@@ -46,7 +46,10 @@ public void i_add_a_to_b() {
@Then("^result is (\\d+)$")
public void result_is(int arg1) {
- Assert.assertEquals(this.c, arg1);
+ // use manual fail for more stable message format
+ if (this.c != arg1) {
+ Assertions.fail("expecting %d to be equal to %d", this.c, arg1);
+ }
}
}
diff --git a/allure-cucumber6-jvm/build.gradle.kts b/allure-cucumber6-jvm/build.gradle.kts
index d355fdf04..c2553e5c7 100644
--- a/allure-cucumber6-jvm/build.gradle.kts
+++ b/allure-cucumber6-jvm/build.gradle.kts
@@ -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")
@@ -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")
diff --git a/allure-cucumber6-jvm/src/main/java/io/qameta/allure/cucumber6jvm/AllureCucumber6Jvm.java b/allure-cucumber6-jvm/src/main/java/io/qameta/allure/cucumber6jvm/AllureCucumber6Jvm.java
index 83679ffb5..88ed7caea 100644
--- a/allure-cucumber6-jvm/src/main/java/io/qameta/allure/cucumber6jvm/AllureCucumber6Jvm.java
+++ b/allure-cucumber6-jvm/src/main/java/io/qameta/allure/cucumber6jvm/AllureCucumber6Jvm.java
@@ -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(
@@ -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);
}
@@ -302,24 +305,37 @@ private Status translateTestCaseStatus(final Result testCaseResult) {
private List getExamplesAsParameters(
final Scenario scenario, final TestCase localCurrentTestCase
) {
- final Optional examplesBlock =
+ final Optional 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 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) {
diff --git a/allure-cucumber6-jvm/src/test/java/io/qameta/allure/cucumber6jvm/AllureCucumber6JvmTest.java b/allure-cucumber6-jvm/src/test/java/io/qameta/allure/cucumber6jvm/AllureCucumber6JvmTest.java
index 06922634e..fdc541590 100644
--- a/allure-cucumber6-jvm/src/test/java/io/qameta/allure/cucumber6jvm/AllureCucumber6JvmTest.java
+++ b/allure-cucumber6-jvm/src/test/java/io/qameta/allure/cucumber6jvm/AllureCucumber6JvmTest.java
@@ -108,7 +108,7 @@ void shouldSetStatusDetails() {
assertThat(testResults)
.extracting(TestResult::getStatusDetails)
.extracting(StatusDetails::getMessage)
- .containsExactlyInAnyOrder("expected [123] but found [15]");
+ .containsExactlyInAnyOrder("expecting 15 to be equal to 123");
}
@AllureFeatures.BrokenTests
diff --git a/allure-cucumber6-jvm/src/test/java/io/qameta/allure/cucumber6jvm/samples/HookSteps.java b/allure-cucumber6-jvm/src/test/java/io/qameta/allure/cucumber6jvm/samples/HookSteps.java
index 917ee04b3..e0de9fc63 100644
--- a/allure-cucumber6-jvm/src/test/java/io/qameta/allure/cucumber6jvm/samples/HookSteps.java
+++ b/allure-cucumber6-jvm/src/test/java/io/qameta/allure/cucumber6jvm/samples/HookSteps.java
@@ -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).
@@ -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")
diff --git a/allure-cucumber6-jvm/src/test/java/io/qameta/allure/cucumber6jvm/samples/SimpleFeatureSteps.java b/allure-cucumber6-jvm/src/test/java/io/qameta/allure/cucumber6jvm/samples/SimpleFeatureSteps.java
index b1d82e29a..85d03e315 100644
--- a/allure-cucumber6-jvm/src/test/java/io/qameta/allure/cucumber6jvm/samples/SimpleFeatureSteps.java
+++ b/allure-cucumber6-jvm/src/test/java/io/qameta/allure/cucumber6jvm/samples/SimpleFeatureSteps.java
@@ -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).
@@ -46,7 +46,10 @@ public void i_add_a_to_b() {
@Then("^result is (\\d+)$")
public void result_is(int arg1) {
- Assert.assertEquals(this.c, arg1);
+ // use manual fail for more stable message format
+ if (this.c != arg1) {
+ Assertions.fail("expecting %d to be equal to %d", this.c, arg1);
+ }
}
}
diff --git a/allure-httpclient/src/main/java/io/qameta/allure/httpclient/AllureHttpClientResponse.java b/allure-httpclient/src/main/java/io/qameta/allure/httpclient/AllureHttpClientResponse.java
index 0507beb86..f75891181 100644
--- a/allure-httpclient/src/main/java/io/qameta/allure/httpclient/AllureHttpClientResponse.java
+++ b/allure-httpclient/src/main/java/io/qameta/allure/httpclient/AllureHttpClientResponse.java
@@ -21,17 +21,13 @@
import io.qameta.allure.attachment.DefaultAttachmentProcessor;
import io.qameta.allure.attachment.FreemarkerAttachmentRenderer;
import io.qameta.allure.attachment.http.HttpResponseAttachment;
-import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.HttpResponseInterceptor;
-import org.apache.http.entity.HttpEntityWrapper;
+import org.apache.http.entity.BufferedHttpEntity;
import org.apache.http.protocol.HttpContext;
import org.apache.http.util.EntityUtils;
-import java.io.ByteArrayInputStream;
import java.io.IOException;
-import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
import java.util.stream.Stream;
import static io.qameta.allure.attachment.http.HttpResponseAttachment.Builder.create;
@@ -67,10 +63,12 @@ public void process(final HttpResponse response,
.forEach(header -> builder.setHeader(header.getName(), header.getValue()));
if (response.getEntity() != null) {
- final LoggableEntity loggableEntity = new LoggableEntity(response.getEntity());
- response.setEntity(loggableEntity);
+ if (!response.getEntity().isRepeatable()) {
+ final BufferedHttpEntity bufferedEntity = new BufferedHttpEntity(response.getEntity());
+ response.setEntity(bufferedEntity);
+ }
- builder.setBody(loggableEntity.getBody());
+ builder.setBody(EntityUtils.toString(response.getEntity()));
} else {
builder.setBody("No body present");
}
@@ -78,26 +76,4 @@ public void process(final HttpResponse response,
final HttpResponseAttachment responseAttachment = builder.build();
processor.addAttachment(responseAttachment, renderer);
}
-
- /**
- * Required to allow consume httpEntity twice.
- */
- private static class LoggableEntity extends HttpEntityWrapper {
-
- private final byte[] rawContent;
-
- LoggableEntity(final HttpEntity wrappedEntity) throws IOException {
- super(wrappedEntity);
- rawContent = EntityUtils.toByteArray(wrappedEntity);
- }
-
- public String getBody() {
- return new String(rawContent, StandardCharsets.UTF_8);
- }
-
- @Override
- public InputStream getContent() {
- return new ByteArrayInputStream(rawContent);
- }
- }
}
diff --git a/allure-httpclient/src/test/java/io/qameta/allure/httpclient/AllureHttpClientTest.java b/allure-httpclient/src/test/java/io/qameta/allure/httpclient/AllureHttpClientTest.java
index 366458e4a..d7e56ea95 100644
--- a/allure-httpclient/src/test/java/io/qameta/allure/httpclient/AllureHttpClientTest.java
+++ b/allure-httpclient/src/test/java/io/qameta/allure/httpclient/AllureHttpClientTest.java
@@ -22,6 +22,7 @@
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet;
+import org.apache.http.entity.BufferedHttpEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
@@ -187,4 +188,23 @@ void shouldCreateRequestAttachmentWithEmptyBodyWhenNoContentIsReturned() throws
.extracting("body")
.containsNull();
}
+
+ @Test
+ void shouldNotConsumeBody() throws Exception {
+ final AttachmentRenderer renderer = mock(AttachmentRenderer.class);
+ final AttachmentProcessor processor = mock(AttachmentProcessor.class);
+
+ final HttpClientBuilder builder = HttpClientBuilder.create()
+ .addInterceptorLast(new AllureHttpClientResponse(renderer, processor));
+
+ try (CloseableHttpClient httpClient = builder.build()) {
+ final HttpGet httpGet = new HttpGet(String.format("http://localhost:%d/hello", server.port()));
+ try (CloseableHttpResponse response = httpClient.execute(httpGet)) {
+ response.getStatusLine().getStatusCode();
+ BufferedHttpEntity ent = new BufferedHttpEntity(response.getEntity());
+ assertThat(EntityUtils.toString(ent))
+ .isEqualTo(BODY_STRING);
+ }
+ }
+ }
}
diff --git a/allure-java-commons-test/src/main/java/io/qameta/allure/test/AllureFeatures.java b/allure-java-commons-test/src/main/java/io/qameta/allure/test/AllureFeatures.java
index 53a040a09..6ae21bc43 100644
--- a/allure-java-commons-test/src/main/java/io/qameta/allure/test/AllureFeatures.java
+++ b/allure-java-commons-test/src/main/java/io/qameta/allure/test/AllureFeatures.java
@@ -222,4 +222,12 @@
@Feature("Timeline")
@interface Severity {
}
+
+ @Documented
+ @Inherited
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target({ElementType.METHOD, ElementType.TYPE})
+ @Feature("Filtration")
+ @interface Filtration {
+ }
}
diff --git a/allure-java-commons/src/main/java/io/qameta/allure/util/AnnotationUtils.java b/allure-java-commons/src/main/java/io/qameta/allure/util/AnnotationUtils.java
index 906c505a5..6fd4cee07 100644
--- a/allure-java-commons/src/main/java/io/qameta/allure/util/AnnotationUtils.java
+++ b/allure-java-commons/src/main/java/io/qameta/allure/util/AnnotationUtils.java
@@ -62,7 +62,7 @@ private AnnotationUtils() {
* @return discovered links.
*/
public static Set getLinks(final AnnotatedElement annotatedElement) {
- return getLinks(annotatedElement.getDeclaredAnnotations());
+ return getLinks(annotatedElement.getAnnotations());
}
/**
@@ -94,7 +94,7 @@ public static Set getLinks(final Collection annotations) {
* @return discovered labels.
*/
public static Set