0% found this document useful (0 votes)
53 views

1 Selenium

Selenium is a tool for automating web application testing. It allows recording and playing back tests that simulate user interactions like navigation and input. Selenium IDE is a Firefox plugin that makes it easy to record tests without coding. Tests are stored as HTML files that can be executed via a TestRunner to automatically validate a web app. The document provides an overview of Selenium and demonstrates creating a simple test suite and using the TestRunner to execute the tests.

Uploaded by

sachingn
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views

1 Selenium

Selenium is a tool for automating web application testing. It allows recording and playing back tests that simulate user interactions like navigation and input. Selenium IDE is a Firefox plugin that makes it easy to record tests without coding. Tests are stored as HTML files that can be executed via a TestRunner to automatically validate a web app. The document provides an overview of Selenium and demonstrates creating a simple test suite and using the TestRunner to execute the tests.

Uploaded by

sachingn
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 17

Selenium Tutorial

What is Selenium? runs in your Javascript framework that

web-browser supported

Works anywhere Javascript is Hooks for many other languages Java, Ruby, Python Can simulate a user navigating through
pages and then assert for specific marks on the pages start using it right away

All you need to really know is HTML to

Where to get it?

You can use Selenium-Core and


customize everything

But it is easier to just get a Firefox


used and then play back those recordings followed by asserts www.openqa.org/selenium/

plug-in Selenium-IDE that helps you record test cases

You can record how an app is being Get everything at:

The root of web application you want to test

Selenium IDE
The list of actions in the actual test case to execute

The log of the events that were executed, including any errors or warning that may have occurred

Selenium IDE
Execution Commands

Record test actions

Try the test in the Web based TestRunner


Reference of the currently selected command
Specify commands, including asserts

Test Creation Demo

Create test case to log into the


gallery gallery

Create test case to log out of the

Start Pixory Connect to the Server

Go to the Login Screen Hit the Record Button

Type in Username and Password IDE should update Hit record again to stop

Hit submit

Add assertTextPresent and type the text to search for

Hit play to make sure your test is successful

Creating a Test Suite


<html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> <title>Demo Test Suite</title> </head> <body> <table id="suiteTable"> <tbody> <tr><td> <b>Demo Test Suite</b> </td></tr> <tr><td> <a href="./testLogin.html">TestLogin</a> </td></tr> <tr><td> <a href="./testLogout.html">TestLogout</a> </td></tr> </tbody> </table> </body> </html>

A Test Suite in Selenium is just an HTML file that contains a table of links to tests

Executing the Test Suite

Selenium Core is a collection of Javascript and HTML with iFrames Due to security concerns Core must
be deployed within the same server as the application being hosted The simplest way to run Pixory is to just run the Java application and let it use its own server Problems using Core with Pixory Selenium IDE is a plug-in for Firefox and thus can go around these restrictions

Running the Test Suite

We basically want to execute the test


suite using the Selenium IDE plug-in TestRunner.html

chrome://selenium-ide/content/selenium/TestRunner.html? baseURL=<BASE>&test=file:///<TEST SUITE FILE>&auto=true

chrome://selenium-ide/content/selenium/TestRunner.html? baseURL=http://localhost:8081 &test=file:///Users/ms333/projects/classes/running/v_and _v/hw3/selenium/test/TestSuite.html&auto=true

Test Suite

Test Suite
Test Cases

Execution Control

Steps of the test case

Application being tested

Test Runner Control

Test Runner Control


Run Selected Test Run All Tests Highlight Elements in the Execution View the DOM of the current Page being tested Pause/Pl ay Executio n Step through Execution Control Speed of Execution Summary of the Test View the log of the current execution

TestRunner Demo

Execute Tests created inside the


Firefox TestRunner

You might also like