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 @@ -82,7 +82,7 @@ void shouldHandleByteArrayObject() {
.extracting(StepResult::getName)
.containsExactly(
"assertThat '<BINARY>'",
"as 'Byte array object []'",
"describedAs 'Byte array object'",
"isEqualTo '<BINARY>'"
);
}
Expand Down
3 changes: 2 additions & 1 deletion allure-cucumber-jvm/src/main/resources/META-INF/aop-ajc.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<aspectj>
<weaver options="-warn:none -Xlint:ignore"/>
<aspects>
<aspect name="io.qameta.allure.aspects.StepsAspects"/>
<aspect name="io.qameta.allure.aspects.AttachmentsAspects"/>
</aspects>
</aspectj>
</aspectj>
3 changes: 2 additions & 1 deletion allure-cucumber2-jvm/src/main/resources/META-INF/aop-ajc.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<aspectj>
<weaver options="-warn:none -Xlint:ignore"/>
<aspects>
<aspect name="io.qameta.allure.aspects.StepsAspects"/>
<aspect name="io.qameta.allure.aspects.AttachmentsAspects"/>
</aspects>
</aspectj>
</aspectj>
3 changes: 2 additions & 1 deletion allure-cucumber3-jvm/src/main/resources/META-INF/aop-ajc.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<aspectj>
<weaver options="-warn:none -Xlint:ignore"/>
<aspects>
<aspect name="io.qameta.allure.aspects.StepsAspects"/>
<aspect name="io.qameta.allure.aspects.AttachmentsAspects"/>
</aspects>
</aspectj>
</aspectj>
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,67 @@
*/
package io.qameta.allure.cucumber5jvm;


import gherkin.ast.*;
import io.qameta.allure.cucumber5jvm.testsourcemodel.TestSourcesModelProxy;
import gherkin.ast.Examples;
import gherkin.ast.Feature;
import gherkin.ast.ScenarioDefinition;
import gherkin.ast.ScenarioOutline;
import gherkin.ast.TableRow;
import io.cucumber.plugin.ConcurrentEventListener;
import io.cucumber.plugin.event.*;
import io.cucumber.plugin.event.DataTableArgument;
import io.cucumber.plugin.event.EmbedEvent;
import io.cucumber.plugin.event.EventHandler;
import io.cucumber.plugin.event.EventPublisher;
import io.cucumber.plugin.event.HookTestStep;
import io.cucumber.plugin.event.HookType;
import io.cucumber.plugin.event.PickleStepTestStep;
import io.cucumber.plugin.event.Result;
import io.cucumber.plugin.event.StepArgument;
import io.cucumber.plugin.event.TestCase;
import io.cucumber.plugin.event.TestCaseFinished;
import io.cucumber.plugin.event.TestCaseStarted;
import io.cucumber.plugin.event.TestSourceRead;
import io.cucumber.plugin.event.TestStepFinished;
import io.cucumber.plugin.event.TestStepStarted;
import io.cucumber.plugin.event.WriteEvent;
import io.qameta.allure.Allure;
import io.qameta.allure.AllureLifecycle;
import io.qameta.allure.model.*;
import io.qameta.allure.cucumber5jvm.testsourcemodel.TestSourcesModelProxy;
import io.qameta.allure.model.FixtureResult;
import io.qameta.allure.model.Parameter;
import io.qameta.allure.model.Status;
import io.qameta.allure.model.StatusDetails;
import io.qameta.allure.model.StepResult;
import io.qameta.allure.model.TestResult;
import io.qameta.allure.model.TestResultContainer;

import java.io.ByteArrayInputStream;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.Collections;
import java.util.Deque;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;

import static io.qameta.allure.util.ResultsUtils.*;
import static io.qameta.allure.util.ResultsUtils.createParameter;
import static io.qameta.allure.util.ResultsUtils.getStatus;
import static io.qameta.allure.util.ResultsUtils.getStatusDetails;
import static io.qameta.allure.util.ResultsUtils.md5;

/**
* Allure plugin for Cucumber JVM 5.0.
*/
@SuppressWarnings({
"ClassDataAbstractionCoupling",
"ClassFanOutComplexity",
"PMD.ExcessiveImports",
"ClassFanOutComplexity", "ClassDataAbstractionCoupling"
"PMD.GodClass",
})
public class AllureCucumber5Jvm implements ConcurrentEventListener {

Expand Down Expand Up @@ -291,7 +325,7 @@ private List<Parameter> getExamplesAsParameters(
private void createDataTableAttachment(final DataTableArgument dataTableArgument) {
final List<List<String>> rowsInTable = dataTableArgument.cells();
final StringBuilder dataTableCsv = new StringBuilder();
for (List<String> columns:rowsInTable) {
for (List<String> columns : rowsInTable) {
if (!columns.isEmpty()) {
for (int i = 0; i < columns.size(); i++) {
if (i == columns.size() - 1) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright 2020 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* 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.
*/
package io.qameta.allure.cucumber5jvm.testsourcemodel;

import gherkin.AstBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import java.util.HashMap;
import java.util.Map;


public class TestSourcesModelProxy {

private final Map<URI, TestSourceRead> pathToReadEventMap = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ void shouldCreateResponseAttachmentWithEmptyBody() throws Exception {
.containsExactly("No body present");
}

@SuppressWarnings("unchecked")
@Test
void shouldCreateRequestAttachmentWithEmptyBodyWhenNoContentIsReturned() throws Exception {
final AttachmentRenderer<AttachmentData> renderer = mock(AttachmentRenderer.class);
Expand Down
2 changes: 2 additions & 0 deletions allure-java-commons-test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ description = "Allure Java Commons Test Utils"

dependencies {
api("commons-io:commons-io")
api("io.github.benas:random-beans")
api("org.apache.commons:commons-lang3")
api(project(":allure-java-commons"))
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2020 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* 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.
*/
package io.qameta.allure.test;

import org.apache.commons.lang3.RandomStringUtils;

/**
* @author charlie (Dmitry Baev).
*/
public final class TestData {

private TestData() {
throw new IllegalStateException("do not instance");
}

public static String randomName() {
return RandomStringUtils.randomAlphabetic(10);
}

public static String randomId() {
return randomString(10);
}

public static String randomString(final int count) {
return RandomStringUtils.randomAlphanumeric(count);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright 2020 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* 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.
*/
package io.qameta.allure.test;

import io.github.benas.randombeans.EnhancedRandomBuilder;
import io.github.benas.randombeans.api.EnhancedRandom;

/**
* @author charlie (Dmitry Baev).
*/
public final class ThreadLocalEnhancedRandom {

private static final ThreadLocal<EnhancedRandom> INSTANCE = ThreadLocal
.withInitial(EnhancedRandomBuilder::aNewEnhancedRandom);

private ThreadLocalEnhancedRandom() {
throw new IllegalStateException("do not instance");
}

public static EnhancedRandom current() {
return INSTANCE.get();
}

}
1 change: 1 addition & 0 deletions allure-java-commons/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dependencies {
implementation("org.jooq:joor-java-8")
testImplementation("io.github.benas:random-beans")
testImplementation("io.github.glytching:junit-extensions")
testImplementation("org.apache.commons:commons-lang3")
testImplementation("org.assertj:assertj-core")
testImplementation("org.junit.jupiter:junit-jupiter-api")
testImplementation("org.junit.jupiter:junit-jupiter-params")
Expand Down
Loading