javafitnessefitnesse-slim

Fitnesse How to acces _root.wiki content in Java


Pretty new to Fitnesse I am trying to figure out how to acces the _root.wiki (where we have all our database properties set) from my java code fixture extended with SlimFixture.

What I tried so far:

What I think might work, but do not want for a reason;

My workaround idea:

Maybe I have it all wrong, but I hope you guys might tell me a way use wiki data in my java fixture code.


Solution

  • I don't believe there is an easy way to get the contents of a .wiki page in your fixture code (at least there is not supposed to be one ;-)).

    Your approach of passing parameters to your fixtures is what I would recommend. But I completely understand that passing many properties in is not very nice. Especially maintaining a large list when the same list is used in many tests in no good.

    What I would recommend that you create a (container) variable, some sort of map/hash, that you first fill with all the properties you need, and then pass that to your fixtures. In that way you only have to pass a single variable to tests and adding/removing properties does not affect how you call your fixtures. The variable is a slim variable which can be modified at runtime.

    In my fixtures project I created a MapFixture and MapOfMapsFixture that allow you, besides checking the contents of a map, to manipulate the context of a map to define such a variable. What properties to put into it can then be defined in a (Suite)SetUp or by scenarios. The project also contains sample pages showing usage of MapFixture of MapOfMapsFixture.

    For example in a SetUp page:

    |script     |map fixture                |
    |set value  |user   |for       |username|
    |set value  |secret |for       |password|
    |$dbProps=  |copy map                   |
    

    And then in the test page itself:

    |script |database test |
    |connect using|$dbProps|