Showing posts with label Selenium IDE. Show all posts
Showing posts with label Selenium IDE. Show all posts

Thursday, January 27, 2011

Running Selenium IDE Test Suite

Running Test Suite

Test suite prepared in the Selenium IDE can be run in a several way. Look at the Following are 3 methods with the help of which you can run the test suite prepared in the selenium IDE

1. From the Selenium IDE:

a. We can run the designed selenium test suite from the selenium IDE itself. Please refer Building Test Suite in Selenium IDE link which will guide you how to prepare selenium test suite.

b. Open the saved selenium test suite. Click on File > Open Test Suite. This open all your test cases.

c. Click on "Play entire test suite" button (First green arrow button). 

Selenium will run all your test and produces the test results in the "Results" pane.

2. From Selenium RC

We can run the same selenese test scripts by using Selenium RC server.
To run the HTML test suite, we use -htmlSuite command.

-htmlSuite requires you to specify:
The syntax of -htmlSuite command is:
-htmlSuite(browserString, startURL, suiteFile, suiteFile, resultFile)

where,
  • browserString is the browser name ex: "*firefox"
  • startURL is the base URL ex: http://demo.actitime.com/
  • suiteFile - Test Suite file lcation ex:  C:\SIDE
  • resultFile - You need to create a blank html file named results.html and specfify the path of thos file. Ex: C:\SIDE\results.html
Follow these steps to run the suite:

1. Create a HTML file that will keep your test results Ex: C:\SIDE\results.html
2. Oprn a command link
3. move to the selenium-server.jar location Ex: cd D:\selenium-remote-control-1.0.3\
4. Now the -htmlSuite command with required arguments.
Ex: java -jar selenium-server.jar -port 4444 -htmlSuite *firefox, "http://www.google.com" "c:\SIDE\ActiTimeTestSuite.html" "C:\SIDE\results.html"

You will see Test Runner will open and start running your tests in firefox browser

After the test script is done, you can check the test results in the HTML file you provided as argument i.e., C:\SIDE\results.html

Your test results should look like this:

Figure: Test Results




Monday, January 24, 2011

Building Test Suite in Selenium IDE

Test Suite:

A test suite is a collection of test cases which is displayed in the leftmost pane in the IDE. The test suite pane can be manually opened or closed via selecting a small dot halfway down the right of the pane (whic is the left edge of the entire Selenium-IDE window if the pane is closed).

The test suite pane will be automatically opened when an existing test suite is opened or when the user selects the New Test Case item from the File menu. In the later case, the new test case will appear immediately below.

Creating Test Cases:

Before creating a test cases, login to following application and click through the links http://demo.actitime.com/

Now create a test case. To create a test case,
  1. Open Selenium IDE
  2. Go to File menu > New Test Case
  3. Click on "Record" button
    • Open http://demo.actitime.com/
    • Enter Username as "user"
    • Enter Password as "user"
    • Click on "Login" button
    • Once you enter into the application, right click on the firefox box (within the application and select "assertTitle actiTIME - Enter Time-Track"
    • Click on "Stop Recording" button 
  4. Now to save a test case, select File > Save Test Case
  5. Save this test case with name "01_Login.html" into C:\SIDE folder (or any folder you want)
  6. You can debug/verify this test case, by running it.
Similarly record some test cases by clicking on "Tasks" and "Reports" link and assert the page. Save those test cases as "02_Tasks.html" and 03_Reports.html"

Creating a Test Suite:

To create a test suite in Selenium IDE
  1. Go to File menu > New Test Suite
  2. To add the test cases: Go to File > Add Test Case
  3. Navigate to the location of your test case (in our case C:\SIDE)
  4. Select 01_Login.html, click on "Add"
  5. Repeat steps 2-4 for more test cases
  6. To save your test suite, select File > Save Test Suite and name it as ActiTimeTestSuite.html
Your test suite should look like this.

Figure: Test Suite in Selenium IDE


Friday, January 21, 2011

Recording and Running Tests in Selenium IDE

Recording in Selenium IDE

1. Open Firefox
2. Click on Tools menu, select "Selenium IDE"
3. Click on the red record button on the right (as shown in the following figure
Figure: Recording button
4. Browse to google.com and enter "Selenium" in the search box and click on "Google Search" button
5. Click on the first result, which is that of seleniumhq.org
6. Stop the recording by clicking on again the red record button (See the above figure)

You should see something like below once you recording is done.

Figure: Selenium IDE Recorded Scripts

Running Recorded Selenium Test:

To run the above Selenium recorded script you need little modifications. Replace the last command "click" to "clickAndWait" (We will discuss this in later)

To make the above modification, highlight the line, in the "Command" text box, replace the "click" with "clickAndWait" (see the below figure)

Figure: Editing a Selenium Command
Now to run your recorded test, click on "Run current test case" (second Green arrow button)

The IDE should play your recorded test. After the test is complete you should have landed on the selenium page (http://seleniumhq.org/). The IDE after the test run is shown below. In the "Log Section" you can see the various events run by the test. In the table tab you can see that all the rows are green, which means that the test ran successfully.

Also at the bottom left, it will shown number of test cases passed and failed (Highlighted in the below screen shot)


Figure: Selenium Test Result

Monday, January 17, 2011

Selenium IDE Recording Option

Selenium IDE Recording Option

Many firts-time users begin by recording a test case from their interactions with a website. When Selenium-IDE is first opened, the record button is ON by default.

Figure: Selenium "Record" button
 This can be set to OFF as a default with an avilable user extension.

To set OFF follow the below steps.
  1. In Selenium IDE, click on "Options" menu
  2. Select "Options..."
  3. In "General" of "Selenium IDE Options" window, un-check "Start recording immediately on open" check-box
  4. Click on "OK" button.
  5. Close the "Selenium IDE"
  6. Re-start the Firefox
When you open "Selenium-IDE" the record button will be OFF.

Wednesday, January 5, 2011

Installing Selenium IDE

Installing Selenium IDE:

1. Open Firefox browser.

2. Goto http://seleniumhq.org/download/ site.

3. Click on "Download" link for Selenium IDE

Figure: Download Link for Selenium IDE
4. Firefox browser opens with a "Software Installation" page as shown in the following figure. Click on "Install" button

Figure: Selenium IDE Installation Page


5. Restart the Firefox browser.

6. After Firefox reboots you will find the Selenium-IDE listed under the Firefox Tools menu.

Opening the IDE

To open the Selenium IDE, click on "Tools" menu of the Firefox browser, click on "Selenium IDE"

It opens as follows with an empty script-editing window and a menu for loading or creating new test cases.

Figure: Selenium IDE