In rare cases, don't write a test at all and come back to it later.
在很少情况下,根本不编写测试,放到后面编写。
In some rare instances, I just can't figure out how to write a test at all.
在少数情况下,我恰好根本想不出如何编写测试。
Even though I haven't written a lick of code yet, it's time to write a test.
即使我还没有编写一丁点代码,但也该编写测试了。
If I find I can't write a test first after trying to do so, I back into the test.
如果发现在尝试先编写测试之后,仍不能先编写测试,那么回到测试中来。
When fixing a bug, first write a test that fails because of it, then fix the bug.
当修正bug的时候,先要写一个能针对它的测试,然后再修复bug。
Continuous Testing: Before programmers add a feature, they write a test for it.
连续测试:在程序员增加一项特征前就完成测试程序。
The mantra for coding TDD is: "What is the simplest thing for which I can write a test?"
编写TDD的信条是:“可以为其编写测试的最简单内容是什么?”
Accordingly, I can write a test case to verify XMLUnit's behavior, as shown in Listing 6.
相应地,我可以编写测试用例来验证XMLUnit的行为,如清单6所示。
Write a test for the withdraw() method on Account. Your test should now look like Listing 6
为Account 的withdraw()方法编写一个测试。
NUnit lets you write a test case in the same language and environment as your application.
Nunit允许你用与应用程序相同的语言和环境来写测试用例。
JUnit has a bit of this pattern language approach, because it can help you write a test case.
JUNIT使用了一点模式语言的方法,因为它能帮你写一个测试用例。
When we find bugs, we write a test case to expose the bug and add it to the suite prior to fixing it.
当我们发现错误时,我们编写测试案例来找到错误并在修正此错误之前将其添加到套件中。
Write a test report for each API you ve tested. The template of the report is given in Appendix iv below.
对你测试过的每一个API编写测试报告。测试报告的模板请见附录IV。
The first thing to do is write a test for the simplest possible transfer behavior, such as the code in Listing 4.
我们要做的第一件事就是为最简单的转帐行为写一个测试,比如清单4中的代码。
At this point, the DLL will compile and link, so one could write a test program to use the Sample API and test it.
此时将编译和链接dll,因此可以编写测试程序来使用ExampleAPI并对其进行测试。
You don't have to write a test for every single method you write, only production methods that could possibly break.
你不必为每个方法都编写测试程序,只需为那些可能会发生变化的方法编写测试程序就够了。
The key is to write a test that will fail if the aspect misbehaves or does not apply to the join points you intend it to.
关键是编写一个当方面行为错误或者没有应用到希望它应用的联结点处时会失败的测试。
Perhaps the rationale for this is that, by knowing who the owner is, you can gently prod that person to write a test case.
也许它的基本原理是,通过了解所有者是谁,您可以温和地让此人书写测试用例。
You want the test to verify that the elements List now holds the Object added by push. So, you write a test like this
您需要进行这一测试来验证elementsList现在是否含有 push添加的Object。
This pattern is very simple: write a test against your system as you would if the behavior were not implemented with aspects.
这个模式非常简单:就像行为没有实现方面那样为系统编写一个测试。
Next, you want to write a test that verifies not only that the output is present, but that it's correct. There are two ways you can do this
接下来,您想要编写一个测试,不仅要验证输出得到了显示,还要验证输出是正确的。
Write a test that fails We selected the test that seemed the easiest to implement (although in this case they were all simple) and wrote it.
写一个失败的测试:我们选择了一个最容易实现的测试(虽然在这个例子中所有的都很简单)来实现。
Your first thought could be that it's time to refactor, but doing so would break the first rule of refactoring, which is to write a test case.
您首先想到的可能是:到重构的时间了,但这样做将打破第一个重构规则,即将编写一个测试用例。
After checking with Wikipedia to find the first few perfect Numbers, I can write a test that verifies that I can in fact find perfect Numbers.
在Wikipedia上查找到前几个完全数之后,我可以编写一个测试,它检查实际上是否可以找到完全数。
Before attempting to write a test for the code in Listing 1 (and indirectly Listing 2), you might want to ascertain what exactly requires testing.
在企图为清单1(间接的是清单2)的代码编写测试之前,可能想确定实际需要测试什么。
This "write a test, write just enough code to get it to pass, rerun the test" approach is the xp development flow that you should experience every day.
这种“编写一个测试,编写足够的代码来使测试通过,重新进行测试”方法是您每天都在经历的XP开发流程。
As an example, I'll write a test that simulates a user selecting the second element in the combo box at row 0. The actions for the test to perform are.
为用作示例,我将编写一个测试,模拟用户选择0行处组合框中的第二个元素。
I still want to have a test so I can have the confidence that comes from a full regression suite, but I have to write some code first, then write a test.
我仍然希望进行测试,这样我可以从完整的回归套件中获得信心,但我必须先编写一些代码,然后编写测试。
For example, how do you write a test that simulates a user clicking a dropdown list and then verifies that it is populated with a given list of country names?
举例来说,你应该怎样写测试程序来激活用户点击dropdownlist控件的事件呢?如果用户选择的是国名列表,那么又该怎样验证选中的内容呢?
For example, how do you write a test that simulates a user clicking a dropdown list and then verifies that it is populated with a given list of country names?
举例来说,你应该怎样写测试程序来激活用户点击dropdownlist控件的事件呢?如果用户选择的是国名列表,那么又该怎样验证选中的内容呢?
应用推荐