Forum Discussion

alibaba82's avatar
alibaba82
Super Contributor
17 years ago

assertion xpath match

Hello,
Some time it necessary to put an assertion on a value in the response and compare it to some value in either some other response or request. The current assertion wizard is great but it would be helpful if in the 'expected Result' you can specify a XPath and pick any step and value from the testcase.

hopefully my request made sense.
Also, do you have a rough estimate as to when 1.8 is coming out ?

Thanks

Ali

7 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Ali,

    thanks for this idea, it hasen't even occured to me :-).. since you can use property-expansion in the expected content field, you could manually enter something like ${AnotherRequest#Response#...xpath-expression...}, but a wizard would obviously make it easier.. thanks!

    We are planning to release 1.7.2 in 1-2 weeks, the main focus of the release is project/test-management, improved usability (drag-and-drop, etc..), stability and a number of bug-fixes..

    regards,

    /Ole
    eviware.com
  • alibaba82's avatar
    alibaba82
    Super Contributor
    Hello Ole,
    The wizard will be really helpful. In the mean time I tried the properties expansion but I think I am doing something wrong. can you please help.

    In my expected window in the assertion, i have ->

    declare namespace lis='http://services.tvguide.com/v2/ListingPreferenceService';
    ${CreateCustomGrid#Request#//lis:CreateCustomGrid/lis:request/lis:CustomGrid/lis:Name/text()}


    I get the following error when I test the assertion;
    ...comparisonFailure:expected but was

    seems like the xpath is not getting translated property to 'CustomGridName12' which is the value in the request.
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Ali,

    thanks.. I'll check into this.. can you post the entire request you are expanding from? (or mail to ole@eviware.com)?

    A side-note; you can't declare namespaces when using property-expansion, the prefixes in the actual request will be used..

    regards,

    /Ole
    eviware.com
  • alibaba82's avatar
    alibaba82
    Super Contributor
    Request: I want to use the 'name' value from this request to be used in my 'expected window'


     

     
         
           
           
               
               
               
                a345b9a3-213e-40d0-89b2-eb5fba585df0
               
               
                 
                 
                 
                  CustomGridName12
                  false
                 
                 
                     
                      696
      700
      873
                 

                  3
                  2007-05-26T23:10:53-08:00
                  3
                  false
                  false
               

                2007-05-26T23:10:53-08:00
           

         

     
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi,

    thanks.. it should work ok if you specify

    ${Request Step#Request#//lis:Name/text()}

    Unfortunately there is a bug in the XPath Assertion editor window so it will not work there with the "Test" button, but should work when either resubmitting the containing test-request or running the containing TestCase..

    let me know!

    regards,

    /Ole
    eviware.com
  • alibaba82's avatar
    alibaba82
    Super Contributor
    Ole,
    You are right, it does not work with 'Test' but when I run the test case, it works fine. One good feature would be to figure out the 'Xpath' of any element. It would be nice if you could right click on some element and click on 'view Xpath'. This way its much easier to compute XPath