1

I'm trying to do Webservices Testing using QAF 3.0 Below is my BDD for the Test.

Scenario: [WS-2]_[222-xml]_Sample XML Webservices
    When I request api "get.mock.xml.menu"
    Then I check api response status code is "200"
    And I check api response status is "OK"
    And I check api response should have xpath '/breakfast_menu'

First three lines are executing without any issues. Internally I'm calling QAF WsStep.

Note: Json path verification is working perfectly without any issues.

StepDef:

@QAFTestStep(description = "I check api response should have xpath {xpath}")
public static void iCheckApiResponseShouldHaveXpath(String xpath) {
    WsStep.responseShouldHaveXpath(xpath);
}
user861594
  • 5,733
  • 3
  • 29
  • 45
Renish
  • 165
  • 6
  • Belgian Waffles $5.95 Two of our famous Belgian Waffles with plenty of real maple syrup 650 Strawberry Belgian Waffles $7.95 Light Belgian waffles covered with strawberries and whipped cream 900 – Renish Jan 09 '21 at 19:18
  • Try `//breakfast_menu`. You should check command log in qaf report and share request response details from command log. – user861594 Jan 09 '21 at 19:29

1 Answers1

0

In your case breakfast_menu is root node, so it will be consider as context (root) and will be accessible as .. You should be able to use following xpaths:

.
./food
//food
./food/name
./food[name='Belgian Waffles']
//food[name='Belgian Waffles']
//*[name='Belgian Waffles']
user861594
  • 5,733
  • 3
  • 29
  • 45