fitnessefitnesse-slim

FitNesse: Is it possible to extract information from the response of a test step, and use this value in the next test step


I am wondering that is there any possibility in FitNesse, while executing the test stages, to get a value from the response of a test stage and use this value in the next test stage.

I am using hsac-fitnesse-fixtures and SOAP web services.

For example, we have 3 test stages, and value from the response of the first stage can automatically transfer to the second stage to get the response of the second stage.

When comparing with SOAP UI we have property transfer.

Example below:

We have request XML:

!define POST_BODY_2 { {{{
    <ns1:ZIP>@{zip}</ns1:ZIP>
    </s11:Envelope>
}}} } 

Stage 1:

|check|xPath|//weather:City/text()|@{City}| 

And we get a response XML that contains the city name, as here.

Is it possible to pass this city name as a value to the second test stage?

I.e we have another post XML request !define POST_BODY_3 and to this request can we pass the value (city value) and have the next response XML.

Stage 2 test:

|check |response status|200|  

Solution

  • If you are using SLiM as test system, you can use slim symbol

    $slimSymbol is a "runtime variable" used in SLiM test system. They are defined by using $slimSymbol= symtax in the test case, and the value will only be available in the runtime. Documentation here


    In your case, you are using a decision table in the first test case. So instead of having only one output column, I guess you can do

    #some setup here
    
    | send request |
    | zip | City? | City? |
    | 10007 | New York | $response1= |
    | 94102 | San Francisco | $response2= |
    

    And in the later test case, you can refer to the city names using $response1 and $response2. Note that there isn't {} around the variables.