0

I am trying to add a table of variables and its values in FitNesse suite page, so that it can be used for all my tests.

I am using xmlHtttp tests for SOAP web services and fhoeben/hsac-fitnesse-fixtures (slim) for this.

Is it required to write separate fixtures to add a table?

n-verbitsky
  • 552
  • 2
  • 9
  • 20
botguide
  • 129
  • 1
  • 1
  • 10
  • for example , I have a variable called login in my xml file and i need to get its value in response xml file , how can i define this in fitnesse – botguide Mar 10 '16 at 14:09
  • Sorry, but I don't get what you are looking for. Can you give a more explicit example of the variables and the script tables you would like to use them in? – Fried Hoeben Mar 10 '16 at 19:41
  • Thank you. An example: I have xml request file with nodes bob 4345345623 . In stead of giving values , I need to give variables as below $logname $accno .And then I need to define exact values for these variables in tables in fitnesse wiki , so that fitnesse wiki can take these variables and values from the table and use these values for all the test pages to test we get the proper response xml file. – botguide Mar 10 '16 at 21:40
  • ie , in |show | request| we have xml file with values . But We can have key value pair table , in fitnesses wiki. And |show |response| can give proper response xml file corresponding to request xml file. Hope this clarifies . Thank you – botguide Mar 10 '16 at 21:46
  • Please edit your question to contain this information. Then you can use formatting to make it more clear. To me it is not clear yet how the variables are used in the response. They are used in the request and the system under test then returns a response. This response is generated by the service being tested, not by FitNesse, correct? Have you seen http://fhoeben.github.io/hsac-fitnesse-fixtures/examples-results/HsacExamples.SlimTests.HttpTests.HttpPost2UsingScenarioTest.html, where the 'zip' is an input variable (and there could be more)? – Fried Hoeben Mar 11 '16 at 06:55
  • I m sorry that my description is not so clear . i can try to make it clear. If we consider this xml itself , 10007 , In stead of 1007 , can we have a variable ?. Thank you – botguide Mar 11 '16 at 07:49

1 Answers1

0

Yes you can.

Using a scenario allows us to generate multiple request, only changing certain values.

!*> Scenario definition
!define POST_BODY_2 { {{{
<s11:Envelope xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/">
  <s11:Body>
    <ns1:GetCityWeatherByZIP xmlns:ns1="http://ws.cdyne.com/WeatherWS/">
      <ns1:ZIP>@{zip}</ns1:ZIP>
    </ns1:GetCityWeatherByZIP>
  </s11:Body>
</s11:Envelope>
}}} }

|script|xml http test|

|table template |send request                                                |
|post           |${POST_BODY_2} |to           |${URL}                        |
|check          |response status|200                                         |
|show           |response                                                    |
|register prefix|weather        |for namespace|http://ws.cdyne.com/WeatherWS/|
|$City=         |xPath          |//weather:City/text()                       |
*!

|send request       |
|zip  |City?        |
|10007|New York     |
|94102|San Francisco|

In this example the variable zip is used so the request is sent with either 10007 or 94102.

Fried Hoeben
  • 3,247
  • 16
  • 14