used for : allows
developers to find elements on the page by using the find functionality.?? It
has a JavaScript REPL. REPL stands for
Read-Eval-Print-Loop, which is an interactive shell that allows you to run
JavaScript without having to create an entire page.

22)To Store Element that are on the page to use
later in test. For eg. Test needs to pick a date and use it later so
that you do not need to hardcode values into your test.

Command:
Type

Target:
name of the textbox

Value:
${variableName} . (This variable name will come from : Right-click on the text, go to the storeText command in the
context menu, and click on it. A dialog will appear just as below. Enter the
name of a variable that you want to use. )

3)Using element attributes in XPath queries:

Target:
xpath=//div[@class='classname'].

4)Do partial match on attribute content: For example, if you wanted to access the element that has the text
"This element has an ID that changes every time the page is loaded"
in it, you will use //div[contains(@id,'time_')]. This is due to the first part of the ID always being static. Or
use //div[starts-with(@id,’time_)]

5)Find element that text it contains: To do this, your query will need to have the text()method call in the query. It
will match the entire contents of the node if it has the format //element[text()='inner text']. Example : //div[contains(text(),’element has a
ID’)] or //div[text()=’This element has a ID’]

6)We are going to find a button and then find
its sibling. In this, the query that we will generate is equivalent
to xpath=//div[@class='leftdiv']/ input[2]. We will start by finding the first element for our query, which
is //input[@ value='Button with ID']. Place that into the Selenium IDE Target box and see which
element it highlights. There is another button below the one that is
highlighted, and that is the element that we need to work with in this section.
The button is the next input item in the HTML, so it is elements following-sibling that we need. Our locator will look like //input[@value='Button with ID']/following-sibling::input[@
value='Sibling Button'] . Similarly, use preceding instead of
following.

7)Javascript : Let's imagine
you are working against an auction site. The script will need to get the value
of the last highest bid off the page and then add 2 to it. Let's try this in the Selenium IDE.

Command: storeText

Target: NAME OF Id

Value: Any name

Command: type

Target: Previous Value

Value: javascript{+storedVars[‘Name Of the id’]+2}

8)Javascript within Verify or Assert : Let's say that you have stored a value from a different part of
the test and now you need to verify or assert that the value is correct.
(Create a step to verify that it is equal to 5*10 using the verifyEval command)

Command: storeText

Target: NAME OF Id

Value: Any name

Command: verifyEval

Target: javascript{5*10}

Value: ${Value} //Previous Value that we used

9)Accessing Page with BrowserBot:

BrowserBot
is the JavaScript object
that allows Selenium to control the browser. It overrides access to the window,
document, and other key browser JavaScript objects that we can normally access.

Syntax is:var window = this.browserbot.getUserWindow();

Imagine that you need to call a JavaScript function on the page.
This could be because you are working against elements that Selenium can't
interact with and your test needs to call into the API to put something on the
page. Or you might have to write some tests to exercise the JavaScript
functions on the page.

Syntax for
Remote Control Server:

1)To test testcase or test suite on any browser: Open a
Command Prompt and write.

Since, RC acts as a proxy
between your tests and the application being tested; it has to use a port to
listen for commands. There will be instances where you will not be able to use
the standard 4444 port. When this happens, adding –port allows you to use a different port number without
conflicts.

5) Running Selenium IDE tests
with-firefoxProfileTemplate

If you require a special
profile, or if you need to make sure that a specific Firefox Add-on is
installed, use –firefoxProfileTemplate /path/to/firefox/profile. This command
will take the profile that you want and then clone it to be used in your test.

In the New Project window under
project types, select “Visual C# ->Windows”

Select the “Class Library” Template
and name it something like “TestingBlogSeleniumRc” and click “Ok”.

It will create the project along
with a file called “Class1.cs”. Paste your SeleniumIDE test into
that file.

Rename “Class1.cs” to
“FirstTest.cs”.

In the code, change the namespace
from “SeleniumTests” to “TestingBlogSeleniumRc”:

