The test class contains two tests: one to authenticate a valid user and another to authenticate an invalid user.
这个测试类包含两个测试:一个是鉴定一个无效用户,另一个是鉴定一个有效的用户。
Add the code shown in Listing 6 to the test class.
添加如列表6所示的代码到这个测试类中。
Paste this code into your test class and save it.
将此代码粘帖到您的测试类,并保存。
To understand how to use this, we need a test class.
为了弄清除如何使用它,我们需要写一个测试类。
You now have your test class available for execution.
您现在已经拥有了可用于执行的测试类。
Now that I have my test class defined I can start developing (and testing) the application.
定义了测试类后,就可以开始开发(并测试)这个应用程序了。
The first option is to move this test class into the integration directory.
第一个选择是将此测试类转移到集成目录中。
Once you have your test class, the real action happens in your test methods.
一旦创建好测试类之后,测试方法中要有实际的动作。
Each time you save the source file, you invoke a parsing of the test class.
你每次保存这些源文件时,便调用测试类的解析。
Listing 3 shows the dictionary application's beginning test class.
清单3显示了字典应用程序的开始测试类。
Optionally the test class name can be changed.
这个测试类的名称可以更改。
The execution model is a bit strange: The test class is reinstantiated every time a test method is executed.
执行模型有点奇怪:每次执行一个测试方法的时候,都要重新实例化测试类。
Finally, the two lines at the bottom allow you to run the tests within this test class by simply running this module.
最后的两行负责在这个测试类内部运行测试,方法是直接运行该模块即可。
The lifecycle of a test class is further illustrated in Figure 2.
图2进一步描述了测试类的生命周期。
Listing 4 shows the test class, again showing the main sections of the test.
清单4显示了测试类,还显示了测试的主要部分。
Observe in the Test pane that the project and test class values are filled in.
检查测试窗格,将看到项目和测试类值已填充。
Optionally the name of the test class can be changed.
测试类的名称也可以修改。
Running this test class produces the expected result
运行这个测试类产生的预期结果
We now we have our test class available for execution in two contexts.
现在,我们可以使测试类在以下两个上下文中执行测试。
When nose looks inside of a test class, it runs methods matching that same regular expression.
当nose 检查测试类的内部时,它运行与同一正则表达式匹配的方法。
Listing 6 a test class for a special Facebook user.
清单6一个特殊的Facebook用户的测试类。
Listing 12 a test class for a polymorphic Facebook user record.
清单12一条多态Facebook用户记录的测试类。
The above listing is a test class which performs basic tests on the feedparser module.
上述清单是实现feedparser模块基本测试功能的测试类。
A simple test class for the polymorphic special Facebook user is presented below.
下面给出一个多态Facebook特殊用户的简单测试类。
To execute the test class, go to the J2EE perspective, Project Explorer view.
要执行测试类,请转到J2EE透视图中的ProjectExplorer视图。
For instance, what will happen if I run the CreateWidgetUATest test class twice in a row?
比如,如果对一行运行两次CreateWidgetUATest测试类会怎样?
Once you have an abstract aspect, create a mock target inside your test class.
有了抽象方面后,在测试类中创建一个mock目标。
The test class contains test fixtures, which are initialized in a setUp function.
测试类中包含测试装置(fixture),它们在setUp函数中初始化。
Your test class now has a protected field called account, and the test method initializes it.
现在您的测试类有一个叫做account的受保护的字段,测试方法对其进行了初始化。
The ScaTestExecutor constructor takes the test class and the name of the test as parameters.
ScaTestExecutor构造函数将测试类和测试的名称作为参数。
应用推荐