Forum Discussion

elysialock's avatar
elysialock
Occasional Contributor
10 years ago

XPath Match Configuration window Declare button not working

Perhaps I'm doing something incorrectly, but the "Declare" button in the Xpath Match Configuration dialog does not seem to be working for me in SoapUI Pro v5.1.1 in OSX 10.9.4. I have a default project (that is to say not a SOAP or REST project). Here are the steps I am following to reproduce. I am able to reproduce 100% of the time.
1. Create a simple GET or POST request test step, and run that test step to get a response.
2. Add an assertion using the Add Assertion button.
3. Select XPath Match.
4. In the XPath Match Configuration dialog, click the "Declare" button at the top.
Expected result: an xpath declaration is created in the top box using the response data.
Actual result: nothing happens, no text is prefilled in the upper box.

-Elysia Lock

9 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    Is your response contains any namespaces? Possible to post the response? And have you tried providing your valid xpath and click on "Select from current Test" button? what happens?
  • elysialock's avatar
    elysialock
    Occasional Contributor
    The issue lies in the auto-generation of the declaration, not in the response or my ability to view it. When I manually type the correct Xpath selector, and then I click the button to select from the current response, that part works just fine. It's not a big bug, but it does save me some time to automatically generate the declaration and then just update the namespace to whatever I'd like.

    Here is a sample response if that helps, but I'm finding this is the case across the board for all responses.

    <public>
    <links>
    <link rel="self" href="http://dev.company.com:8080/web-rest/webapi"/>
    <link rel="authenticated" href="http://dev.company.com:8080/web-rest/webapi/authenticated"/>
    <link rel="authenticate" href="http://dev.company.com:8080/web-rest/webapi/authenticate"/>
    <link rel="logout" href="http://dev.company.com:8080/web-rest/webapi/logout"/>
    </links>
    </public>
  • nmrao's avatar
    nmrao
    Champion Level 3
    Coming to the topic "XPath Match Configuration window Declare button not working". I believe that if the response contains declare button would show the name spaces and the response does not associated with name space nothing happens on declare button. So, I guess it helps.
  • elysialock's avatar
    elysialock
    Occasional Contributor
    I'm not sure I get what you are saying nmrao. The response does not have a declare button... Unless I'm missing something. The declare button is a SoapUI feature in Xpath assertions.
  • nmrao's avatar
    nmrao
    Champion Level 3
    Understant that you are on the same screen as attached.
  • elysialock's avatar
    elysialock
    Occasional Contributor
    Yep, that's it. I know when I was using the not-Pro version of SoapUI I'd click that Declare button and it would pre-fill the top box with a pre-formatted declaration with ns1 as the namespace... Or maybe my memory is failing me.
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    I see that you are using a REST webservice, I would suggest you to use Json path since namespaces can be ignored in json. Also I will try to reproduce the issue.

    Thanks,
    Jeshtha
  • elysialock's avatar
    elysialock
    Occasional Contributor
    So... what if I need to use a wildcard in my assertions then? Say, for example, I have a test that sends user credentials and the response returns a username. I set the username as a project-level property, which means I can vary the username from test run to test run. I may first choose to run the test with userA, then again with userB. With my understanding of JSON assertions, I'm not sure how to

    In the past, I used XML assertions to check for the presence of that element (username) without checking for the specific username by using a wildcard for the <username> field, like this:
    <response>
    <color>red</color>
    <username>*</username>
    </response>

    SmartBear Support wrote:
    Hi,

    I see that you are using a REST webservice, I would suggest you to use Json path since namespaces can be ignored in json. Also I will try to reproduce the issue.

    Thanks,
    Jeshtha
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    This is a very good feature request. We have logged a feature request SOAP-2742. We will try to prioritize this request.

    Thanks,
    Jeshtha