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
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ class LabelBuilder {
}
}

getScenarioLabels().addAll(ResultsUtils.getProvidedLabels());
getScenarioLabels().addAll(Arrays.asList(
createHostLabel(),
createThreadLabel(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.parallel.ResourceLock;

import java.nio.charset.StandardCharsets;
import java.time.Instant;
Expand All @@ -55,6 +56,8 @@
import static java.util.Objects.nonNull;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.tuple;
import static org.junit.jupiter.api.parallel.ResourceAccessMode.READ_WRITE;
import static org.junit.jupiter.api.parallel.Resources.SYSTEM_PROPERTIES;

/**
* @author charlie (Dmitry Baev).
Expand Down Expand Up @@ -404,6 +407,22 @@ void shouldUseUuid() {
.allMatch(uuid -> nonNull(uuid) && uuid.matches("[\\-a-z0-9]+"), "UUID");
}

@ResourceLock(value = SYSTEM_PROPERTIES, mode = READ_WRITE)
@SystemProperty(name = "allure.label.x-provided", value = "cucumberjvm1-test-provided")
@Test
void shouldSupportProvidedLabels() {
final AllureResults results = runFeature("features/simple.feature");

final List<TestResult> testResults = results.getTestResults();
assertThat(testResults)
.hasSize(1)
.flatExtracting(TestResult::getLabels)
.extracting(Label::getName, Label::getValue)
.contains(
tuple("x-provided", "cucumberjvm1-test-provided")
);
}

private AllureResults runFeature(final String featureResource,
final String... moreOptions) {
final AllureResultsWriterStub writer = new AllureResultsWriterStub();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import gherkin.pickles.PickleTag;
import io.qameta.allure.model.Label;
import io.qameta.allure.model.Link;
import io.qameta.allure.util.ResultsUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -114,6 +115,7 @@ class LabelBuilder {
}
}

getScenarioLabels().addAll(ResultsUtils.getProvidedLabels());
getScenarioLabels().addAll(Arrays.asList(
createHostLabel(),
createThreadLabel(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.apache.commons.io.IOUtils;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.parallel.ResourceLock;

import java.io.IOException;
import java.io.InputStream;
Expand All @@ -61,6 +62,8 @@
import static java.util.Objects.nonNull;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.tuple;
import static org.junit.jupiter.api.parallel.ResourceAccessMode.READ_WRITE;
import static org.junit.jupiter.api.parallel.Resources.SYSTEM_PROPERTIES;

/**
* @author charlie (Dmitry Baev).
Expand Down Expand Up @@ -555,6 +558,21 @@ void shouldSetStatusFailedOnFailedAndUndefinedSteps() {
.containsExactlyInAnyOrder(Status.FAILED);
}

@ResourceLock(value = SYSTEM_PROPERTIES, mode = READ_WRITE)
@SystemProperty(name = "allure.label.x-provided", value = "cucumberjvm2-test-provided")
@Test
void shouldSupportProvidedLabels() {
final AllureResults results = runFeature("features/simple.feature");

final List<TestResult> testResults = results.getTestResults();
assertThat(testResults)
.hasSize(1)
.flatExtracting(TestResult::getLabels)
.extracting(Label::getName, Label::getValue)
.contains(
tuple("x-provided", "cucumberjvm2-test-provided")
);
}

private String readResource(final String resourceName) {
try (InputStream is = currentThread().getContextClassLoader().getResourceAsStream(resourceName)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import gherkin.pickles.PickleTag;
import io.qameta.allure.model.Label;
import io.qameta.allure.model.Link;
import io.qameta.allure.util.ResultsUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -114,6 +115,7 @@ class LabelBuilder {
}
}

getScenarioLabels().addAll(ResultsUtils.getProvidedLabels());
getScenarioLabels().addAll(Arrays.asList(
createHostLabel(),
createThreadLabel(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.apache.commons.io.IOUtils;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.parallel.ResourceLock;

import java.io.IOException;
import java.io.InputStream;
Expand All @@ -61,6 +62,8 @@
import static java.util.Objects.nonNull;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.tuple;
import static org.junit.jupiter.api.parallel.ResourceAccessMode.READ_WRITE;
import static org.junit.jupiter.api.parallel.Resources.SYSTEM_PROPERTIES;

/**
* @author charlie (Dmitry Baev).
Expand Down Expand Up @@ -568,6 +571,22 @@ void shouldSetStatusFailedOnFailedAndUndefinedSteps() {
.containsExactlyInAnyOrder(Status.FAILED);
}

@ResourceLock(value = SYSTEM_PROPERTIES, mode = READ_WRITE)
@SystemProperty(name = "allure.label.x-provided", value = "cucumberjvm3-test-provided")
@Test
void shouldSupportProvidedLabels() {
final AllureResults results = runFeature("features/simple.feature");

final List<TestResult> testResults = results.getTestResults();
assertThat(testResults)
.hasSize(1)
.flatExtracting(TestResult::getLabels)
.extracting(Label::getName, Label::getValue)
.contains(
tuple("x-provided", "cucumberjvm3-test-provided")
);
}

private String readResource(final String resourceName) {
try (InputStream is = currentThread().getContextClassLoader().getResourceAsStream(resourceName)) {
return IOUtils.toString(is, StandardCharsets.UTF_8);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ class LabelBuilder {
final String featureName = feature.getName();
final String uri = scenario.getUri();

getScenarioLabels().addAll(ResultsUtils.getProvidedLabels());
getScenarioLabels().addAll(Arrays.asList(
createHostLabel(),
createThreadLabel(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import org.apache.commons.io.IOUtils;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.parallel.ResourceLock;

import java.io.IOException;
import java.io.InputStream;
Expand All @@ -70,6 +71,8 @@
import static java.lang.Thread.currentThread;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.tuple;
import static org.junit.jupiter.api.parallel.ResourceAccessMode.READ_WRITE;
import static org.junit.jupiter.api.parallel.Resources.SYSTEM_PROPERTIES;

/**
* @author charlie (Dmitry Baev).
Expand Down Expand Up @@ -730,6 +733,23 @@ void shouldHandleAmbigiousStepsExceptions() {
);
}

@ResourceLock(value = SYSTEM_PROPERTIES, mode = READ_WRITE)
@SystemProperty(name = "allure.label.x-provided", value = "cucumberjvm4-test-provided")
@Test
void shouldSupportProvidedLabels() {
final AllureResultsWriterStub results = new AllureResultsWriterStub();
runFeature(results, "features/simple.feature");

final List<TestResult> testResults = results.getTestResults();
assertThat(testResults)
.hasSize(1)
.flatExtracting(TestResult::getLabels)
.extracting(Label::getName, Label::getValue)
.contains(
tuple("x-provided", "cucumberjvm4-test-provided")
);
}

private byte runFeature(final AllureResultsWriterStub writer,
final String featureResource,
final String... moreOptions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ class LabelBuilder {
final String featureName = feature.getName();
final URI uri = scenario.getUri();

getScenarioLabels().addAll(ResultsUtils.getProvidedLabels());
getScenarioLabels().addAll(Arrays.asList(
createHostLabel(),
createThreadLabel(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import io.qameta.allure.test.AllureResultsWriterStub;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.parallel.ResourceLock;

import java.nio.charset.StandardCharsets;
import java.time.Clock;
Expand All @@ -55,6 +56,8 @@

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.tuple;
import static org.junit.jupiter.api.parallel.ResourceAccessMode.READ_WRITE;
import static org.junit.jupiter.api.parallel.Resources.SYSTEM_PROPERTIES;

/**
* @author charlie (Dmitry Baev).
Expand Down Expand Up @@ -713,6 +716,23 @@ void shouldHandleAmbigiousStepsExceptions() {
);
}

@ResourceLock(value = SYSTEM_PROPERTIES, mode = READ_WRITE)
@SystemProperty(name = "allure.label.x-provided", value = "cucumberjvm5-test-provided")
@Test
void shouldSupportProvidedLabels() {
final AllureResultsWriterStub results = new AllureResultsWriterStub();
runFeature(results, "features/simple.feature");

final List<TestResult> testResults = results.getTestResults();
assertThat(testResults)
.hasSize(1)
.flatExtracting(TestResult::getLabels)
.extracting(Label::getName, Label::getValue)
.contains(
tuple("x-provided", "cucumberjvm5-test-provided")
);
}

private byte runFeature(final AllureResultsWriterStub writer,
final String featureResource,
final String... moreOptions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ class LabelBuilder {
final String featureName = feature.getName();
final URI uri = scenario.getUri();

getScenarioLabels().addAll(ResultsUtils.getProvidedLabels());
getScenarioLabels().addAll(Arrays.asList(
createHostLabel(),
createThreadLabel(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import io.qameta.allure.test.AllureResultsWriterStub;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.parallel.ResourceLock;

import java.nio.charset.StandardCharsets;
import java.time.Clock;
Expand All @@ -55,6 +56,8 @@

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.tuple;
import static org.junit.jupiter.api.parallel.ResourceAccessMode.READ_WRITE;
import static org.junit.jupiter.api.parallel.Resources.SYSTEM_PROPERTIES;

/**
* @author charlie (Dmitry Baev).
Expand Down Expand Up @@ -713,6 +716,23 @@ void shouldHandleAmbigiousStepsExceptions() {
);
}

@ResourceLock(value = SYSTEM_PROPERTIES, mode = READ_WRITE)
@SystemProperty(name = "allure.label.x-provided", value = "cucumberjvm6-test-provided")
@Test
void shouldSupportProvidedLabels() {
final AllureResultsWriterStub results = new AllureResultsWriterStub();
runFeature(results, "features/simple.feature");

final List<TestResult> testResults = results.getTestResults();
assertThat(testResults)
.hasSize(1)
.flatExtracting(TestResult::getLabels)
.extracting(Label::getName, Label::getValue)
.contains(
tuple("x-provided", "cucumberjvm6-test-provided")
);
}

private byte runFeature(final AllureResultsWriterStub writer,
final String featureResource,
final String... moreOptions) {
Expand Down