gpt4 book ai didi

java - 如何配置 Cucumber JVM + Logging appender?

转载 作者:行者123 更新时间:2023-12-05 05:20:56 25 4
gpt4 key购买 nike

我正在使用
agent-java-cucumber 作为代理(和客户端?)
也许我应该使用 reportportal-java 作为客户端(尝试没有成功)
logger-java-log4j 作为日志附加器

现在我只能从 ScenarioReporter 获取日志(场景、步骤等)
report portal screenshot
logger.debug("something") 对我来说在 RP 中不可见。
我是不是遗漏了什么配置?
运行者

package com.example.rp.runner;

import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;

@RunWith(Cucumber.class)
@CucumberOptions(
glue = {"com.example.rp.steps"},
features = "src/test/resources/features",
tags = "@logging",
plugin = {"com.epam.reportportal.cucumber.ScenarioReporter", "pretty", "html:target/cucumber"}
)
public class CucumberRunner{
}

这是我的 pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.example.rp</groupId>
<artifactId>report-portal-logging</artifactId>
<version>1.0-SNAPSHOT</version>

<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>bintray-epam-reportportal</id>
<name>bintray</name>
<url>http://dl.bintray.com/epam/reportportal</url>
</repository>
</repositories>


<dependencies>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>20.0</version>
</dependency>

<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.8.8</version>
</dependency>
<dependency>
<groupId>com.epam.reportportal</groupId>
<artifactId>client-java-core</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>com.epam.reportportal</groupId>
<artifactId>agent-java-cucumber</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>com.epam.reportportal</groupId>
<artifactId>logger-java-log4j</artifactId>
<version>3.0.1</version>
</dependency>
</dependencies>


<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7.2</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
<configuration>
<includes>
<include>**/CucumberRunner.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

项目 here

最佳答案

您发布的示例的主要问题是您使用了 2 代客户端和 3 代日志附加器。 Here is example of how to configure cucumber client为了设置日志记录,您需要执行 following steps

关于java - 如何配置 Cucumber JVM + Logging appender?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43926967/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com