1 technology needs to accumulate a few days ago to a flute friend Larabee home to play, just know his flute blowing well is not accidental. Because he really studied, the computer has more than the download of video, tutorials and so on! This really makes me shocked! has been in the company to do technology, but the data can not be tested, and I have collated how much technical information it?
So, with the use of these days of database testing tools Sqlunit build the environment and simple use of the idea of sorting out. Maybe I'll use it again later.
2 environment requirements for rapid environmental construction
1. Sqlunit
2. Apache Ant
Apache Ant Getting Started sample
3. Java
3 compiling into the Sqlunit root directory
The jar file compiled into the release version of the Ant installant test
4 MySQL Connection Test Example
Refer to the Sqlunit-5.0/test/mysql/readme instructions. Because MySQL does not support stored procedures, the following tests are tests that demonstrate non-stored procedures.
4.1 Setting up a database
Create Database Sqlunitdb;use Sqlunitdb;
4.2 Edit connection information in edit Sqlunit-5.0/test/mysql/connectiontest.xml, change to the correct user name and password.
4.3 Copy test target to root directory
CP Connectiontest.xml. /.. /
4.4 Performing Ant-dlog.format=canoo-doutput.file=demotest.xml-dtestfile=connectiontest.xml Sqlunit-flat canoo2html
The results of the test will be made into XML and HTML files, such as the HTML display as shown in the following:
5 Problems and Solutions 5.1 problem:failed to create task or type Sqlunit. Cause:the name is undefined.
The test target should not be added to the Build.xml, and I was using the following test target in the Build.xml, and an error occurred during the call.
<!--test MySQL Data Use cases--
<target name= "Mysql-connection-test" >
<sqlunit testfile= "Test/mysql/connectiontest.xml"
Haltonfailure= "false" debug= "false"/>
</target>
The proper way to perform tests should be to place the test XML file in the Build.xml directory, and then execute the file that generated the test HTML results.
5.2 Build FAILED cannot compile the style sheet to modify the canoo2html_result_transform.xsl file. Note the second line refers to the testresults.xsl file.
5.3 Com.mysql.jdbc.Driver not found in specified Context puts the MySQL connection library into the Lib folder. For example, copy the Mysql-connector-java-5.1.12-bin.jar file directly into the Lib folder.