Modify the class name from
“Untitled” to “FirstTest”. It’s good to change this so that if you
add other tests, there won’t be any duplicated class names in the
namespace (This has gotten me before, causing compile errors.).

We also have to modify the Selenium
instantiation to launch Internet Explorer. Where it has “*chrome”,
change it to “*firefox”.

Where it has
“http://change-this-to-the-site-you-are-testing/”, change it to “http://www.google.com”.

Next we need to add all the
references so this thing will run.

Go to the solution explorer, and
right click on the “References” and select “Add Reference…”

Hit the “Browse” tab and navigate to
where you unzipped your SeleniumRC files. Look in the dotnet client
driver folder.

Once you navigate to where the
proper *.dlls are, select all of them and click “OK” to add them to the
project. (I know you can probably get away with adding less, but
let’s keep it simple.)

Build the project to see if it
works. (Mine worked. Hopefully yours did too.)

*) Phase Three: Running the
Selenium RC test

In order to run the Selenium RC
test, you first have to have the Selenium RC server running. Make a batch
file.

You must get rid of the try-catch exception block.
As long as you have that block in your test, your test will never fail.
Nunit counts on an exception being thrown when an assert statement fails.
If that exception gets caught, then Nunit thinks that the test passed.

2) regexp or regexpi (for case-insensitive match)
All JavaScript’s regular expression metacharacters are supported, including:
* (0 or more of preceding character)
+ (1 or more of preceding character)
? (0 or 1 of preceding character)
{n} (n of preceding character)
a|b (alternation: a OR b)
[aeiou] (character class: any one of the chars)

This extension provides goto, gotoIf and while loop functionality in Selenium IDE. The image below shows a sample test case using goto, gotoIf and a while loop, all running successfully in Selenium IDE.

The file linked at the end of this post
should be saved as "sideflow.js" to your hard drive. Then the Options
settings in Selenium IDE should set the Selenium Core extensions to
include the path of this file, similar to the image below.

___sideflow.js:____________________________________________________

vargotoLabels={};

varwhileLabels={};

// overload the original Selenium reset function

Selenium.prototype.reset=function(){

// reset the labels

this.initialiseLabels();

// proceed with original reset code

this.defaultTimeout=Selenium.DEFAULT_TIMEOUT;

this.browserbot.selectWindow("null");

this.browserbot.resetPopups();

}

Selenium.prototype.initialiseLabels=function()

{

gotoLabels={};

whileLabels={ends:{},whiles:{}};

varcommand_rows=[];

varnumCommands=testCase.commands.length;

for(vari=0;i<numCommands;++i){

varx=testCase.commands[i];

command_rows.push(x);

}

varcycles=[];

for(vari=0;i<command_rows.length;i++){

if(command_rows[i].type=='command')

switch(command_rows[i].command.toLowerCase()){

case"label":

gotoLabels[command_rows[i].target]=i;

break;

case"while":

case"endwhile":

cycles.push([command_rows[i].command.toLowerCase(),i])

break;

}

}

vari=0;

while(cycles.length){

if(i>=cycles.length){

thrownewError("non-matching while/endWhile found");

}

switch(cycles[i][0]){

case"while":

if((i+1<cycles.length)&&("endwhile"==cycles[i+1][0])){

// pair found

whileLabels.ends[cycles[i+1][1]]=cycles[i][1];

whileLabels.whiles[cycles[i][1]]=cycles[i+1][1];

cycles.splice(i,2);

i=0;

}else++i;

break;

case"endwhile":

++i;

break;

}

}

}

Selenium.prototype.continueFromRow=function(row_num)

{

if(row_num==undefined||row_num==null||row_num<0){

thrownewError("Invalid row_num specified.");

}

testCase.debugContext.debugIndex=row_num;

}

// do nothing. simple label

Selenium.prototype.doLabel=function(){};

Selenium.prototype.doGotolabel=function(label)

{

if(undefined==gotoLabels[label]){

thrownewError("Specified label '"+label+"' is not found.");

}

this.continueFromRow(gotoLabels[label]);

};

Selenium.prototype.doGoto=Selenium.prototype.doGotolabel;

Selenium.prototype.doGotoIf=function(condition,label)

