Menu

TUI tool, Parameter name support

Anonymous
2004-08-10
2004-08-11
  • Anonymous

    Anonymous - 2004-08-10

    Hi,

    Does the TUI tool properties file support parameter names? Some of my stored procedures actually have 20 parameters but a much smaller subset of that is used in ordinary calls. Do I have to pass all the parameters? is there no way to specify the name-value pairs so that I dont have to pass in all of the parameters?

    Thanks
    Omer

     
    • Anonymous

      Anonymous - 2004-08-10

      Is there a limit to the number of Parameters you can pass to TUI tool in a properties file?

      I have this properties file

      #connection properties used for generating this test
      _connection!driver = com.sybase.jdbc2.jdbc.SybDriver
      _connection!url = jdbc:sybase:Tds:loncmxs1011.uk.net.intra:5100/mrs001wrk
      _connection!user = mrs_liv
      _connection!password = grassy

      #file specified for capturing the output
      _captureFile = test1.txt

      #test name, call and parameter details
      __test!name = Testing mrs_sp_web_dd_sns_fam_get
      __test!call!stmt = {call mrs_sp_web_dd_sns_fam_get (?,?,?,?,?,?,?,?,?,?,?)}

      # First param set, repeat for each param
      ___test!call!param[1]!type = VARCHAR
      ___test!call!param[1]!inout = in
      ___test!call!param[1]!is-null = false
      ___test!call!param[1]!value = 'BNPPAR'

      # Second param set, repeat for each param
      ___test!call!param[2]!type = DATETIME
      ___test!call!param[2]!inout = in
      ___test!call!param[2]!is-null = false
      ___test!call!param[2]!value = 'Jul 15 2004'

      # Third param set, repeat for each param
      ___test!call!param[3]!type = DATETIME
      ___test!call!param[3]!inout = in
      ___test!call!param[3]!is-null = false
      ___test!call!param[3]!value = 'Jul 14 2004'

      # Fourth param set, repeat for each param
      ___test!call!param[4]!type = VARCHAR
      ___test!call!param[4]!inout = in
      ___test!call!param[4]!is-null = false
      ___test!call!param[4]!value = 'CASH'

      # Fifth param set, repeat for each param
      ___test!call!param[5]!type = VARCHAR
      ___test!call!param[5]!inout = in
      ___test!call!param[5]!is-null = false
      ___test!call!param[5]!value = 'CASH'

      # Sixth param set, repeat for each param
      ___test!call!param[6]!type = INTEGER
      ___test!call!param[6]!inout = in
      ___test!call!param[6]!is-null = false
      ___test!call!param[6]!value = 130

      # Seventh param set, repeat for each param
      ___test!call!param[7]!type = VARCHAR
      ___test!call!param[7]!inout = in
      ___test!call!param[7]!is-null = false
      ___test!call!param[7]!value = 'DELTA'

      # Eighth param set, repeat for each param
      ___test!call!param[8]!type = INTEGER
      ___test!call!param[8]!inout = in
      ___test!call!param[8]!is-null = false
      ___test!call!param[8]!value = 130
      # Ninth param set, repeat for each param
      ___test!call!param[9]!type = VARCHAR
      ___test!call!param[9]!inout = in
      ___test!call!param[9]!is-null = false
      ___test!call!param[9]!value = ''
      # Tenth param set, repeat for each param
      ___test!call!param[10]!type = INTEGER
      ___test!call!param[10]!inout = in
      ___test!call!param[10]!is-null = false
      ___test!call!param[10]!value = 0
      # Eleventh param set, repeat for each param
      ___test!call!param[11]!type = VARCHAR
      ___test!call!param[11]!inout = in
      ___test!call!param[11]!is-null = false
      ___test!call!param[11]!value = 'Y'
      # Twelvth param set, repeat for each param
      ___test!call!param[12]!type = VARCHAR
      ___test!call!param[12]!inout = in
      ___test!call!param[12]!is-null = false
      ___test!call!param[12]!value = 'N'

      when I run the tool with it fails giving a null pointer exception and the following output:

      U:\TestEnv\TestFramework>java -Dmode=offline -Drcfile=testprop\module1\test1.properties net.sourceforge.tuisqlunittool.SQLUnitTUITool
      SQLUnit TUI Tool
      Copyright(c) 2003 The SQLUnit Team
      SQLUnitTUITool:_captureFile> test1.txt
      SQLUnitTUITool:_connection!driver> com.sybase.jdbc2.jdbc.SybDriver
      SQLUnitTUITool:_connection!url> jdbc:sybase:Tds:loncmxs1011.uk.net.intra:5100/mrs001wrk
      SQLUnitTUITool:_connection!user> mrs_liv
      SQLUnitTUITool:_connection!password> grassy
      SQLUnitTUITool:__test!name> Testing mrs_sp_web_dd_sns_fam_get
      SQLUnitTUITool:__test!call!stmt> {call mrs_sp_web_dd_sns_fam_get (?,?,?,?,?,?,?,?,?,?,?)}
      SQLUnitTUITool:___test!call!param[1]!type> VARCHAR
      SQLUnitTUITool:___test!call!param[1]!inout> in
      SQLUnitTUITool:___test!call!param[1]!is-null> false
      SQLUnitTUITool:___test!call!param[1]!value> 'BNPPAR'
      SQLUnitTUITool:___test!call!param[2]!type> DATETIME
      SQLUnitTUITool:___test!call!param[2]!inout> in
      SQLUnitTUITool:___test!call!param[2]!is-null> false
      SQLUnitTUITool:___test!call!param[2]!value> 'Jul 15 2004'
      SQLUnitTUITool:___test!call!param[3]!type> DATETIME
      SQLUnitTUITool:___test!call!param[3]!inout> in
      SQLUnitTUITool:___test!call!param[3]!is-null> false
      SQLUnitTUITool:___test!call!param[3]!value> 'Jul 14 2004'
      SQLUnitTUITool:___test!call!param[4]!type> VARCHAR
      SQLUnitTUITool:___test!call!param[4]!inout> in
      SQLUnitTUITool:___test!call!param[4]!is-null> false
      SQLUnitTUITool:___test!call!param[4]!value> 'CASH'
      SQLUnitTUITool:___test!call!param[5]!type> VARCHAR
      SQLUnitTUITool:___test!call!param[5]!inout> in
      SQLUnitTUITool:___test!call!param[5]!is-null> false
      SQLUnitTUITool:___test!call!param[5]!value> 'CASH'
      SQLUnitTUITool:___test!call!param[6]!type> INTEGER
      SQLUnitTUITool:___test!call!param[6]!inout> in
      SQLUnitTUITool:___test!call!param[6]!is-null> false
      SQLUnitTUITool:___test!call!param[6]!value> 130
      SQLUnitTUITool:___test!call!param[7]!type> VARCHAR
      SQLUnitTUITool:___test!call!param[7]!inout> in
      SQLUnitTUITool:___test!call!param[7]!is-null> false
      SQLUnitTUITool:___test!call!param[7]!value> 'DELTA'
      SQLUnitTUITool:___test!call!param[8]!type> INTEGER
      SQLUnitTUITool:___test!call!param[8]!inout> in
      SQLUnitTUITool:___test!call!param[8]!is-null> false
      SQLUnitTUITool:___test!call!param[8]!value> 130
      SQLUnitTUITool:___test!call!param[9]!type> VARCHAR
      SQLUnitTUITool:___test!call!param[9]!inout> in
      SQLUnitTUITool:___test!call!param[9]!is-null> false
      SQLUnitTUITool:___test!call!param[9]!value> ''
      SQLUnitTUITool:___test!call!param[10]!type> INTEGER
      SQLUnitTUITool:___test!call!param[10]!inout> in
      SQLUnitTUITool:___test!call!param[10]!is-null> false
      SQLUnitTUITool:___test!call!param[10]!value> 0
      SQLUnitTUITool:___test!call!param[11]!type> VARCHAR
      SQLUnitTUITool:___test!call!param[11]!inout> in
      SQLUnitTUITool:___test!call!param[11]!is-null> false
      SQLUnitTUITool:___test!call!param[11]!value> 'Y'
      Error: null
      java.lang.NullPointerException
              at net.sourceforge.tuisqlunittool.SQLUnitTUITool.generate(SQLUnitTUITool.java:265)
              at net.sourceforge.tuisqlunittool.SQLUnitTUITool.run(SQLUnitTUITool.java:190)
              at net.sourceforge.tuisqlunittool.SQLUnitTUITool.main(SQLUnitTUITool.java:119)

      Omer

       
    • Anonymous

      Anonymous - 2004-08-10

      sorry there was one less '?' which was causing the problem. now it takes in all the 12 parameters but the problem remains it says null pointer exception

       
    • Anonymous

      Anonymous - 2004-08-10

      Is there anything wrong with specifying the call like this in the TUI tool properties file:

      __test!call!stmt = {call proc_name (@param1_name =value1,@param2_name =value2 .... )}

      If it is fine then what is the reason for going into the detail of specifying the datatype etc for each parameter in the properties file in the first place?

      Thanks
      Omer

       
    • Sujit Pal

      Sujit Pal - 2004-08-10

      No, there is no problem with specifying all the parameters on a single line, but that will cause it not to generate the param tags for your test. Using params sometimes helps in reusing the code generated by cloning similar tests using cut-and-paste.

      But I guess you are right, if you are using a tool to generate your test cases, why bother with cloning using a different method.

      Also if you can check to see if the problem still exists with the new code in CVS, that would be great. The call would be slightly different, you will call:
      net.sourceforge.sqlunit.tools.TUITool instead.

      Sorry about the delay in releasing a new version, I am almost done, I should be able to do one by around the end of this week or mid-next week with all updated documentation.

      -sujit

       
      • Sujit Pal

        Sujit Pal - 2004-08-11

        Sorry, I misunderstood your original question, I dont think there is any problem with passing named parameters in the call, as long as your driver can handle it (and I know sybase can).

        So you could even set 5 of the 20 params like so:
        <sql>
        ..<stmt>{? = call my_proc(@param1=?,@param2=?....}</stmt>
        ..<param id="1" ... />
        ...
        ..<param id="5" ... />
        </sql>

        -sujit

         
    • Sujit Pal

      Sujit Pal - 2004-08-11

      Hi Omer,

      I tried this on the new code for TUITool and I got back a null pointer exception which was caused by the new types system, which needs to be loaded at each invocation of TUITool. I put the call in and it worked. I tried with a stored procedure consisting of 1 input parameter though.

      I dont think there is a DATETIME type defined in java.sql.Types, so if this is supported on Sybase(?), then we need to add support for this and make it work with MMM-dd-yy instead of yyyy-MM-dd.

      -sujit

       

Log in to post a comment.