尝试运行测试脚本(功能文件)时,出现两个错误之一。特征文件的名称和内容是非 ASCII 字符。使用 Windows 10.
更改“非 Unicode 程序的语言”设置之前出错:
Exception in thread "main" java.util.regex.PatternSyntaxException: Dangling meta character '?' near index 3
^???????? ??????????? ? ??? ????????$
更改设置后出错:
Exception in thread "main" cucumber.runtime.CucumberException: Failed to parse resource at: file:/C:/Users/user/IdeaProjects/proj/src/test/resources/features/???????????.feature
at cucumber.runtime.model.FeatureParser.parseResource(FeatureParser.java:40)
at cucumber.runtime.model.FeatureBuilder.parse(FeatureBuilder.java:25)
at ru.sbtqa.tag.pagefactory.utils.GherkinSerializer.lambda$0(GherkinSerializer.java:60)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at ru.sbtqa.tag.pagefactory.utils.GherkinSerializer.reserializeFeatures(GherkinSerializer.java:41)
at ru.sbtqa.tag.pagefactory.aspects.FragmentsAspect.replaceSteps(FragmentsAspect.java:34)
at cucumber.runtime.FeaturePathFeatureSupplier.get(FeaturePathFeatureSupplier.java:30)
at cucumber.runtime.Runtime.run(Runtime.java:67)
at cucumber.api.cli.Main.run(Main.java:26)
at cucumber.api.cli.Main.main(Main.java:8)
Caused by: gherkin.ParserException$CompositeParserException: Parser errors:
(3:1): expected: #TagLine, #FeatureLine, #Comment, #Empty, got '??????????: ???????????'
(5:3): expected: #TagLine, #FeatureLine, #Comment, #Empty, got '???????????:'
(6:5): expected: #TagLine, #FeatureLine, #Comment, #Empty, got '???? ???????????? ????????? ?? ???????? "???????"'
(7:5): expected: #TagLine, #FeatureLine, #Comment, #Empty, got '* ?? (????????? ????)'
(10:3): expected: #TagLine, #FeatureLine, #Comment, #Empty, got '????????: ???????? ??????????? ? ??? ????????'
(11:5): expected: #TagLine, #FeatureLine, #Comment, #Empty, got '? ?? (???????? ????? ???????? ????) " ??????????? "'
(12:5): expected: #TagLine, #FeatureLine, #Comment, #Empty, got '????? ?? ????????? ?? ???????? "???????????"'
(13:5): expected: #TagLine, #FeatureLine, #Comment, #Empty, got '* ?? (??????? ???????? ??????)'
(14:5): expected: #TagLine, #FeatureLine, #Comment, #Empty, got '* ?? ??????? ?? ?????? "????? ??????????"'
(15:5): expected: #TagLine, #FeatureLine, #Comment, #Empty, got '* (???? ????????? ? ???????) "???????? ???????????"'
(16:5): expected: #TagLine, #FeatureLine, #Comment, #Empty, got '* ?? ?????????? ????????? ?????? ? ?????? "10" ? ????????? ? ?????????? "??????????"'
at gherkin.Parser.addError(Parser.java:152)
at gherkin.Parser.matchTokenAt_2(Parser.java:569)
at gherkin.Parser.matchToken(Parser.java:343)
at gherkin.Parser.parse(Parser.java:137)
at gherkin.Parser.parse(Parser.java:118)
at gherkin.Parser.parse(Parser.java:114)
at cucumber.runtime.model.FeatureParser.parseResource(FeatureParser.java:36)
... 9 more
Process finished with exit code 1
还尝试在 IDE 中更改编码设置 - 结果相同。