I got (Exception in thread "main" java.util.regex.PatternSyntaxException: Dangling meta character '?' near index 6)
See original GitHub issueI’m new to karate and cucumber. I wrote below test:
Feature: ثبت نام کاربر با ایمیل تکراری
Scenario: در صورتیکه ایمیل، تکراری باشد، باید کد وضعیت ۴۰۰، وضعیت پارامترهای اشتباه، خطای ورودی ایمیل تکراری را بدهد
Given url karate.get('urlBase') + "user/registerUser"
And request
"""
{
"username" :#(karate.get('defaultUsername')),
"mobile":#(karate.get('defaultMobile')),
"email":#(karate.get('defaultEmail')),
"nationalCode":#(karate.get('defaultNationalID')),
"firstName":#(karate.get('defaultFirstName')),
"middleName":#(karate.get('defaultMiddleName')),
"lastname":#(karate.get('defaultLastName')),
"password":#(karate.get('defaultPassword'))
}
"""
When method post
Then status 200
And match response ==
"""
{
"status":0,
"message":#(karate.get('status0persianMessage'))
}
"""
Given url karate.get('urlBase') + "user/registerUser"
And request
"""
{
"username":#(karate.get('defaultUsername')),
"mobile":#(karate.get('defaultMobile')),
"email":#(karate.get('defaultEmail')),
"nationalCode":#(karate.get('defaultNationalID')),
"firstName":#(karate.get('defaultFirstName')),
"middleName":#(karate.get('defaultMiddleName')),
"lastname":#(karate.get('defaultLastName')),
"password":#(karate.get('defaultPassword'))
}
"""
When method post
Then status 200
And match response ==
"""
{
"status": 0
}
"""
but I got below error:
`“C:\Program Files (x86)\Java\jdk1.8.0_112\bin\java” “-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2017.2\lib\coverage-agent.jar=C:\Users\Homayoun\AppData\Local\Temp\coverage21839args” -Dorg.jetbrains.run.directory=C:\Users\Homayoun\Documents\Projects\HamrahDoctor\HamrahDoctorApiTest\api\src\res “-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2017.2\lib\idea_rt.jar=63829:C:\Program Files\JetBrains\IntelliJ IDEA 2017.2\bin” -Dfile.encoding=UTF-8 -classpath “C:\Program Files (x86)\Java\jdk1.8.0_112\jre\lib\charsets.jar;C:\Program Files (x86)\Java\jdk1.8.0_112\jre\lib\deploy.jar;C:\Program Files (x86)\Java\jdk1.8.0_112\jre\lib\ext\access-bridge-32.jar;C:\Program Files (x86)\Java\jdk1.8.0_112\jre\lib\ext\cldrdata.jar;C:\Program Files (x86)\Java\jdk1.8.0_112\jre\lib\ext\dnsns.jar;C:\Program Files (x86)\Java\jdk1.8.0_112\jre\lib\ext\jaccess.jar;C:\Program Files (x86)\Java\jdk1.8.0_112\jre\lib\ext\jfxrt.jar;C:\Program Files (x86)\Java\jdk1.8.0_112\jre\lib\ext\localedata.jar;C:\Program Files (x86)\Java\jdk1.8.0_112\jre\lib\ext\nashorn.jar;C:\Program Files (x86)\Java\jdk1.8.0_112\jre\lib\ext\sunec.jar;C:\Program Files (x86)\Java\jdk1.8.0_112\jre\lib\ext\sunjce_provider.jar;C:\Program Files (x86)\Java\jdk1.8.0_112\jre\lib\ext\sunmscapi.jar;C:\Program Files (x86)\Java\jdk1.8.0_112\jre\lib\ext\sunpkcs11.jar;C:\Program Files (x86)\Java\jdk1.8.0_112\jre\lib\ext\zipfs.jar;C:\Program Files (x86)\Java\jdk1.8.0_112\jre\lib\javaws.jar;C:\Program Files (x86)\Java\jdk1.8.0_112\jre\lib\jce.jar;C:\Program Files (x86)\Java\jdk1.8.0_112\jre\lib\jfr.jar;C:\Program Files (x86)\Java\jdk1.8.0_112\jre\lib\jfxswt.jar;C:\Program Files (x86)\Java\jdk1.8.0_112\jre\lib\jsse.jar;C:\Program Files (x86)\Java\jdk1.8.0_112\jre\lib\management-agent.jar;C:\Program Files (x86)\Java\jdk1.8.0_112\jre\lib\plugin.jar;C:\Program Files (x86)\Java\jdk1.8.0_112\jre\lib\resources.jar;C:\Program Files (x86)\Java\jdk1.8.0_112\jre\lib\rt.jar;C:\Users\Homayoun\Documents\Projects\HamrahDoctor\HamrahDoctorApiTest\api\target\test-classes;C:\Users\Homayoun\Documents\Projects\HamrahDoctor\HamrahDoctorApiTest\api\target\classes;C:\Users\Homayoun.m2\repository\com\intuit\karate\karate-junit4\0.6.0.9\karate-junit4-0.6.0.9.jar;C:\Users\Homayoun.m2\repository\com\intuit\karate\karate-core\0.6.0.9\karate-core-0.6.0.9.jar;C:\Users\Homayoun.m2\repository\com\jayway\jsonpath\json-path\2.1.0\json-path-2.1.0.jar;C:\Users\Homayoun.m2\repository\net\minidev\json-smart\2.2\json-smart-2.2.jar;C:\Users\Homayoun.m2\repository\net\minidev\accessors-smart\1.1\accessors-smart-1.1.jar;C:\Users\Homayoun.m2\repository\org\ow2\asm\asm\5.0.3\asm-5.0.3.jar;C:\Users\Homayoun.m2\repository\info\cukes\cucumber-java\1.2.5\cucumber-java-1.2.5.jar;C:\Users\Homayoun.m2\repository\org\yaml\snakeyaml\1.18\snakeyaml-1.18.jar;C:\Users\Homayoun.m2\repository\info\cukes\cucumber-junit\1.2.5\cucumber-junit-1.2.5.jar;C:\Users\Homayoun.m2\repository\info\cukes\cucumber-core\1.2.5\cucumber-core-1.2.5.jar;C:\Users\Homayoun.m2\repository\info\cukes\cucumber-html\0.2.3\cucumber-html-0.2.3.jar;C:\Users\Homayoun.m2\repository\info\cukes\cucumber-jvm-deps\1.0.5\cucumber-jvm-deps-1.0.5.jar;C:\Users\Homayoun.m2\repository\info\cukes\gherkin\2.12.2\gherkin-2.12.2.jar;C:\Users\Homayoun.m2\repository\junit\junit\4.12\junit-4.12.jar;C:\Users\Homayoun.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;C:\Users\Homayoun.m2\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;C:\Users\Homayoun.m2\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;C:\Users\Homayoun.m2\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;C:\Users\Homayoun.m2\repository\com\intuit\karate\karate-apache\0.6.0\karate-apache-0.6.0.jar;C:\Users\Homayoun.m2\repository\org\apache\httpcomponents\httpclient\4.5.3\httpclient-4.5.3.jar;C:\Users\Homayoun.m2\repository\org\apache\httpcomponents\httpcore\4.4.6\httpcore-4.4.6.jar;C:\Users\Homayoun.m2\repository\commons-codec\commons-codec\1.9\commons-codec-1.9.jar;C:\Users\Homayoun.m2\repository\org\apache\httpcomponents\httpmime\4.5.3\httpmime-4.5.3.jar;C:\Users\Homayoun.m2\repository\org\slf4j\jcl-over-slf4j\1.7.25\jcl-over-slf4j-1.7.25.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2017.2\plugins\cucumber-java\lib\cucumber-jvm-formatter.jar” cucumber.api.cli.Main --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvmSMFormatter --monochrome --name “^در صورتی\که ایمیل\، تکراری باشد\، باید کد وضعیت ۴۰۰\، وضعیت پارامترهای اشتباه\، خطای ورودی ایمیل تکراری را بدهد$” --glue com.intuit.karate C:/Users/Homayoun/Documents/Projects/HamrahDoctor/HamrahDoctorApiTest/api/src/res/register.user.post.duplicate.email.feature Testing started at 9:04 AM … ---- IntelliJ IDEA coverage runner ---- sampling … include patterns: cucumber.api.cli..* exclude patterns: Exception in thread “main” java.util.regex.PatternSyntaxException: Dangling meta character ‘?’ near index 6 ^?? ?????? ???? ??? ???? ??? ?? ??? ???? ??? ??? ???? ??? ??? ??? ??? ?? ???$ ^ at java.util.regex.Pattern.error(Pattern.java:1955) at java.util.regex.Pattern.sequence(Pattern.java:2123) at java.util.regex.Pattern.expr(Pattern.java:1996) at java.util.regex.Pattern.compile(Pattern.java:1696) at java.util.regex.Pattern.<init>(Pattern.java:1351) at java.util.regex.Pattern.compile(Pattern.java:1028) at cucumber.runtime.RuntimeOptions.parse(RuntimeOptions.java:140) at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:85) at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:78) at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:70) at cucumber.api.cli.Main.run(Main.java:31) at cucumber.api.cli.Main.main(Main.java:18)
Process finished with exit code 1 `
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
ok thanks for the update. glad to know things are working. ignore the file.encoding, it is not needed for you.
yes people tell me the documentation is too much 😃 but there is an interesting advantage, you can do
CTRL F
and find anything you want very easily !hey I read the stack trace more carefully - this is what is causing the problem:
try this:
RunWith(Karate.class)
annotation like mentioned in the documentation: https://github.com/intuit/karate#running-with-junitI’m closing this - because this is not an issue with Karate, it is the combination of Cucumber, your environment and IntelliJ