0
votes

I had recorded a test using selenium ide. According to the application's requirement the test case should show error after executing it but it is executing in the selenium ide without showing error. So is it the application not working correct or am i not recording test correctly???

<?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://example.com/" />
<title>enerc2</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">enerc2</td></tr>
</thead><tbody>
<tr>
    <td>open</td>
    <td>www.example.com/index/admin</td>
    <td></td>
</tr>
<tr>
    <td>verifyElementPresent</td>
    <td>//div[@id='site-grid']/table/thead/tr[2]/td[2]</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>css=thead &gt; tr &gt; #site-grid_c1 &gt; a[title=&quot;Fuel Level after     last fueling (Tank Capacity)&quot;]</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>name=Site[Tank_Capacity]</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>name=Site[Tank_Capacity]</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>name=Site[Tank_Capacity]</td>
    <td>123</td>
</tr>
<tr>
    <td>click</td>
    <td>name=Site[Tank_Capacity]</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>name=Site[Tank_Capacity]</td>
    <td>&lt;&gt;</td>
</tr>
<tr>
    <td>click</td>
    <td>name=Site[Tank_Capacity]</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>name=Site[Tank_Capacity]</td>
    <td>&lt;&gt;+-</td>
</tr>
<tr>
    <td>click</td>
    <td>name=Site[Tank_Capacity]</td>
    <td></td>
</tr>
<tr>
    <td>verifyElementPresent</td>
    <td>css=div.summary</td>
    <td></td>
</tr>
</tbody></table>
</body>
</html>
2
@billthor thnx for editing... can u suggest ur opinion??? - erwer
@Ironman84 check the code here i have posted it here....can u suggest ur opinion??? - erwer
can u tell where u needs ur testcase to fail? - Wasi

2 Answers

0
votes

If VALIDATION CODE isn't present in the application, then, it is pretty obvious that you would not get any error on executing with a special character in the input. you can try adding a simple alert, just add javascript:alert('value of the input'); and then check the condition.
Or if you are more into coding, try an if(){}else{}
It is definitely with your code, not the testing tool.

0
votes

By default, Selenium will just record your navigation. You need to add the appropriate validations. This can be done as you go along, or you can step through the test and add them as you go along. Add tests based on functionality, not look and feel. For basic tests, I check the page title, and for the presence of results.

It looks like you may have recorded several exploratory clicks on the table. I don't know if these are very useful in your tests. In any case there are no tests following the clicks.

I find many of the other competing tools will build a set of tests for your. However, the default tests tend to be focused on look and feel and fail easily when that changes. They also tend to make functionality tests difficult. I've seen test suites where every page fails twice a year when the DST switches.

EDIT: When testing for failures, check for the presence of the error message. If no message is presented, testing will be more difficult. It may be possible to check the page title if a successful entry navigates to a page with a different title.

A simple test strategy is to check for something which should be present if the test succeeded, but otherwise won't be on the page. For failure cases this will be the correct failure message. For success cases, it will be the results of the success. Ignore look and feel as much as possible. Page titles may be a useful way to determine if you are on the correct page.