Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Json Assertor Throwing an error in Bamboo execution

Options
dyarram
dyarram Posts: 9

I have some value assertions in json assertor tool and the test works on my local, but fails in Bamboo with below error. Can someone please help me understand what is missing?

An error occurred while processing an assertion: net.sf.saxon.trans.XPathException: Cannot convert XPath value to Java object: required class is org.w3c.dom.NodeList; supplied value has type xs:string

Comments

  • jakubiak
    jakubiak Posts: 804 admin
    Options

    There were two different issues that got fixed in SOAtest related to that error message - one was fixed in SOAtest 9.10.7 and the other in 9.10.8. What version of SOAtest are you using locally and on your Bamboo server?

    However, that still leaves the question of why the behavior is different between the two instances of SOAtest. It sounds like the call to your service is returning different data in the two environments. I would compare the traffic in both cases to understand what is different. In your local environment you can see the traffic in the Traffic Viewer, and in your Bamboo environment you can view the HTML report which should have the traffic saved in it since the test failed.

  • dyarram
    dyarram Posts: 9
    Options

    We are using 9.10.6 version in Bamboo and 9.10.8 locally. I didnt find any difference in traffic between both versions. I do get a response of 200 and content as well, but it fails at assertion

  • dyarram
    dyarram Posts: 9
    Options

    Can you please suggest an alternative or a workaround to have the tests pass in Bamboo? This is a simple fixed value assertion.

  • jakubiak
    jakubiak Posts: 804 admin
    Options

    It sounds like you are running into the one of the bugs we fixed in 9.10.7 or 9.10.8 when running on your Bamboo server, but you don't see those issues locally since you are running 9.10.8 there. I would suggest that you upgrade to version 9.10.8 on your Bamboo server.

  • dyarram
    dyarram Posts: 9
    Options

    Bamboo instance is shared across multiple teams and it is company approved version.It is not easy for me to upgrade Bamboo version.
    Looks like I may have to remove Json assertor from my tests or find a different assertion other than value assertion

  • jakubiak
    jakubiak Posts: 804 admin
    Options

    I understand. You should be aware, however, that the situation you are in where your server is older than your desktops is not guaranteed to work. Creating tests with a newer version of SOAtest than is on your Bamboo server can result in situations like this one where the tests will not run properly. If your test utilizes new functionality that was added in 9.10.8, it will not run properly or may not run at all on 9.10.6. So I would highly recommend you bring this to the attention of your company - your server really needs to be the same version or newer than what you are using to create the test cases.

    In this particular case, it may be possible to adjust the xpath so it will work in both 9.10.6 and 9.10.8. Can you tell us what the xpath of the failing assertion is and provide a JSON snippet that shows the element being validated?

  • dyarram
    dyarram Posts: 9
    Options

    Yes, I am aware of using an older version on Bamboo, but believe me it is not in my control. I just don't understand why I am not able to use this simple assertion even if it is an older version. Attaching the details . Please help me find a workaround

  • jakubiak
    jakubiak Posts: 804 admin
    Options

    There were a couple of bugs that were fixed and I am guessing you are running into one of them. Thanks for showing the xpath. Can you include a sample of what the JSON looks like?

  • dyarram
    dyarram Posts: 9
    Options

    Attaching Request / Response. We are just validating the last object called "States"

  • dyarram
    dyarram Posts: 9
    Options

    @jakubiak Can you at least provide me the details regarding what the bug is and I will try to figure out a workaround myself?

  • jakubiak
    jakubiak Posts: 804 admin
    Options

    In 9.10.8 SOAtest the default xpath created for a value assertion looks something like:
    /root/states/item[1]/string()
    When you use an XPath like that to find an element in an array in 9.10.6, you get the error that you described. To create an XPath that will work for this case in both 9.10.6 and 9.10.8, click the "Change Element" button in the assertion, choose "Edit XPath manually", and replace "string()" with "text()", so that the XPath looks like:
    /root/states/item[1]/text()

  • dyarram
    dyarram Posts: 9
    Options

    Cool. Thank you!

  • dyarram
    dyarram Posts: 9
    Options

    That solution worked for me. Thanks again!