We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
当同一测试用例的执行过程中包含对同一个被Mock目标方法的多次调用时,当前TestableTool工具类提供的能力依然无法便捷的区分这几次调用并进行差异化处理。考虑增加一种注入额外控制参数到Mock上下文的机制,完善TestableMock对Mock流程控制能力。
TestableTool
TestableMock
方案设计:
// 在测试用例设置控制参数 @Test public void test() { TestableTool.set(“mark”, 1); // 注入控制参数 demoInstance.method(123); // 测试场景1 ... ... TestableTool.set(“mark”, 2); // 修改控制参数值 demoInstance.method1(234); // 测试场景2 ... ... } // 在Mock方法中读取控制参数 @MockMethod private int demoMethod() { if (TestableTool.get(“mark”) == 1) { return 321; } else { return 432; } }
The text was updated successfully, but these errors were encountered:
已在v0.4.6版本实现。
v0.4.6
当前实现机制较简单,效果类似于在Mock类当中添加一个用于存储上下文信息的Map类型的成员对象,但请尽量使用此机制而非自定义对象传递附加的Mock参数,以便在未来支持Mock方法复用的新版本中,获得更好的版本升级兼容性。
Sorry, something went wrong.
No branches or pull requests
当同一测试用例的执行过程中包含对同一个被Mock目标方法的多次调用时,当前
TestableTool
工具类提供的能力依然无法便捷的区分这几次调用并进行差异化处理。考虑增加一种注入额外控制参数到Mock上下文的机制,完善TestableMock
对Mock流程控制能力。方案设计:
The text was updated successfully, but these errors were encountered: