Download Hsqldb User Guide
Transcript
Appendix E. Hsqldb Test Utility $Date: 2005/05/27 12:41:50 $ The org.hsqldb.test package contains a number of tests for various functions of the database engine. Among these, the TestSelf class performs the tests that are based on scripts. To run the tests, you should compile the hsqldbtest.jar target with Ant. For TestSelf, a batch file is provided in the testrun/hsqldb directory, together with a set of TestSelf*.txt files. To start the application in Windows, change to the directory and type: runtest TestSelf In Unix / Linux, type: ./runTest.sh TestSelf The new version of TestSelf runs multiple SQL test files to test different SQL operations of the database. All files in the working directory with names matching TestSelf*.txt are processed in alphabetical order. You can add your own scripts to test different series of SQL queries. The format of the TestSelf*.txt file is simple text, with some indentation and prefixes in the form of Java-style comments. The prefixes indicate what the expected result should be. • Comment lines must start with -- and are ignored • Lines starting with spaces are the continuation of the previous line • SQL statements with no prefix are simply executed. • The remaining items in this list exemplify use of the available command line-prefixes. • The /*s*/ option stands for silent. It is used for executing quries regardless of results. Used for preparation of tests, not for actual tests. /*s*/ Any SQL statement - errors are ignored • The /*c<rows>*/ option is for SELECT queries and asserts the number of rows in the result matches the given count. /*c<rows>*/ SQL statement returning count of <rows> • The /*u*/ option is for queries that return an update count, such as DELETE and UPDATE. It asserts the update count matches. /*u<count>*/ SQL statement returning an update count equal to <count> 132