variablespasswordsslimfitnesse

Fitnesse - How to define a wiki or slim variable from an environment variable or file?


I have a password token (that changes every few minutes) that I need to pass to my SLIM tests. I can store this token in either a text file or environment variable. But once I have that password saved, I need to get my test cases to see the value. So is it possible to get a value from an environment variable or a file into a fitnesse test case?


Solution

  • You can read a file or environment from your fixture (Java, .Net or ..) code. I created a FileFixture that reads files (sample usage). It may be of use or could provide inspiration...

    The wiki, if it was started after the environment variable was set, could access it as a symbol (i.e. ${MY_PASSWORD_TOKEN}), but I don't expect you need that.

    By the way: if your password token changes that often it might be better/easier to write some fixture code to retrieve the current password directly, instead of first having to store it in an environment variable or file before you start your test.