Home > SQL Developer: Unit Testing > Command-Line Interface for ...
As an alternative to using the SQL Developer graphical interface for to running unit tests and suites, and exporting and importing unit test objects, you can use the command line, which is explained in Command-Line Interface for SQL Developer.
When running a unit test from the command-line interface, you can use the following parameters:
-db <connection name>
specifies the database connection associated with the database user to be used for running the unit test.
-repo <connection name>
specifies the database connection associated with the unit testing repository to be used for running the unit test.
{-log <0,1,2,3>}
specifies the logging level, where:
0 = No logging (the default).
1 = Report the status.
2 = Report the status and error message.
3 = Report the status, error message, and return ID value.
{-return <return id>}
specifies the return ID value, which is used as the primary key in the results table, and which will allow automation tools to query the results from the database.
The following example runs a unit test named AWARD_BONUS in a Windows environment where SQL Developer is installed under C:\. (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:\sqldeveloper\sqldeveloper\bin > sdcli unittest -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
.
> sdcli unittest -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.
> sdcli unittest -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