> Background:
> Given Ali is a customer
> And Ali opens a current account with account number 4566
> And Ali opens a current account with account number 8979
>
> Scenario: Deposits are logged in transaction logs
> Given £29.99 is deposited into account 4566
> When £9.01 is deposited into account 4566
> Then Account 4566 has 2 transactions
现在我创建了一个新的银行,我运行后台步骤,然后当我们到达场景时@Before跳入并且它在这里创建新银行是它的代码...... @Before
public void beforeScenario() {
bank = new Bank();
}
所以当我到达场景并尝试访问我通过背景创建的对象时,我得到一个空指针,这里是黄瓜结果..
Background: # All_transactions_are_logged.feature:7
Given Ali is a customer # StepDefs.is_a_customer(String)
And Ali opens a current account with account number 4566 # StepDefs.opens_a_current_account_with_account_number(String,int)
And Ali opens a current account with account number 8979 # StepDefs.opens_a_current_account_with_account_number(String,int)
Scenario: Deposits are logged in transaction logs # All_transactions_are_logged.feature:12
Given ú29.99 is deposited into account 4566 # StepDefs.is_deposited_into_account(String,long)
java.lang.NullPointerException
at my.bank.Account.deposit(Account.java:133)
at my.bank.StepDefs.is_deposited_into_account(StepDefs.java:73)
at ?.Given ú29.99 is deposited into account 4566(All_transactions_are_logged.feature:13)
When ú9.01 is deposited into account 4566 # StepDefs.is_deposited_into_account(String,long)
Then Account 4566 has 2 transactions
任何建议都有帮助... 请