{

if(eval(condition))this.doGotolabel(label);

}

Selenium.prototype.doWhile=function(condition)

{

if(!eval(condition)){

varlast_row=testCase.debugContext.debugIndex;

varend_while_row=whileLabels.whiles[last_row];

if(undefined==end_while_row)thrownewError("Corresponding 'endWhile' is not found.");

this.continueFromRow(end_while_row);

}

}

Selenium.prototype.doEndWhile=function()

{

varlast_row=testCase.debugContext.debugIndex;

varwhile_row=whileLabels.ends[last_row]-1;

if(undefined==while_row)thrownewError("Corresponding 'While' is not found.");

Wednesday, April 25, 2012

Adobe BrowserLab is without a doubt my favorite free cross browser
compatibility testing tool on the web.
Adobe BrowserLab allows you to select what browsers and operating systems
you would like to test on – everything from IE6 on a Mac to Firefox 5 on
Windows. It lets you save “sets” of browsers, compare browsers via dual
or quad comparison windows and even allows you to control the zoom of the
browser window. You can change which browsers you’d like to test under “Browser
Sets.”
With a sleek interface, an almost instantaneous refresh rate and a
comprehensive browser test list I’d wager that Adobe’s BrowserLab will meet a
majority of people’s browser testing needs. Most likely only those operating
corporate or e-commerce websites need the additional functionality of a tool
like Litmus.
The best part about Adobe’s BrowserLab? It’s 100% free! Just sign up for a
free Adobe account and start testing!https://browserlab.adobe.com
(free!)

Don’t forget it’s important to not only test browsers but different
browsers on different OS’s (which the tools above do). Here’s a handy cross
browser testing checklist you can refer to while cross-browser testing your
website or application:

Monday, April 23, 2012

A. Easy to use
B. Instructions are simple and clear. Additionally, test that instructions are
correct
C. Is the site map is correct?
D. Does each link on the map actually exist?
E. Are there links on the site that are not represented on the map?
D. Is the navigational bar present on every screen?
E. Is it consistent?
F. Does each link work on each page?
G. Correctness of wording
H. No overuse of bold text,big fonts and blinking
I. Hyperlinked references are working
J. Are patterns, background colour and pictures distract the user?
K. Does all images add value to respective page?
L. Do these images waste bandwidth? In general use small pictures to reduce
load.
M. Does wrap-around occurs properly?

2. Functionality Testing

A. Correctness of the functionality of the website
i.e. the part that interfaces with the server and actually “does stuff”.
B. No internal and external broken links.
C. User submitted information through forms, needs to work properly.In order to
test this, verify that the server stores the information properly and that
systems down the line can interpret and use that information.
D. User input should get verified at system level according to business rules
and error/warning messages should be flash to user for incorrect inputs.
E. If the system uses cookies, make sure the cookies work. If cookies store
login information, make sure the information is encrypted in the cookie file.
If the cookie is used for statistics, make sure those cookies are encrypted
too, Otherwise people can edit their cookies and skew information

3. Interface Testing

A. If site calls external servers for additional
data, verify that the software can handle every possible message returned by
the external server.
B. To test browser and server interface, run queries on the database to make
sure the transaction data is being retrieve and store properly.
C. Make sure system can handle application errors.
D. Make sure that system can handle other systems’ errors. e.g. losing the
internet connection from server to the external server.
E. How the transaction is handled, if user does not initiate interruption.

5. Load/Stress Testing
A. How many users at the same time can access without getting busy signal?
B. Can system handle large amount of data from multiple users?
C. Long period of continuous use: is site able to run for long period, without
downtime.

6. Security
A. Each directory should have an index.html or main.html page so a directory
listing doesn’t appear.
B. Historical pages should be removed from directories.
C. In order to validate users, if site requires user to login; verify that the
system does not allow invalid usernames/password.
D. Is there a maximum number of failed logins allowed before the server locks
out the current user?
E. Verify rules for password selection.
F. Does the server log track every transaction?
G. Does it track unsuccessful login attempts?
H. What does it store for each transaction?