Top Banner
Selenium IDE Overview www.mindqonline.com
32
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Selenium ide1

Selenium IDE Overview

www.mindqonline.com

Page 2: Selenium ide1

2

Selenium Overview Selenium IDE

Introduction

www.mindqonline.com

Page 3: Selenium ide1

What is Test Automation?

A process of writing a computer program to do testing that would otherwise need to be done manually

Use of software to control the execution of tests

Two types of test automation:Code-driven testingGraphical user interface testing

3www.mindqonline.com

Page 4: Selenium ide1

Advantages of Automation Tests perform precisely the same operations each

time they are run, thereby eliminating human error.

Repeatable: You can test how the software reacts under repeated execution of the same operations.

Reusable :You can reuse tests on different versions of an application, even if the user interface changes.

SPEED :Run tests significantly faster than human users.

Cost Reduction :As the number of resources for regression test are reduced.

Better Quality software:Rapid feedback to developers during the development process as a result of frequent regression testing.

4www.mindqonline.com

Page 5: Selenium ide1

Disadvantages of Automation

Proficiency is required to write the automation test script.

Debugging the test script is major issue. If any error is present in the test script, sometimes it may lead to dadly consequences.

Test maintenance is costly in case of playback methods. Even though a minor changes occurs in the GUI, the test script has to be rewritten.

Maintenance of test data files is difficult, if the test script tests more screens or web-pages.

Short iteration or very tight deadline, there is not enough time to build test automation.

www.mindqonline.com

Page 6: Selenium ide1

What is Selenium?A set of tools that supports rapid development of

test automation for web-based applications.

Can be recorded and written as HTML

Support for a number of programming languages: Java, C#, Perl, PHP, Python, Ruby

Cross browsers support: IE, Firefox, Opera, Safari and Google Chrome

Cross platform support: Windows, Linux, and Macintosh.

6www.mindqonline.com

Page 7: Selenium ide1

Selenium Components

Selenium IDE

Selenium RC

Selenium Grid

Selenium2 aka Webdriver

7

< < Selenium Core

www.mindqonline.com

Page 8: Selenium ide1

Selenium IDE Selenium IDE (SIDE) is a complete Integrated

Development Environment (IDE) for building Selenium test case.

Firefox add-on that makes it easy to record, edit, and debug tests.

Provides an easy-to-use interface for developing and running individual test cases or entire test suites.

Can be used to generate code to run the tests with Selenium Remote Control (RC).

8www.mindqonline.com

Page 9: Selenium ide1

Selenium IDE Features Record, playback, edit

Intelligent component identification will use object IDs, names, or XPath as needed

Auto complete for all common Selenium commands

Walk through test cases and test suites.

Debug and set breakpoints

Save tests as HTML, or export as other supported programming languages

Support for Selenium user extensions9www.mindqonline.com

Page 10: Selenium ide1

10

Installing Selenium IDE

Page 11: Selenium ide1

Installing Selenium IDE

11

Two step process:

Step 1. Check if Firefox is installed

1a. If Firefox is not installed on your machine

then Install Firefox

(There is NO IE Version of Selenium)

Step 2. Check if Selenium IDE is installed)

2a. If Selenium IDE is not installed on your

machine then Install Selenium IDE Plug In

www.mindqonline.com

Page 12: Selenium ide1

Is Firefox Installed? Check whether your machine already has a

version of Firefox installed. Go to Start Programs Mozilla Firefox

12www.mindqonline.com

Page 13: Selenium ide1

Check Firefox Version

Click on the Mozilla Firefox

Go to Help About as shown below:

Check the version name

What is your version?

13

Must be Firefox version 3.6.x.x not

4.0.x.x

www.mindqonline.com

Page 14: Selenium ide1

Firefox Installation Open your IE browser (or any other browser) Navigate to Firefox 3.6 download link. Mozilla website will not have Firefox 3.6 download link.

The most current browser version will be presented.

(FF 4.0)

14www.mindqonline.com

Page 15: Selenium ide1

Firefox Installation

15www.mindqonline.com

Page 16: Selenium ide1

