problem in SQLUnit

arora
2007-06-22
2013-04-25
  • arora
    arora
    2007-06-22

    hi,
    could anyone pls. tell me about SQLUnit framework to test SPs.
    i've downloaded one jar file from source forge.
    now i hv to write an application which will test my stored proc.
    i've written one class which extends SQLUnit.
    i've written one test file.
    i've made some changes to build.xml
    i'm using eclipse, project contains build.xml and test.xml
    java file contains the following code...
    public static void main(String[] args) {
    junit.textui.TestRunner.run(suite());

    // Instantiate SQLUnit
    SQLUnit sqlunit = new SQLUnit("sqlunit");
    try {
    sqlunit.setTestFile("path/to/test.xml");
    sqlunit.setHaltOnFailure(false);
    sqlunit.setDebug(false);
    sqlunit.runTest();
    } catch (SQLUnitException e) {
    // report the exception
    }
    }
    i'm getting one exception
    There was 1 error:
    1) testWrapper(net.sourceforge.sqlunit.SQLUnit)
    net.sourceforge.sqlunit.SQLUnitException: Input Test File not specified, specify testfile or fileset.

    could anyone pls. help me ASAP.
    its very urgent.

     
    • Sujit Pal
      Sujit Pal
      2007-06-22

      Hi Nishant,

      Read the docs, they are pretty detailed and are available on the site.

      Also, SQLUnit is built in java, but is not a Java library, so you cannot use it the way you are trying to do. Actually you can, but you will need to read the docs to find out how.

      The way to use it is to build XML test suites. You will find quite a few examples in the test directory of the download.

      -sujit

       
    • arora
      arora
      2007-06-25

      hi sujit,
      yeah i understood.
      now when i'm writing one xml test code to test my Stored proc.
      its just a simple one.
      its about getting emp id on providing emp name.

      my code is like...
      <test name="Getting emp id">
          <call>
            <stmt>{ call X_SEARCH_EMPL(?,?) }</stmt>
                <param id="1" type="INTEGER" inout="out">${@id_emp}</param>
                <param id="2" type="VARCHAR">vishnu</param>
          </call>
          <result>
              <outparam id="1" type="INTEGER">
                  <resultset id="1">
                      <row id="1">
                          <col id="1" type="INTEGER">1003</col>
                      </row>
                  </resultset>
              </outparam>
          </result>
        </test>
      now, its giving me ArrayOutOfBounds exception.
      could u pls. explain why...