You can use the mysqltest
language to write your own test cases.
Unfortunately, we have not yet written full documentation for it.
You can, however, look at our current test cases and use
them as an example. The following points should help you get started:
mysql-test/t/*.test
;
terminated statements and is similar to the
input of mysql
command-line client. A statement by default is a query
to be sent to MySQL server, unless it is recognised as internal
command (eg. sleep
).
SELECT
, SHOW
,
EXPLAIN
, etc., must be preceded with @/path/to/result/file
. The
file must contain the expected results. An easy way to generate the result
file is to run mysqltest -r < t/test-case-name.test
from
mysql-test
directory, and then edit the generated result files, if
needed, to adjust them to the expected output. In that case, be very careful
about not adding or deleting any invisible characters - make sure to only
change the text and/or delete lines. If you have to insert a line, make sure
the fields are separated with a hard tab, and there is a hard tab at the end.
You may want to use od -c
to make sure your text editor has not messed
anything up during edit. We, of course, hope that you will never have to edit
the output of mysqltest -r
as you only have to do it when you find a
bug.
mysql-test/r
directory and name them test_name.result
. If the
test produces more than one result, you should use test_name.a.result
,
test_name.b.result
, etc.
--error error-number
. The error number can be
a list of possible error numbers separated with ','
.
source include/master-slave.inc;
. To switch between
master and slave, use connection master;
and connection slave;
.
If you need to do something on an alternate connection, you can do
connection master1;
for the master, and connection slave1;
for
the slave.
let $1=1000; while ($1) { # do your queries here dec $1; }
sleep
command. It supports fractions
of a second, so you can do sleep 1.3;
, for example, to sleep 1.3
seconds.
mysql-test/t/test_name-slave.opt
. For
the master, put them in mysql-test/t/test_name-master.opt
.