我正在尝试在Mac上运行cucumber tutorial示例。我按照该教程的说明访问了给定的页面(据我了解的说明),并按照该页面上的说明创建了文件(即文件annotation.java
,runTest.java
和outline.feature
),如Annotation
下的软件包src/test/java
中所述。
使用的版本:
文件已保存,在eclipse
编辑器中没有显示任何明显的错误。但是当我执行runTest.java
-> runAs
-> JUnit test
时,出现以下错误:
Feature: annotation
#This is how background can be used to eliminate duplicate steps
Background: [90m# Annotation/outline.feature:4[0m
User navigates to Facebook Given
I am on Facebook login page
#Scenario with AND
Scenario: [90m# Annotation/outline.feature:9[0m
[90mWhen [0m[90mI enter username as "[0m[90m[1mTOM[0m[90m"[0m [90m# annotation.enterUsername(String)[0m
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by cucumber.runtime.xstream.converters.collections.TreeMapConverter (file:/Users/adietz/.m2/repository/info/cukes/cucumber-core/1.0.2/cucumber-core-1.0.2.jar) to field java.util.TreeMap.comparator
WARNING: Please consider reporting this to the maintainers of cucumber.runtime.xstream.converters.collections.TreeMapConverter
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[1A [31mWhen [0m[31mI enter username as "[0m[31m[1mTOM[0m[31m"[0m [90m# annotation.enterUsername(String)[0m
[31mjava.lang.NullPointerException
at Annotation.annotation.enterUsername(annotation.java:22)
at ✽.When I enter username as "TOM"(Annotation/outline.feature:10)
[0m
[90mAnd [0m[90mI enter password as "[0m[90m[1mJERRY[0m[90m"[0m [90m# annotation.enterPassword(String)[0m
[1A [36mAnd [0m[36mI enter password as "[0m[36m[1mJERRY[0m[36m"[0m [90m# annotation.enterPassword(String)[0m
[90mThen [0m[90mLogin should fail[0m [90m# annotation.checkFail()[0m
[1A [36mThen [0m[36mLogin should fail[0m [90m# annotation.checkFail()[0m
#This is how background can be used to eliminate duplicate steps
Background: [90m# Annotation/outline.feature:4[0m
User navigates to Facebook Given
I am on Facebook login page
#Scenario with BUT
Scenario: [90m# Annotation/outline.feature:15[0m
[90mWhen [0m[90mI enter username as "[0m[90m[1mTOM[0m[90m"[0m [90m# annotation.enterUsername(String)[0m
[1A [31mWhen [0m[31mI enter username as "[0m[31m[1mTOM[0m[31m"[0m [90m# annotation.enterUsername(String)[0m
[31mjava.lang.NullPointerException
at Annotation.annotation.enterUsername(annotation.java:22)
at ✽.When I enter username as "TOM"(Annotation/outline.feature:16)
[0m
[90mAnd [0m[90mI enter password as "[0m[90m[1mJERRY[0m[90m"[0m [90m# annotation.enterPassword(String)[0m
[1A [36mAnd [0m[36mI enter password as "[0m[36m[1mJERRY[0m[36m"[0m [90m# annotation.enterPassword(String)[0m
[90mThen [0m[90mLogin should fail[0m [90m# annotation.checkFail()[0m
[1A [36mThen [0m[36mLogin should fail[0m [90m# annotation.checkFail()[0m
[90mBut [0m[90mRelogin option should be available[0m [90m# annotation.checkRelogin()[0m
[1A [36mBut [0m[36mRelogin option should be available[0m [90m# annotation.checkRelogin()[0m
java.lang.NullPointerException
at Annotation.annotation.enterUsername(annotation.java:22)
at ✽.When I enter username as "TOM"(Annotation/outline.feature:10)
java.lang.NullPointerException
at Annotation.annotation.enterUsername(annotation.java:22)
at ✽.When I enter username as "TOM"(Annotation/outline.feature:16)
我不是java
的专家,当然也不是eclipse
的专家。那么,如何解决该错误?以及如何与该教程的创建者联系,以便他们可以更新该教程(使其更加清晰)?