Menu

Unable to get result from <sql> tag

Help
Ben
2006-10-11
2013-04-25
  • Ben

    Ben - 2006-10-11

    Hello,

    I am somewhat of a beginner to the tool, and I greatly appreciate it.  I have used it successfully with jiffie tests, and am now trying to write some scripts that access database results to compare test results.

    I am using Oracle JDBC drivers, and I chose a query that is very simple and returns a valid result when I use my sql*plus client.

    I am fairly confident that the JDBC drivers are in the classpath, and that my connection parameters and sql code are fine, but I am not confident that I am using the Jameleon syntax properly.  I coded my example based on other forum posts, and on the Jameleon PDF manual (page 26).

    Here is my script:

    ================================

    <jm:testcase xmlns:jm="jelly:jameleon">

      <jm:test-case-summary>Test the database results</jm:test-case-summary>
      <jm:test-case-author>Ben</jm:test-case-author>
      <jm:test-case-level>ACCEPTANCE</jm:test-case-level>
      <jm:functional-point-tested>Database Query</jm:functional-point-tested>

    <jm:ju-session application="dev">
      <jm:sql
          jdbcDriver="oracle.jdbc.driver.OracleDriver"
          jdbcUrl="jdbc:oracle:thin:@dev3:1521:DEV"
          jdbcUsername="USERNAME"
          jdbcPassword="PASSWORD"
          query="SELECT GS_RUN_PURPOSE_CODE FROM CODE_GS_RUN_PURPOSE WHERE GS_RUN_PURPOSE_CODE = 'DRAFT'">
      <jm:ju-assert-equals
          functionId="Validate GS_RUN_PURPOSE_CODE."
          expected="DRAFT"
          actual="${GS_RUN_PURPOSE_CODE}"/>
      </jm:sql>
     
    </jm:ju-session>
    </jm:testcase>

    ================================

    I expect the result to be 'DRAFT' from this query, but I get null... and I am not sure that the query is executing properly.

    My questions:

    * - Is what I am attempting to do a valid feature of Jameleon?
    * - Is there something obviously wrong in my script?
    * - Is there a way to enable more detailed debugging? (I already have trace enabled)

    Thanks in advance for anyone taking a look at my post... I appreciate any input.

    -Ben

     
    • Christian Hargraves

      1. Yes
      2. No
      3. What does the trace output give you? It should return a set of variable names and their values from the sql tag.

      If this doesn't help, try setting the breakPoint attribute to true in your sql tag and running the script in debug mode in the GUI.

       
    • Ben

      Ben - 2006-10-11

      Thank you very much for your response.

      The trace output only gives:

      ============================

      Beginning Session: "net.sf.jameleon.plugin.junit.JUnitSessionTag"

      BEGIN: executing sql SELECT GS_RUN_PURPOSE_CODE FROM CODE_GS_RUN_PURPOSE WHERE GS_RUN_PURPOSE_CODE = 'DRAFT'

      Ending Session: "net.sf.jameleon.plugin.junit.JUnitSessionTag"

      jiffie-gsonline-dev-sql FAILED
      file:/C:/jameleon-test-suite/scripts/jiffie-dev-sql.xml:1:40: <jm:testcase>

      =======================

      I will set the breakPoint to true in the sql tag and run the script in debug mode.  Thank you for the tip.

      -Ben

       
      • Christian Hargraves

        TestResults.xml should give more information.

         
      • Christian Hargraves

        Which version of Jameleon are you using? Are you willing to upgrade to the latest greatest code (I hope to make a release shortly)

         
        • Ben

          Ben - 2006-10-11

          Hello,

          I am using Jameleon ver 3.3-M1.  I would be happy to upgrade, especially if it might help solve this issue.

          Thanks again,

          Ben

           
    • Ben

      Ben - 2006-10-11

      Hello Christian,

      I tried setting the breakPoint to true on the sql tag and running in debug in the GUI, but got the same output as before, and the debugger did not hit any breakpoints.

      I am wondering if there is some low-level driver error that I cannot see through the application.

      1) Can you think of any other ways that I can validate that Jameleon is getting along with my Oracle JDBC drivers?
      2) Is there any additional system-level logging that can be enabled? (I checked the velocity.log file but didn't see anything significant.

      Again, thank you for your time.

      -Ben

       
      • Christian Hargraves

        How about the TestResults.xml log file?

        Can you paste in the console output when run in from Ant and the GUI?

         
    • Ben

      Ben - 2006-10-12

      Hello Christian,

      I changed the config in your log4j.properties to add a new text file appender to dump debug level information to a text file.  Can I email it to you (it has a lot of text in it), or would you like me to post it here?

      The exception caught in the file reads:

      =================================

      Caught exception: org.apache.commons.jelly.JellyTagException: null👎-1: <null> org.apache.commons.jelly.JellyTagException: null👎-1: <null>
          at net.sf.jameleon.TestCaseTag.doTag(TestCaseTag.java:760)
          at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:247)
          at org.apache.commons.jelly.JellyContext.runScript(JellyContext.java:704)
          at org.apache.commons.jelly.JellyContext.runScript(JellyContext.java:668)
          at org.apache.commons.jelly.JellyContext.runScript(JellyContext.java:577)
          at net.sf.jameleon.ExecuteTestCase.runScript(ExecuteTestCase.java:219)
          at net.sf.jameleon.ui.TestCasePane$3.run(TestCasePane.java:297)

      =================================

      Thanks,

      Ben

       
      • Christian Hargraves

        Can you just paste the stack trace you see in TestResults.xml (or the new file you are now appending to)? I believe the log level is set to debug for TestResults.xml as well.

         
        • Ben

          Ben - 2006-10-12

          Hello,

          I posted the stack trace in the previous message:

          https://sourceforge.net/forum/message.php?msg_id=3958684

          Thanks,

          Ben

           
      • Christian Hargraves

        I'm stumped. Try setting debug="true" on your Ant task.

        The latest code in CVS should display the error message, but so should the code that you are using.

         
        • Ben

          Ben - 2006-10-18

          Ok... Problem Solved!

          Even though I was not able to get detailed error information, I approached the problem from a different angle.

          I set up the test on another box with a clean PATH, and everything worked fine.  I think that I had conflicting items in my path on the original configuration.

          At any rate, the test now works, and thank you for your support.

          -BEn

           
          • Christian Hargraves

            Thank you for reporting this. I wonder if you would get a failure message with Jameleon 3.3-M2?

             

Log in to post a comment.