我正在尝试更新测试框架中的一些依赖项,但是当我在这里使用示例时:https://github.com/cmccarthyirl/spring-cucumber-junit-test-harness 我得到以下错误,我不知道为什么。。。
我尝试过本主题中建议的解决方案,但都不适用于我:
cucumber.runtime.cucumberexception:java.util.regex.patternsyntaxexception:索引39附近非法重复
任何帮助都将不胜感激
错误
cucumber.runtime.CucumberException: java.util.regex.PatternSyntaxException: Illegal repetition near index 53
the user logged into the App with the following {String} and {String}
^
at cucumber.runtime.java.JavaBackend.addStepDefinition(JavaBackend.java:149)
at cucumber.runtime.java.MethodScanner.scan(MethodScanner.java:63)
at cucumber.runtime.java.MethodScanner.scan(MethodScanner.java:40)
at cucumber.runtime.java.JavaBackend.loadGlue(JavaBackend.java:79)
at cucumber.runner.Runner.<init>(Runner.java:45)
at cucumber.runtime.Runtime.<init>(Runtime.java:65)
at cucumber.runtime.Runtime.<init>(Runtime.java:45)
at cucumber.runtime.Runtime.<init>(Runtime.java:41)
at cucumber.api.junit.Cucumber.createRuntime(Cucumber.java:102)
at cucumber.api.junit.Cucumber.<init>(Cucumber.java:77)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:37)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
at org.junit.internal.requests.ClassRequest.createRunner(ClassRequest.java:28)
at org.junit.internal.requests.MemoizingRequest.getRunner(MemoizingRequest.java:19)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:50)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:220)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:53)
Caused by: java.util.regex.PatternSyntaxException: Illegal repetition near index 53
the user logged into the App with the following {String} and {String}
^
at java.util.regex.Pattern.error(Pattern.java:1969)
at java.util.regex.Pattern.closure(Pattern.java:3171)
at java.util.regex.Pattern.sequence(Pattern.java:2148)
at java.util.regex.Pattern.expr(Pattern.java:2010)
at java.util.regex.Pattern.compile(Pattern.java:1702)
at java.util.regex.Pattern.<init>(Pattern.java:1352)
at java.util.regex.Pattern.compile(Pattern.java:1028)
at cucumber.runtime.java.JavaBackend.pattern(JavaBackend.java:185)
at cucumber.runtime.java.JavaBackend.addStepDefinition(JavaBackend.java:144)
... 24 more
跑步者等级
package com.app;
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(plugin = {
"pretty", "com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:", "json:target/cucumber-report.json"
}, glue = {
"step", "utils"
}, features = {
"classpath:features/miscellaneous/Login.feature"
})
public class AbInitioRunnerTest {
}
要素类
@App
Feature: User login tests
Scenario Outline: Verify the user can log in
Given the user logged into the App with the following <username> and <password>
Examples:
| username | password |
| automation | automation |
step类
@Given("^the user logged into the App with the following (.*) and (.*)$")
public void theUserLoggedIntoTheAppWithTheFollowingUsernameAndPassword(String username,
String password) {
...
}
聚甲醛
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports-cucumber2-adapter</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-core</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>2.3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-spring</artifactId>
<version>2.3.1</version>
</dependency>
暂无答案!
目前还没有任何答案,快来回答吧!