Simple instructions on running an existing test suite against various browsers using Selenium RC
- chrome
- firefox
- internet explorer
- Internet Connection
- Can access Wordpress.com and is familiar with How to works on Wordpress.com?
- Selenium RC is already installed
- PC should have Firefox, IE and Google Chrome browsers.
Key Steps
1.Create a folder in C dir having name Htmltestsuite
2.Copy and paste the testsuite/testcases from the blog to the same folder having same name in html.
3.Open command prompt
4.Run the commands listed under the Commands heading
5.See the Result.html
Commands
Command to run test suite on firefox browser
java -jar selenium-server-standalone-2.0b2.jar -htmlSuite "*firefox" "http://foundation.time2test.co.uk/" "C:\Htmltestsuite\Solution2Suite.html" "C:\Htmltestsuite\Result.html"
Command to run test suite on IE browser
java -jar selenium-server-standalone-2.0b2.jar -htmlSuite "*iehta" "http://foundation.time2test.co.uk/" "C:\Htmltestsuite\Solution2Suite.html" "C:\Htmltestsuite\Result.html"
java -jar selenium-server-standalone-2.0b2.jar -htmlSuite "*googlechrome" "http://foundation.time2test.co.uk/" "C:\Htmltestsuite\Solution2Suite.html" "C:\Htmltestsuite\Result.html"
Zip file location: ( download from here)
C:\foundationSelenium\Htmltestsuite\testcase1.html, C:\foundationSelenium\Htmltestsuite\testcase2.html, C:\foundationSelenium\Htmltestsuite\testcase3.html, C:\foundationSelenium\Htmltestsuite\Solution2Suite.html, C:\foundationSelenium\Htmltestsuite\command.txt.
1. Save the below codes in HTML having Solution2Suite.html name in C:\Htmltestsuite dir.
<?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>Test Suite</title>
</head>
<body>
<table id="suiteTable" cellpadding="1" cellspacing="1" border="1" class="selenium"><tbody>
<tr><td><b>Test Suite</b></td></tr>
<tr><td><a href="testcase1.html">testcase1</a></td></tr>
<tr><td><a href="testcase2.html">testcase2</a></td></tr>
<tr><td><a href="testcase3.html">testcase3</a></td></tr>
</tbody></table>
</body>
</html>
2. Save the below codes in HTML having testcase1.html name in C:\Htmltestsuite dir.
<?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="http://foundation.time2test.co.uk/" />
<title>TestCase1</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">TestCase1</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>link=Log in</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Username</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Password</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>id=user_login</td>
<td>admin</td>
</tr>
<tr>
<td>type</td>
<td>id=user_pass</td>
<td>time4test</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>id=wp-submit</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@id='user_info']/p/a[2]</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
3. Save the below codes in HTML having testcase2.html name in C:\Htmltestsuite dir.
<?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="http://foundation.time2test.co.uk/" />
<title>TestCase2</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">TestCase2</td></tr>
</thead><tbody>
<tr>
<td>clickAndWait</td>
<td>link=Posts</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@id='wpbody-content']/div[3]/h2</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>link=Add New</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>id=title</td>
<td>MyPost</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>id=publish</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
4. Save the below codes in HTML having testcase3.html name in C:\Htmltestsuite dir.
<link rel="selenium.base" href="http://foundation.time2test.co.uk/">
<table border="1" cellpadding="1" cellspacing="1"><thead>
<tr><td rowspan="1" colspan="3">TestCase3</td></tr>
</thead><tbody>
<tr>
<td>clickAndWait</td>
<td>link=Users</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Users</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//li[@id='menu-users']/div[3]/ul/li[2]/a</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>id=user_login</td>
<td>javascript{"Test" + new Date().getMilliseconds();}</td>
</tr>
<tr>
<td>type</td>
<td>id=email</td>
<td>javascript{"Test" + new Date().getMilliseconds()+"@gmail.com";}</td>
</tr>
<tr>
<td>type</td>
<td>id=first_name</td>
<td>TestFirst</td>
</tr>
<tr>
<td>type</td>
<td>id=last_name</td>
<td>TestLast</td>
</tr>
<tr>
<td>type</td>
<td>id=url</td>
<td>http://www.google.com/</td>
</tr>
<tr>
<td>type</td>
<td>id=pass1</td>
<td>time2test</td>
</tr>
<tr>
<td>type</td>
<td>id=pass2</td>
<td>time2test</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>id=addusersub</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>link=Log Out</td>
<td></td>
</tr>
</tbody></table>
Helpful Video
It's done
ReplyDeleteIt seems like it's a rework for me, I need to change solution and need to run test suite based on java.
ReplyDeleteWhy do you need to base this on java?
ReplyDeleteI thought so, then do you think it's ok? I mean there is no need to change.
ReplyDeletePlease leave as it is.
ReplyDeleteFeedback:
You do need to specify the actual commands in the entry.
You need to specify the filenames of the files as that is not clear.
Hi, i think this still needs updatin as per my last comment
ReplyDeleteIt's done.
ReplyDeleteI have formatted the solution to maintain the consistency, it's done.
ReplyDelete