Skip to main content

Run Unit tests using DBTest library

Sybase IQ columnar analytics database uses DBTest as Unit test library.
Following are the steps to use it:
$ cds
$ cd testlib
$ vi xyz.tst #Write the dbtest.
$ dbtest -y xyz.tst #Checks for syntax errors in the tst file.
$ vi my.bch #Enter in the first line "xyz.tst"
$ vi xyz.op #This is the output file whose contents are compared with the actual run-time output of the test.
$ cd ..
$ cmake debug64
$ cdp (test directory)
$ setup current debug64
$ run_saint_testlib.sh -port xxxx -newdbonerror my.bch #This run the tests

If test fails then
$ vi xyz.ot #Check out the errors.
$ vi xyz.tst #Correct the errors and rerun the test.

Use dbtest command to run your tests:
  1. On terminal 1, run commands:
    $ setenv IQTMP `pwd`
    $ setenv IQTMP15 `pwd`
    $ setenv ASTMP `pwd`
    $ runsrv abc abcd.db, OR $iqsrv15 -n abc abcd.db -zr all -gd all -gl all -c 32m -ch 200m -x "tcpip(port=xxxx)"
  2. On terminal 2, run commands:
    $ setenv IQTMP `pwd`
    $ setenv IQTMP15 `pwd`
    $ setenv ASTMP `pwd`
    dbtest -ds -m1 xyz.tst > xyz.ot
  3. To connect to an IQ database server, either set environmental variables or specify following command in .tst file:
    stringconnect "uid=dba;pwd=sql;eng=abc;links=tcpip{host=m/cName;port=xxxx}"

Comments