Professional Documents
Culture Documents
Selenium
Web Test Tool Training
Discover the automating power of Selenium
Presented by:
Kangeyan Passoubady (Kangs)
Copy Right: 2008, All rights reserved by Kangeyan Passoubady (Kangs). Republishing requires author’s permission
2
Day 2
HTML Format
Source is in comma
Separated values Format GE Test Case1.csv
Select CSV Format
}
Argument 1: testCase
function formatCommands(commands) {
Test Case to format
var result = ''; Argument 2: name
var sep = SEPARATORS[options['separator']]; Name of the test case. It
may be used to embed
for (var i = 0; i < commands.length; i++) { title into the source
var command = commands[i];
if (command.type == 'command') {
result += command.command + sep +
command.target + sep + command.value + Format an array of
"\n"; } commands to the
snippet of source.
} Used to copy the source
return result; into the clipboard.
}
Discover the automating power of Selenium
Copyright © 2008-2010 by Kangeyan Passoubady (Kangs) 10
Options Menu Adding a New Format #9
function parse(testCase, source) { Parse source file and
var doc = source; var commands = []; update TestCase.
Throw an exception if
var sep = SEPARATORS[options['separator']]; any error occurs
while (doc.length > 0) {
var line = /(.*)(\r\n|[\r\n])?/.exec(doc);
var array = line[1].split(sep); Argument 1: testCase
if (array.length >= 3) { Test Case to update
Argument 2: source
var command = new Command(); Source to parse
command.command = array[0];
command.target = array[1]; Source Line is parsed and
command.value = array[2]; in the IDE it is passed as
Command, Target and
commands.push(command);
Value
}
doc = doc.substr(line[0].length); }
testCase.setCommands(commands);}
Discover the automating power of Selenium
Copyright © 2008-2010 by Kangeyan Passoubady (Kangs) 11
Options Menu Adding a STIQ Format #1
• StoryTestIQ (STIQ) is a test framework used to
create Automated Acceptance Tests or Story
Tests
• STIQ uses selenium which has the following
syntax for test cases
|command|value|target|
• It starts with a pipe symbol ends with a pipe
symbol
• Command and Value separated by a Pipe symbol
• Value and Target separated by a Pipe symbol
Discover the automating power of Selenium
Copyright © 2008-2010 by Kangeyan Passoubady (Kangs) 12
Options Menu Adding a STIQ Format #1
• Create one more format as shown below:
~~Command~~Value~~Target~~
• Double Tilde is the separation Character
• Modify the javascript “seleniumIDE_CSV.js”,
to handle two new formats:
1. STIQ Pipe Format
2. Double Tilde Format