How to use html test suite and cases on Selenium RC

References

Since 2009, I have used Selenium IDE and core. I love Selenium IDE. It is easy to use and is very handy as I can record test cases and also run them one by one by clicking on each. A colleague of mine used Selenium RC with C# but it did not impress me much because he started RC server first, then executed NUnit to lanuch the test suite. Also, I did not like coding in C# selenium test cases. How simple and elegant those html test caes are!

Then today, a bit shame to say, I realised I can use html test suite on Selenium RC. Oh how fantastic it is. My scrum team had scores of accumulated html test cases, and I can use them without any alteration.

First, let’s see how to install Selenium RC

  1. You download Selenium RC from http://seleniumhq.org/download/
  2. Unzip it into local hard drive, for example, c:\Selenium. Because Selenium RC is written in Java, you need to install java runtime if you do not have it.

selenium-server.jar is the main engine that runs test suite. You can run it on command prompt, but it is very handy to create a batch file to run it as the above reference link showes it.

For IE

cd \
cd C:\Selenium\selenium-server-1.0-beta-2
java -jar selenium-server.jar -port 4545  -htmlSuite *iehta "http://www.sekyee.com" "C:\Selenium\Test_Suite.html" "C:\Selenium\Results.html"
pause

For firefox


cd \
cd C:\Selenium\selenium-server-1.0-beta-2
java -jar selenium-server.jar -port 4545  -htmlSuite *chrome "http://www.totaljobs.com" "C:\Selenium\Test_Suite.html" "C:\Selenium\Results.html"
pause

A simple selenium-server.jar usage is like this.
selenium-server.jar -port {your port number} -htmlSuite {firefox or ie} {base url} {absolute path for your test suite} {absolute path for your test result file}

I’m not sure why * is required befire iehta, yet without the *, it does not find testsuite. Also, Results.html must exist before you run this even though it is an empty file.
I find {base url} very handly, so you can put relative path in your test cases. This enables you to use the same test cases to test on different environments such as Dev, Int, Staging, and Live.

Hoep this helps

How to use html test suite and cases on Selenium RC

15 thoughts on “How to use html test suite and cases on Selenium RC

  1. andrea says:

    can you help me load my test cases from selenium IDE to Selenium RC….Im a new software tester, and i believe selenium will truly help me to lessen my testing burden..thanks..

  2. Very helpful simplelifeuk, thank you!
    I ran into all sorts of problems trying to use the test runner with just the .hta because our test/staging/production sites are on an SSL socket.
    running the test suites with selenium-rc was the answer.

    Appreciate it.

    Larry

  3. blakdreem says:

    Hi,
    I am doing exactly as you suggest here ( well actually i am using an Ant script ) but i am launching selenium RC with an html suite – all seems great until the test runner is launched, then it only runs the first test script. Then i just waits on me to run the rest.
    Have you found the same – do you know how to get the RC to run all scripts in the suite automatically

    many thanks
    blakdreem

  4. I had the same problem. The problem was that my files did not have a .html extension. To fix it I renamed all the testcastes and the testsuite adding the .html extension.

    Hopefully this will solve your problem

    Stein

    1. Kevin says:

      Wow!! I knew it was something simple besides me!

      I was stuck on this “only runs the first test case” problem for hours late into the night. Then i found this post about the html extension.

      Thanks Stein for taking the trouble to post this.

      Kevin

      1. Skip Huffman says:

        Thanks for that. I have been chasing the missing html extension for hours.

        I am usually a unix guy and I don’t tend to think of extensions as significant. This NEEDS to be spelled out in the documentation. (or better yet fixed in the code.)

      2. Skip Huffman says:

        I have also entered this as defect 1208 on Selenium’s bug tracker on code.google.com Feel free to add comments.

  5. dinesh garg says:

    Hi All,

    Can somebody tell me, how to use selenium-rc, i have succeeded to open the selenium framework bu not able to understand how to record test script and how to run it.

    please help.

  6. Yogesh says:

    Hi..

    I am using selenium IDE to record n run the test cases. But the problem I am facing that I am stuck at one point when running the recorded test case.. It is to select a radio button and the error I am getting is .. I have also changed the command from ‘click’ to ‘clickandwait’, but its not working.

    If anybody can help in this regard, Please Advise…

  7. logiclife says:

    I’m trying to run an html testSuite with Selenium RC. The browser starts, the first test runs, and it stops. It doesnt continue to the second test case. I named both the test cases with .html extension and also the test suite as suite.html. IAm using Firefox 3.6

    If i run them manually , individually from the selenium RC test runner window they run ok. what am i missing, this seems pretty simple but yet iam not able to get this working.

    Iam using selenium RC 1.0.3

    command here java -jar selenium-server.jar -firefoxProfileTemplate “C:\Users\sicky\AppData\Roaming\Mozilla\Firefox\Profiles\zvt0jj7c.default” -htmlsuite “*firefox” “https://4.17.8.9/” “C:\Users\sicky\Documents\selenium scripts\suite.html” “C:\Users\sicky\Documents\selenium scripts\results.html”

    What am i missing? Pls let me know

    1. anshul says:

      HI

      Change the file suite.html and in place of names of the test as test replace it with test.html…that should solve ur problem

  8. Mani says:

    Hi,
    I have one issue . test case , test everything ok, but while sending email notification of test is it possible to receive html report page as a link in mail, so that i can view from there( the report page of current testcase). Is there any options to do this?
    Thanks in advance,
    By
    Mani

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s