Skip to main content

%UnitTest.SQLRegression

Class %UnitTest.SQLRegression Extends %UnitTest.TestCase [ Inheritance = right, System = 4 ]

Extends TestCase. Extend from this class to create a regression test

Parameters

TESTFILE

Parameter TESTFILE As STRING;

Specifies the xml file running the test so it's not reloaded

SQLFILE

Parameter SQLFILE As STRING;

Comma-delimited sql filenames overrides the sql file lookup by specifying which and in which order sql script files are to be tested

REFFILE

Parameter REFFILE As STRING = "reference.log";

Specifies a result file for comparison use

SHOWPLAN

Parameter SHOWPLAN As BOOLEAN = 0;

Set SHOWPLAN=1 to dump the access plans used by each test in the test script. Use this feature when you need to verify plan stability from one release to the next, or when you want to investigate the impact of creating, dropping, or altering an index. Boolean value specifies if comparing sql plan should be executed. Reference plan must exist in REFFILE. Dynamic Sql Plan created in Dynamic SQL test only.

DISPLAYTESTNAME

Parameter DISPLAYTESTNAME = "Test ";

DISPLAYTESTNAME enables you to internationalize the display of the test name, which may be specified after the #### delimiter in the test file, when TIMESCALE is a positive number.

TIMESCALE

Parameter TIMESCALE = 0;

The TIMESCALE parameter enables you to control whether elapsed time information is displayed for each SQL statement, and the number of significant digits used to display the time. This can be used to determine whether significant differences in elapsed time are consumed by any individual query. By default, TIMESCALE="", which will prevent elapsed time information from being displayed at the end of each SQL statement in the test. Setting DISPLAYSECONDS to 1 will display the result in seconds. Setting DISPLAYSECONDS to 10 will display elapsed time in multiples of 10 seconds. Setting TIMESCALE to 0.1 will display elapsed time to the nearest tenth second. By grouping together a set of tests that each take about the same amount of time you can automate the process of determining if any query takes "significantly" more or less time than it did previously.

DISPLAYELAPSEDTIME

Parameter DISPLAYELAPSEDTIME = " executed and fetched in ";

DISPLAYELAPSEDTIME enables you to internationalize the display of elapsed time, when TIMESCALE is a positive number.

DISPLAYSECONDS

Parameter DISPLAYSECONDS = "seconds";

DISPLAYSECONDS enables you to internationalize the spelling of "seconds" in the output of elapsed time when TIMESCALE is a positive number.

Methods

OnBeforeEachTest

Method OnBeforeEachTest() As %Status

Method to clean up before each Test method is executed.

OnAfterEachTest

Method OnAfterEachTest() As %Status

Method to clean up after each Test method is executed.

OnBeforeSqlFile

Method OnBeforeSqlFile(sqlfile As %String) As %Status

Method available to do any work before a Sql File begins execution.

OnAfterSqlFile

Method OnAfterSqlFile(sqlfile As %String) As %Status

Method available to do any work after a Sql File has finished execution.

processDiffFile

Method processDiffFile(ByRef rslt As %Stream)

Method to display incorrect results in a more readable format.

TestDynamic

Method TestDynamic()

Test each line of SQL from SQLFILE using dynamic SQL. If no REFFILE exists, it will be created from the dynamic results and that file will serve as the correct test results. It is up to the test creator to confirm that the expected test results are correct.

TestEmbedded

Method TestEmbedded()

Test each line of SQL from SQLFILE using embedded SQL.

TestODBC

Method TestODBC()

Test each line of SQL from SQLFILE using an ODBC SQL Gateway connection. Requires the existence of the User namespace DSN provided with InterSystems IRIS.

TestJDBC

Method TestJDBC()

Test each line of SQL from SQLFILE using a JDBC SQL Gateway connection.

verifyResults

Method verifyResults(ByRef src As %FileCharacterStream, testName As %String = "") As %Status

Compare dynamic results src against existing reference file