如何:配置数据库单元测试执行。
演练:创建和运行数据库单元测试。
解释数据库单元测试结果。
“测试视图”窗口来运行数据库单元测试。
数据库单元测试文件。
如何:为数据库单元测试设计器创建测试条件。
How to: Create Test Conditions for the Database Unit Test Designer.
而是在测试运行中位于数据库单元测试之前或之后。
Rather, they precede or follow database unit tests in a test run.
可以使用顺序测试按特定的顺序运行数据库单元测试。
You can run your database unit tests in a particular order by using an ordered test.
下表描述了相互作用以形成数据库单元测试的各种文件。
The following table describes the files that interact to form a database unit test.
如果想向此数据库单元测试添加更多功能,则可以编辑其代码。
If you want to add more functionality to this database unit test, you can edit its code.
排除问题:可以详细了解如何排除数据库单元测试的常见问题。
Troubleshoot problems: You can learn more about how to troubleshoot common problems with database unit testing.
可以使用以下键盘快捷键在“数据库单元测试设计器”中导航。
You can use the following keyboard shortcuts to navigate within the Database Unit Test Designer.
介绍在创建数据库单元测试之后如何运行这些测试以查看结果。
Describes how, after you create your database unit tests, you run them to see the results.
此项目中不包括数据库单元测试类,您必须自己添加该测试类。
This project does not contain a database unit test class, which you must add.
创建数据库单元测试后,可以使用几种不同的方法运行这些测试。
After you have created your database unit tests, you can run them by using several different methods.
可以创建数据库单元测试以验证存储过程、函数和触发器是否正常运行。
You can create database unit tests to verify that your stored procedures, functions and triggers are working correctly.
此连接用于在数据库单元测试中的测试脚本之外测试与数据库间的交互。
This connection is used to test interactions with the database outside the test script in your database unit test.
不同的数据库单元测试是否需要访问不同的数据库连接来执行或验证测试?
Do different database unit tests need to access different database connections for test execution or test validation?
如果已有执行验证的代码,则可以将其用于数据库单元测试,而不使用测试条件。
If you already have code that performs validation, you can use it in a database unit test instead of using test conditions.
虽然可以配置测试部署的各个方面,但通常不需要配置它们即可运行数据库单元测试。
Although you can configure aspects of test deployment, you typically do not need to configure them for database unit tests.
如果您只使用数据库单元测试设计器来编写单元测试,则您可能不熟悉测试类的概念。
If you write unit tests only using the Database unit test Designer, you might not be familiar with the concept of a test class.
如果现在运行数据库单元测试,则数据生成计划将在测试运行开始时一次性填充数据库。
If you run database unit tests now, the data generation plan populates the database one time, at the start of your test run.
运行数据库单元测试之前,应使用数据生成器创建切实可行的测试数据,而不必向开发人员公开生产数据。
Before you run database unit tests, you should use a data generator to create realistic test data without exposing production data to your developers.
必须先将包含自定义条件的程序集安装到全局程序集缓存中,然后才能在数据库单元测试设计器中使用该条件。
Before you can use a custom condition in the Database Unit Test Designer, you must install the assembly that contains the condition into the global assembly cache.
此文件存储测试项目的数据库连接字符串,以及其他数据库单元测试配置设置,如命令超时、数据生成文件等。
This file stores the database connection strings for the test project, in addition to other database unit test configuration Settings such as command time-out, data generation file, and so on.
如果我们需要在每次单元测试前将数据库重新设置到一个已知状态,那么测试会相当复杂并且运行速度自然会比我们期望得要慢。
If we had to reset a database to a known state before each unit test, the tests would be quite complex and certainly would run slower than we desire.
例如,虽然某一特定单元测试的数据库连接始终返回相同的硬连接结果,但可能会记录查询。
For example, a database connection for a particular unit test might record the query while always returning the same hardwired result.
估计您每天能编写一个数据库访问类并完成其单元测试,因此,150 个表要用 150天的时间。
You estimate a day to write each database access class and unit test it, so 150 tables at one table per day is 150 days.
单元测试意味着在隔离环境中运行,所以不会运行数据库和Web服务器,最重要的是不会发生与Grails 相关的元编程。
Unit tests are meant to run in isolation, which means that no database is running, no Web server is running, and — most important — no Grails-related metaprogramming occurs.
如果为数据库支撑使用了ActiveRecord,则很可能会用受数据库支撑的测试进行所有的单元测试。
If you're using ActiveRecord for your database backing, you will likely do all of your unit tests with database-backed testing.
应用推荐