RestFixtureTests.IssueFixes.Issue174

Included page: .RestFixtureTests.SetUp (edit)

script smartrics.rest.test.fitnesse.fixture.HttpServerFixture
check is started true
reset resources database

Issue #174 Using multiple fixtures together


The issue reports that symbols can't be shared across fixtures when .RestFixture is used.

This fixture is a decision table simply used to define four different values in the slim shared map of symbols.
The fixture class allows setting a value and then getting it back:
public class DecisionFixtureTest {
    private String value;

    public void setValue(String value) {
        this.value = value;
    }

    public String value() {
        return value;
    }
}


In this case we define two symbols for URIs (one success and one fail) and two symbols for return code.

decision fixture test
value value?
/resources/0 $foundResourceUri<-[/resources/0]
200 $successCode<-[200]
/resources/99 $notFoundResourceUri<-[/resources/99]
404 $notFoundCode<-[404]


Symbols defined in the above table are then used in rest fixture. This demonstrates that .RestFixture accepts symbols and can resolve them.

Table: Rest Fixture http://localhost:9876
GET
200
Set-Cookie : JID="ABC.${a.y}";
Content-Type : application/xml;charset=ISO-8859-1
Content-Length : 183
Server : Jetty(6.0.2)
<resource>
    <name>a funky name</name>
    <data>an important message</data>
    <nstag xmlns:ns1='http://smartrics/ns1'>
        <ns1:number>3</ns1:number>
    </nstag>
</resource>
let ok_status_code js
response.statusCode
200
GET
404
Set-Cookie : JID="ABC.${a.y}";
Content-Length : 0
Server : Jetty(6.0.2)
no-body
let not_found_status_code js
response.statusCode
404

The fixture above then defines - via "let" command - two more symbols: "ok_status_code" and "not_found_status_code". The two symbols are re-used in a new instaance of the decision fixture test below

decision fixture test
value value?
$ok_status_code 200
$not_found_status_code 404