Skip to content

running test cases.md

Zhang Jian edited this page Apr 4, 2020 · 2 revisions

Unlike the MySQL test framework, you can only run the test cases on a running TiDB or MySQL server.

To run tests, your current working directory should contain two sub-directories: t and r.

  • t: All the test cases are put in this directory. The file suffix should be .test. For example, t/example.test.
  • r: All the expected test results are put in this directory. Result file has the same file name with the corresponding test file, but with a .result file suffix. For example, r/example.result.

Connecting to a TiDB or MySQL server

By default, this test framework connects to a server at 127.0.0.1 at port 4000, with root user and an empty password. If you want to change the default configuration, please explicitly specify the --host/--port/--user/--passwd options.

Example 1, connection to a TiDB or MyQSL server at 127.0.0.1:3306, with user root and empty password:

./mysql-tester --port=3306

Example 2, connecting to a TiDB or MySQL server at 10.0.1.101:3306, with user test and password 123456:

./mysql-tester --host=10.0.1.101 --port=3306 --user=test --passwd=123456

The above two examples run all the tests defined in directory t, compare the server output with the pre-defined expected result in directory r.