我正在寫一個測試的黃瓜,我拿出一些困難,返回的Java存儲黃瓜值:一步
我有創造的DTO和使用保存客戶端返回的DTO再回來,我會需要將其保存了一步使用返回的dto進行其他步驟,但不知道如何製作它。
這裏是它的外觀在代碼:
commonExpenseCreationSteps.java
@Given("^new \"([^\"]*)\" expense with type \"([^"]*)\"$")
public ExpenseDTO newExpense(String description, String expenseType) throws Throwable {
ExpenseDTO expenseDTO = new ExpenseDTO();
expenseDTO.setDefaultPurpose(description);
expenseDTO.setExpenseType(expenseType);
return expenseSaveClient.save(expenseDTO);
}
expenseTransactionsSendSteps.java
@Given("^send expense for Approval$")
public void sendExpenseForApproval() throws InterruptedException {
expenseTransactionSendClient.sendToApproval(expenseDTO);
}
怎麼會是能夠利用一個返回值店在這種情況下,我會返回,在另一箇中使用它ExpenseDTO在newExpense方法中,但我需要在sendExpenseForApproval中使用它,但不知道該怎麼做!?
http://stackoverflow.com/questions/34449948/how-to-pass-variable-values-between-steps-in-cucumber-java 檢查了這一點 –