Preferably, you should code test cases first.
您应该优先编写测试用例。
Test the code in a separate application.
在单独的应用程序中测试代码。
Paste this code into your test class and save it.
将此代码粘帖到您的测试类,并保存。
But doing so will probably make your code harder to test, debug, and maintain.
但这样做可能会让您的代码更加难以测试、调试和维护。
Refactoring is a more tedious procedure than generating new test code from scratch.
重构会是一个比从头生成新测试代码更乏味的过程。
Now the test code clearly represents the intent of the test.
现在,测试代码清楚地表示出了该测试的意图。
Code a little and test what you built.
编写一些代码,马上进行测试和构建。
This code allows the test to pass, but upon reflection, it's awful!
这段代码允许测试通过,但是再考虑一下,它十分糟糕!
Listing 4 shows the full code of the test case object.
清单4显示了测试用例对象的完整代码。
To keep the code simple, I put the class and the test code in one file.
为了保持代码简单,我把类和测试代码放在一个文件中。
If you can decouple them, you can more easily code, test, and maintain them.
如果能将它们解耦,会更加易于编码、测试和维护。
We avoid the cost of rewriting code to test it later.
我们也避免了重写代码后再进行测试的高昂代价。
The test code would like it to produce a different type (a mock).
测试代码希望它产生另一种类型的对象(模仿对象)。
With the code done, you can test the application.
代码完成之后,您可以对应用程序进行测试。
Write just enough code to make the test compile.
编写足够的代码以使测试进行编译。
In your test code, create a specialization object that extends (specializes) the target.
在测试代码中,创建扩展(专用于)目标对象的特殊化对象。
Writing application test code in a scripting language.
在脚本语言中编写应用程序测试代码。
However, it requires a lot of effort to create robust test code.
然而,它需要投入更多的努力才能创建出智能的测试代码。
If programmers use TFP, they have to test their code.
如果程序员使用TFP,他们就不得不对代码进行测试。
Add custom code for accessing test data files.
添加自定义代码来访问测试数据文档。
Instead, write a test, then write just enough code to get that test to pass.
相反,您只需编写测试,然后编写足够的代码使其能通过测试。
Listing 6 shows the complete test client code.
清单6展示了完整的测试客户机代码。
Listing 2 shows the complete test client code.
清单2展示了完整的测试客户机代码。
This means that vendors can test code that has not yet been shipped.
这意味着供应商可以测试尚未发布的代码。
I ran the test and implemented code to make the test pass.
运行这个测试案例并实现代码使测试通过。
You write enough code to make the test pass.
编写足够的代码,使测试通过。
To add a new batch item, I use the following test code.
使用以下测试代码添加新的批处理条目。
The updated test code is shown in Listing 6.
更新后的测试代码如清单6 所示。
Write your test code for the model.
为模型编写测试代码。
A test suite for legacy code begins with a single test.
遗留代码的测试套件首先开始于一个单独的测试。
应用推荐