views:

123

answers:

2

I am using Selenium to do testing, We write our test cases in html files and make test suites out of them, our requirement is to write test cases that are robust enough to change themselves as per the test environments.

for this, I prefer not to enclose specifications such as urls to open, text to search for on screen, etc in the html script itself.

I have come accross a good user-based command extension: storeGlobal while this command does help me a lot, what i want is to give the testers the facility to just change properties file and the testcases would pick up the values from them:

eg: in properties file:

startUrl = "http://www.google.com"

I am aware that due to browser restrictions, javascripts usually do not have access to the file systems, however we are using an hta file not html file to do testing, is it possible to access file through that? how ?

+1  A: 

According to http://www.c-point.com/javascript_tutorial/HTML_Applications.htm you have full access to the file system.

Alex Sexton
+1  A: 

I'm not sure about opening a properties file from within Selenium IDE, but I can suggest some possible alternatives.

You can use Selenium IDE's store* commands to save variables for later use. If you have a test at the beginning of your suite that sets up some variables, any following tests in the suite can use them.

For example, the variable setter test might look like:

storeExpression | http://www.example.com | site
storeExpression | myUsername | username
storeExpression | myPassword | password

Then the following tests in the suite can use these variables:

open | ${site}/login.html
type | id=username | ${username}
type | id=password | ${password}

Alternatively, if you used Selenium RC you have a lot more options. You could have variables in your chosen client code, or use a .properties file like you first suggest.

Dave Hunt
i have thought about that alternative, but its not feasible in my situation, my client requires that i give him just a properties file to modify not an html.
Salvin Francis