Documentation Home
MySQL Connector/J 8.0 Developer Guide
Related Documentation Download this Manual
PDF (US Ltr) - 454.6Kb
PDF (A4) - 457.8Kb
HTML Download (TGZ) - 112.2Kb
HTML Download (Zip) - 135.2Kb


Pre-General Availability Draft: 2018-01-15

4.5 Testing Connector/J

The Connector/J source code repository or packages that are shipped with source code include an extensive test suite, containing test cases that can be executed independently. The test cases are divided into the following categories:

  • Unit tests: They are methods located in packages aligning with the classes that they test.

  • Functional tests: Classes from the package testsuite.simple. Include test code for the main features of the Connector/J.

  • Performance tests: Classes from the package testsuite.perf. Include test code to make measurements for the performance of Connector/J.

  • Regression tests: Classes from the package testsuite.regression. Includes code for testing bug and regression fixes.

  • MySQL X tests: Classes from the package testsuite.mysqlx and testsuite.x for testing MySQL X functionality.

The bundled Ant build file contains targets like test, which can facilitate the process of running the Connector/J tests; see the target descriptions in the build file for details. Besides the requirements for building Connector/J from the source code described in Section 4.4, “Installing from the Development Source Tree”, a number of the tests also require the File System Service Provider 1.2 for the Java Naming and Directory Interface (JNDI), available at http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-java-plat-419418.html)—place the jar files downloaded from there into the lib directory or in the directory pointed to by the property com.mysql.cj.extra.libs.

To run the test using Ant, in addition to the properties required for Section 4.4, “Installing from the Development Source Tree”, you must set the following properties in the build.properties file or through the Ant -D options:

  • com.mysql.cj.testsuite.url: it specifies the JDBC URL for connection to a MySQL test server; see Section 6.2, “Connection URL Syntax”.

  • com.mysql.cj.testsuite.jvm: the JVM to be used for the tests. If the property is not set, the JVM supplied with com.mysql.cj.build.jdk will be used.

After setting these parameters, run the tests with Ant in the following ways:

  • Building the test target with ant test runs all test cases by default on a single server instance. If you want to run a particular test case, put the test's fully qualified class names in the test variable; for example:

    shell > ant -Dtest=testsuite.simple.StringUtilsTest test

    You can also run individual tests in a test case by specifying the names of the corresponding methods in the methods variable, separating multiple methods by commas; for example:

    shell > ant -Dtest=testsuite.simple.StringUtilsTest -Dmethods=testIndexOfIgnoreCase,testGetBytes test

While the test results are partially reported by the console, complete reports in HTML and XML formats are provided. View the HTML report by opening build/junit/unitregress/report/index.html. XML version of the reports are located in the folder build/junit/unitregress.

Note

Going from Connector/J 5.1 to 8.0, a number of Ant properties for testing Connecotr/J have been renamed or removed; see Section 4.3.1.5, “Change for Test Properties” for details.


User Comments
Sign Up Login You must be logged in to post a comment.