mtr File Naming and Organization Guidelines

Test case file names may use alphanumeric characters (A-Z, a-z, 0-9), underscore ('') or dash ('-'), but should not start with underscore or dash.
测试用例文件名可以使用字母数字字符(A-Z, A-Z, 0-9),下划线('
')或破折号('-'),但不应该以下划线或破折号开头。

No other special characters are allowed, if used, then an error is thrown and the test run is aborted.
不允许使用其他特殊字符,如果使用,则会抛出错误并中止测试运行。

Test names have traditionally used lowercase only, and we recommend continuing this for tests added to the common repository, though uppercase letters are also supported.
测试名称传统上只使用小写,我们建议对添加到公共存储库的测试继续使用这种方法,不过也支持大写字母。

Test cases are located in the mysql-test/t directory. Test case file names consist of the test name with a .test suffix. For example, a test named foo should be written in the file mysql-test/t/foo.test.
测试用例位于mysql-test/t目录下。测试用例文件名由带有. Test后缀的测试名组成。例如,一个名为foo的测试应该写在文件mysql-test/t/foo.test中。

In addition to this directory, tests are organized in test suites, located in subdirectories under the suite directory. For example, a test named bar under the replication suite rpl may be stored in the file mysql- test/suite/rpl/t/bar.test.
除此目录外,测试组织在测试套件中,位于套件目录下的子目录中。例如,复制套件rpl下名为bar的测试可以存储在文件mysql- test/suite/rpl/t/bar.test中。

In practice, the file would likely be called rpl_bar.test as tests in a suite usually also have the suite name as a prefix. This is just a convention from the time when suites were not supported, and not a requirement for test naming.
在实践中,该文件可能被称为rpl_bar。套件中的测试通常也有套件名作为前缀。这只是套件不受支持时的约定,并不是测试命名的要求。

One test case file can be a collection of individual tests that belong together. If one of the tests fails, the entire test case fails. Although it may be tempting to write each small test into a single file, that will be too inefficient and makes test runs unbearably slow. So make the test case files not too big, not too small.
一个测试用例文件可以是属于一起的单个测试的集合。如果其中一个测试失败,则整个测试用例失败。尽管把每个小测试都写在一个文件中很有吸引力,但是这样做效率太低,并且会使测试运行得慢得令人难以忍受。测试用例文件不要太大,也不要太小。

Each test case (that is, each test file) must be self contained and independent of other test cases. Do not create or populate a table in one test case and depend on the table in a later test case. If you have some common initialization that needs to be done for multiple test cases, create an include file. That is, create a file containing the initialization code in the mysql-test/include directory, and then put a source command in each test case that requires the code. For example, if several test cases need to have a given table created and filled with data, put the statements to do that in a file named mysql-test/include/create_my_table.inc. The .inc is a convention, not a requirement. Then put the following command in each test case file that needs the initialization code:
每个测试用例(也就是说,每个测试文件)必须是自包含的,并且独立于其他测试用例。不要在一个测试用例中创建或填充一个表,并在以后的测试用例中依赖该表。如果您有一些需要为多个测试用例进行的通用初始化,那么创建一个包含文件。也就是说,在mysql-test/include目录中创建一个包含初始化代码的文件,然后在每个需要代码的测试用例中放置一个源命令。例如,如果几个测试用例需要创建一个给定的表并填充数据,那么将语句放在一个名为mysql-test/include/create_my_table.inc的文件中。.inc是一种约定,不是必需的。然后在每个需要初始化代码的测试用例文件中放入以下命令:

--source include/create_my_table.inc

The file name in the source command is relative to the mysql-test directory. Remember to drop the table at the end of each test that creates it.
source命令中的文件名相对于mysql-test目录。记住在创建表的每个测试结束时删除表。

你可能感兴趣的:(mtr File Naming and Organization Guidelines)