模拟对象用于验证预期值正在生成。
Mock objects are used to verify that the expected values are being generated.
稍后我们将在第二个模拟对象实现中使用它们。
We will be using these later in our second mock object implementation.
使用其他工具或者那些预先打包好的模拟对象。
我们将通过创建合适的模拟对象来启用此类测试。
We will enable such testing by creating a suitable mock object.
在最后一步中,模拟对象将报告它收到的检索通知。
In the last step, the Mock Object reports the Retrieval Notification it received.
在模拟对象里添加方法,使得您的测试正确地初始化。
Add methods to the mock object that allow you to initialize it properly for your tests.
构建基于classb类的模拟对象并向其提供期望。
A mock object based on a ClassB class is constructed and provided an expectation.
模拟对象允许您对组件进行测试,而不必依赖于外部资源。
A mock object enables you to test your component without having to depend on the external resource.
BPEL流程连续快速地对同一模拟对象发出多个不同的调用。
A BPEL process makes several different calls to the same mock object in rapid succession.
图5显示了我们介绍的测试规范、流程和模拟对象之间的关系。
Figure 5 shows the relationship between the test specifications, the process, and the mock objects we have described.
我为此项目创建了两个模拟对象,分别模拟GPS设备和UI。
I create two mock objects for this project to simulate the GPS device and the UI, respectively.
简化单元测试的一个流行技巧就是创建仅用于测试中的模拟对象。
A popular technique for simplifying unit tests is to create mock objects that are used just in the tests.
在开始使用模拟对象之前,您可能希望检查当前实现的业务流程。
Before we start work on the mock objects, you might like to examine the business process as it is currently implemented.
为了达到快速测试的目的,我们创建模拟对象来代替真实的对象。
A mock object is a replacement for a real object that we create for the express purpose of testing.
最后,您可以看到测试步骤正在检查模拟对象是否收到正确的数据。
Finally, you can see the test step checking that the mock object did receive the correct data.
已有的模拟对象类可以再度使用,稍做修改就可以用于未来的测试。
The mock object classes we have can be reused and enhanced for future tests with minimal effort.
提供这些内容是为了能够快速演示我们接下来将要构建的模拟对象。
These are supplied to enable a quick demonstration of the mock object we are about to build next.
但是利用现有的工具可以有一些创建模拟对象或是相当能力的简单方法。
But there are some easy ways to create mock objects, or equivalent capabilities, with existing tools.
检查测试规范,提醒自己如何结合使用测试和模拟对象来验证流程行为。
Examine the test specifications to remind yourself of how the tests and mock objects cooperate to verify the process behaviour.
有时您可能需要开发更复杂的模拟对象类,因为他们会带给您额外的收益。
Sometimes you may want to develop much more complex mock object classes because they will give you additional benefits.
我们大约需要编写50行代码来真正执行我们在模拟对象类中所需的行为。
We had to write approximately 50 lines of code that actually implemented the behavior we needed in our mock object classes.
在实现模拟对象时,我们需要考虑如何生成驱动不同路径所需的不同错误。
When we implement our mock object, we will need to consider how to produce the different errors needed to drive the different paths.
特别地,我想提供一些技巧来说明编写带有模拟对象的单元测试是多么容易。
Specifically, I want to offer some tips on how easy it can be to write unit tests with mock objects.
我们通过扩展模拟对象的功能完成了这一点,即添加了第二个接口(图6)。
We accomplish this by extending the capabilities of the mock object, adding a second interface (Figure 6).
模拟对象现已准备好在serviceclass类中作为实际对象使用。
The mock object is now ready for use in the ServiceClass class as a real object.
从接口创建模拟对象的过程简单易行,并能帮助我们开发有效的单元测试套件。
The process for building mock objects from interfaces is simple, straightforward, and helps me develop effective unit test suites.
现在我们可以将BPEL流程连接到我们创建的两个模拟对象,然后运行测试。
We can now wire the BPEL process to the two mock objects we created and run the tests.
此SOA开发流程的第三步是开发服务模拟——通过服务测试的模拟对象。
The third step in this SOA development process is to develop service mocks -- mock objects that pass the service tests.
检查在Binding选项卡中输入的值,了解它们如何引用您的模拟对象模块。
Examine the values entered in the binding TAB to see how they refer to your mock object module.
在这一环节,值得探讨我们使用模拟对象得到的收益是什么以及花费的代价是什么。
At this point, it's worth asking what benefits we achieved with the mock objects and what did they cost.
应用推荐