Cucumner7+Junit5 @IncludeTag

问题描述 投票:0回答:1

在 RunCucumberTest 中使用 @Suite 在本地机器上实现(Junit5+ Cucumber7)并行性

我们如何运行单个场景@tag? (低于错误) @套房 @IncludeTags("@Tag") 添加到跑步者文件中

mvn 测试 -Dcucumber.filter.tags="@tag" 谁能请同样的建议



`<cucumber. Version>7.6.0</cucumber. Version>
<versions.selenium>3.141.59</versions.selenium>
<webdrivermanager.version>5.2.1</webdrivermanager.version>
<junit.jupiter.version>5.9.2</junit.jupiter.version>`
<apache.common.version>2.4</apache.common.version>
<projectlombok.version>1.18.24</projectlombok.version>
<maven.compiler.plugin.version>3.9.0</maven.compiler.plugin.version>
<maven.surefire.plugin.version>3.0.0-M5</maven.surefire.plugin.version>
<maven.compiler.source.version>11</maven.compiler.source.version>
<maven.compiler.target.version>11</maven.compiler.target.version>
<extentreports.cucumber7.adapter.version>1.7.0</extentreports.cucumber7.adapter.version


 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running testrunners.RunCucumberTest
Mar 28, 2023 4:10:58 PM org.junit.platform.launcher.core.CompositeTestExecutionListener lambda$notifyEach$19
WARNING: TestExecutionListener [org.apache.maven.surefire.junitplatform.RunListenerAdapter] threw exception for method: executionFinished(TestIdentifier [uniqueId = [engine:junit-platform-suite]/[suite:testrunners.RunCucumberTest]/[engine:cucumber], parentId = [engine:junit-platform-suite]/[suite:testrunners.RunCucumberTest], displayName = 'Cucumber', legacyReportingName = 'Cucumber', source = null, tags = [], type = CONTAINER], TestExecutionResult [status = FAILED, throwable = java.lang.RuntimeException: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target])
java.lang.IncompatibleClassChangeError: Class org.apache.maven.surefire.report.PojoStackTraceWriter does not implement the requested interface org.apache.maven.surefire.api.report.StackTraceWriter
        at org.apache.maven.surefire.booter.spi.LegacyMasterProcessChannelEncoder.encode(LegacyMasterProcessChannelEncoder.java:354)
        at org.apache.maven.surefire.booter.spi.LegacyMasterProcessChannelEncoder.encode(LegacyMasterProcessChannelEncoder.java:402)
        at org.apache.maven.surefire.booter.spi.LegacyMasterProcessChannelEncoder.encode(LegacyMasterProcessChannelEncoder.java:289)
        at org.apache.maven.surefire.booter.spi.LegacyMasterProcessChannelEncoder.testError(LegacyMasterProcessChannelEncoder.java:175)
        at org.apache.maven.surefire.api.booter.ForkingRunListener.testError(ForkingRunListener.java:99)
        at org.apache.maven.surefire.junitplatform.RunListenerAdapter.executionFinished(RunListenerAdapter.java:133)
        at org.junit.platform.launcher.core.CompositeTestExecutionListener.lambda$executionFinished$10(CompositeTestExecutionListener.java:69)
        at org.junit.platform.launcher.core.CompositeTestExecutionListener.lambda$notifyEach$19(CompositeTestExecutionListener.java:95)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)


cucumber junit5 cucumber-java cucumber-junit
1个回答
0
投票

Cucumber 标签映射到 JUnit 标签。请注意,@ 符号不是 JUnit 标记的一部分。所以下面的场景被标记为 Smoke and Sanity。

@Smoke
@Ignore
Scenario: A tagged scenario
 Given I tag a scenario 
 When I select tests with that tag for execution 
 Then my tagged scenario is executed

@Sanity
Scenario: Another tagged scenario   Given I tag a scenario   
When I select tests with that tag for execution    Then my tagged
scenario is executed

~ Cucumber JUnit 平台引擎 - 自述文件.

所以要选择您要使用的烟雾测试

@Suite
@IncludeEngines("cucumber")
@IncludeTags("smoke")
public class RunCucumberTest {
}

这与您的异常无关。但是如果你解决了这个问题,这就是下一步。

© www.soinside.com 2019 - 2024. All rights reserved.