Firefox Installation Follow the steps and run the program (Saving into local machine then running is

recommended) If prompted with Security warning, press “Run”

button

16

Save into your local machine. (C:\Downloads)

Run (double click Firefox Setup 3.6) from the location where you downloaded

Ignore Security warning and press “Run” button

www.mindqonline.com

Page 17: Selenium ide1

Firefox InstallationPress Next Check the “I Accept” then Press Next Select Standard, Remove check from “Use Firefox

as my default browser” Press Install button Press Finish button

17www.mindqonline.com

Page 18: Selenium ide1

Is Selenium IDE Installed? Open the Firefox browser window Go to Tools Check whether Selenium IDE

already exist there If you see “Selenium IDE” then you already

having Selenium IDE plug-in installed in Firefox browser.

If not installed then follow the instruction on the next slide

18

Check whether Selenium IDE is

already installed

www.mindqonline.com

Page 19: Selenium ide1

When the Software Installation Window opens select “selenium-ide” (*1)Click Install Now button“Selenium IDE” add-on is installed (*2)Click on “Restart Firefox” button

Installing Selenium IDE

www.mindqonline.com

Page 20: Selenium ide1

In the Firefox browser go to Tools and verify whether “Selenium IDE” is displayed.

Selenium IDE installation is completed.

Installing Selenium IDE

www.mindqonline.com

Page 21: Selenium ide1

21

Recording and Running Selenium Tests

www.mindqonline.com

Page 22: Selenium ide1

Test Case : Login

Test-Case Objective:

Ensure Valid User Login

Expected Result:

1. That Particular index page is loaded

2. Correct username is displayed as part of the greeting.

“Welcome” 22

Steps :1. In the login textbox

type “lname”. 2. In the password

textbox type “password”.

3. Click “Submit” button

4. Verify that a correct user name is displayed

5. Log outwww.mindqonline.com

Page 23: Selenium ide1

Test Script : LoginTest Script Steps:

Login using :

Login Name: lname

Password: password

Click Login button

Highlight “Welcome Admin” text

Right-click and select VerifyTextPresent

Click logout link

23www.mindqonline.com

Page 24: Selenium ide1

Login TestMake sure Record button is ON!Go to the Browser windowLogin using :

Login Name:lnamePassword: password

Click Login button

24

The Record button is ON by default

Login Name: lnamePassword: password

Then click Login button

www.mindqonline.com

Page 25: Selenium ide1

Login TestHighlight “Welcome Admin” text

Right-click and select VerifyTextPresent

Click logout link

25www.mindqonline.com

Page 26: Selenium ide1

Stop RecordingGo to Selenium IDE

Click the red button to STOP recording

All your actions are recorded and displayed sequentially under Command Table Tab

26

Click here to Stop recording

www.mindqonline.com

Page 27: Selenium ide1

What did we accomplish?Test-Case Objective

Ensure Valid User Login

Steps In the login textbox type

admin. In the password textbox type

password. Click Submit button Verify that a correct user

name is displayed Logout

27www.mindqonline.com

Page 28: Selenium ide1

Running Selenium Automated Test

Make sure the Firefox browser is still open

Go to Selenium IDE and click “Play current test case” button

28www.mindqonline.com

Page 29: Selenium ide1

Debugging

Examine the result of the script.

29

Time is needed to validate the login information…

The test must WAIT for the next web page to load before proceeding.

What went wrong?

www.mindqonline.com

Page 30: Selenium ide1

Debugging Tips

Open Selenium IDE through Tools menu, otherwise the IDE may freeze and act unpredictably.

Make sure you substitute click command with clickAndWait command wherever needed.

30www.mindqonline.com

Page 31: Selenium ide1

EditingEditing to add wait time to the script Click the 3rd to last row where ClickA

command is located Modify the command field

Replace “click” with “clickAndWait” command

Re-play the test…

31www.mindqonline.com

Page 32: Selenium ide1

Note:

One Firefox browser window must be open.

Multiple browser windows will confuse Selenium.

Play back every automated test to ensure

expected behavior.

Keep playback in slow mode when debugging.

Placing Browser window and Selenium IDE

windows side by side is a convenient way of

tracking test execution step by step.

32