behave java_java – JBehave似乎没有执行测试

用户在尝试使用JBehave进行首次测试时遇到问题,测试用例没有执行。尽管测试报告显示所有用例通过,但实际上步骤方法中的断点未被触发,且异常未被捕获。问题出现在UserRegistrationSteps类的各个步骤方法中,代码中设置了故意抛出RuntimeException的断点。测试执行者类UserRegistrationTest正确配置了步骤。
摘要由CSDN通过智能技术生成

所以这是我第一次使用JBehave,我正在尝试在项目中创建第一个JBehave,但目前看来测试没有执行这些步骤.

最后,测试表明所有测试用例都没有遇到任何问题,但事实上它们根本没有执行.我在每个步骤方法中设置了断点,我的调试器根本不会阻止我,更不用说这些步骤当前抛出的异常.

这是我的情景:

Narrative:

In order for the user to start using the application, he first needs to register and log in

Scenario: Successful registration

Given a user with email 'test@test.com'

When the user specifies password 'aaaaaa'

Then the user should be successfully registered with email 'test@test.com' and hashed password 'aaaaaa'

步骤:

public class UserRegistrationSteps extends Steps {

@Given("a user with email '$email'")

public void addNewUser(@Named("email") String email) {

User u = new User();

u.setEmail(email);

throw new RuntimeException("test");

}

@When("the user specifies password '$password'")

public void setPassword(@Named("password") String password) {

System.out.println("test");

throw new RuntimeException("test");

}

@Then("the user should be successfully registered with email '$email' and hashed password '$password'")

public void verifySuccessfulRegistration(@Named("email") String email, @Named("password") String password) {

System.out.println("test");

throw new RuntimeException("test");

}

}

和测试执行者:

public class UserRegistrationTest extends JUnitStories {

public UserRegistrationTest() {

super();

this.configuredEmbedder().candidateSteps().add(new UserRegistrationSteps());

}

@Override

protected List storyPaths() {

return Arrays.asList("bdd/users/user_registration.story");

}

}

知道它有什么问题吗?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值