JMU
ECMAScript/JavaScript System Testing
Using Selenium-IDE


Prof. David Bernstein
James Madison University

Computer Science Department
bernstdh@jmu.edu


Getting Started
Test Cases and Tests/Test Suites
The Process
  1. Start Firefox
  2. Start Selenium-IDE by clicking on images/selenium-ide-logo.gif in the toolbar
  3. Create (or record) one or more test cases
  4. Save each test case
  5. Save the test suite
  6. Play the test suite
Test Cases
Locators (i.e., Locating Elements in a Document
Important Commands
An Example Test Case

Based on the BMI Calculator Click here for a demonstration.

ecmascriptexamples/systemtesting/normal.html
        <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="https://w3.cs.jmu.edu/" />
<title>normal</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">overweight</td></tr>
</thead><tbody>
<tr>
        <td>open</td>
        <td>https://w3.cs.jmu.edu/bernstdh/Web/common/lectures/ecmascriptexamples/clientsidebasics/bmi-calculator.html</td>
        <td></td>
</tr>
<tr>
        <td>type</td>
        <td>id=weight</td>
        <td>167</td>
</tr>
<tr>
        <td>fireEvent</td>
        <td>id=weight</td>
        <td>input</td>
</tr>
<tr>
        <td>type</td>
        <td>id=height</td>
        <td>69</td>
</tr>
<tr>
        <td>fireEvent</td>
        <td>id=height</td>
        <td>input</td>
</tr>
<tr>
        <td>assertText</td>
        <td>id=bmi</td>
        <td>24.7</td>
</tr>
<tr>
        <td>assertText</td>
        <td>id=category</td>
        <td>normal</td>
</tr>
<tr>
        <td>assertAttribute</td>
        <td>id=category@class</td>
        <td>normal</td>
</tr>

</tbody></table>
</body>
</html>
        
An Example Test Suite

Based on the BMI Calculator Click here for a demonstration.

ecmascriptexamples/systemtesting/bmi-calculator-testsuite.html
        <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
  <title>BMI Calculator Test Suite</title>
</head>
<body>
<table id="suiteTable" cellpadding="1" cellspacing="1" border="1" class="selenium"><tbody>
<tr><td><b>BMI Calculator Test Suite</b></td></tr>
<tr><td><a href="normal.html">normal</a></td></tr>
<tr><td><a href="overweight.html">overweight</a></td></tr>
</tbody></table>
</body>
</html>
        
About Recording