Command-Line Interface for Unit Testing

In addition to running unit tests and suites, and exporting and importing unit test objects, within the SQL Developer graphical interface, you can use the ututil batch file (Windows) or shell script (Linux) on the operating system command line. ututil is located in the sqldeveloper\sqldeveloper\bin folder or sqldeveloper/sqldeveloper/bin directory under the location where you installed SQL Developer.

ututil.bat or ututil.sh accepts these commands: run to run a test or suite, exp to perform an export operation, and imp to perform an import operation. For detailed information about the syntax and options, start by running ututil without any parameters at the system command prompt. For example:

C:\Program Files\sqldeveloper\sqldeveloper\bin>ututil
 
ututil -run ?
ututil -exp ?
ututil -imp ?

Then enter the command for information about the command that you want to use. For example: ututil -run ?

The ututil -run command includes the following parameters:

The following example runs a unit test named AWARD_BONUS in a Windows environment where SQL Developer is installed under Program Files. (Note that test and suite names are case sensitive for the command-line interface.) This example uses the repository connection for user unit_test_repos and runs the test as user fred.

> cd c:\Program Files\sqldeveloper\sqldeveloper\bin
> ututil -run -test -name AWARD_BONUS -repo unit_test_repos -db fred

The following example exports a unit test named AWARD_BONUS. It uses the repository connection for user unit_test_repos and stores the exported definitions in the file C:\ut_xml\award_bonus_test.xml.

> ututil -exp -test -name AWARD_BONUS -repo unit_test_repos -file c:\ut_xml\award_bonus_test.xml

The following example imports object definitions from the file C:\ut_xml\award_bonus_suite.xml. It uses the repository connection for user unit_test_repos.

> ututil -imp -repo unit_test_repos -file c:\ut_xml\award_bonus_suite.xml

To check the results of any tests or suites that you run from the command line, you can start SQL Developer and view the All Test Runs and All Suite Runs reports (see Unit Test Reports).

Related Topics

SQL Developer: Unit Testing