In one of my previous posts i wrote that i was going explain how i set up a very simple test automation framework using selenium builder, well here goes!
These instructions are for windozzzzz by the way!
First thing you going to need is firefox and the selenium builder plug in. Once you have these installed you can record you first script, instructions on how to do this are here.
Next we need to grab Se Interpreter, this will allow us to run our new script created using selenium builder via the cmd line.
Create a new folder and pop in the files you downloaded for Se Interpreter into it, then also pop in this folder the script you created using the selenium builder.
Now we want to run our recorded script from the cmd line, to do this your going to need to run a cmd from the folder you have you script file and your Se-builder files in. The cmd should look something like this:
java -jar SeInterpreter.jar <path_to_script.json>
If you run this you will see firefox start up the script will run and then Firefox will close. You should see the logging in the cmd window, this will tell you whether the test passed or failed.
The next step is to get a log file created when you run a script, if we are going to be scheduling and running these tests we will need to check the log files after the test run to check our results.
We are going to need to add something to the cmd line in order to this:
java -jar SeInterpreter.jar <path_to_script.json>>C:\Path to logfile\MyLog.log 2>&1
If you now run this you will get a log file created in the folder you stipulate in the cmd above with the name you have given the log.
You can also create a test suite file, this has details of individual test files in it. This means that you can run a bunch of scripts but you only have to tell selenium interpreter to run one test suite file. You just have to switch the script name in the cmd to the test suite file and let the tool do the rest. In your log file you will get the results of each script that is run (The ones you have stipulated in your test suite file).
Now we have the scripts and our cmd line sorted we need to schedule the scripts to run at a certain time. I like my scripts to run over night against the latest development build so i can check the next morning how the build did. I am running my test on windows so i created a bat file using the cmd line and scheduled this to run at 11pm each weekday night. I could have used the windows scheduler to do this but i found that it ran the scripts in headless mode (You could not see firefox opening up when the scripts were running on the desktop) This caused me a problem as some of my scripts tested pop up error messages and these need the browser gui to be open. The free tool i used to do this is here.
You can add more test scripts and add them to your test suite and these will then get run at the time you have scheduled. You can also add more suites to the bat file as new lines e.g.:
java -jar SeInterpreter.jar <path_to_test_suite1.json>>C:\Path to logfile\MyLog1.log 2>&1
java - jar SeInterpreter.jar <path_to_test_suite2>>C:\Path to logfile\MyLog2.log 2>&1
Each one of these lines will create its own log file for you to use to check the results.
There you have it, possibly the easiest automation frame work possible and you can get something like this set up in a few hours or less then extend it as you think of more tests!