tag:blogger.com,1999:blog-36183889437928547152024-02-07T22:23:22.782-08:00Automatize Your TestingAnonymoushttp://www.blogger.com/profile/02586783112571690527noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-3618388943792854715.post-34133661176130579162014-09-19T00:35:00.000-07:002014-09-19T00:35:55.834-07:00How to create testing infrastructure?<div class="MsoNormal">
There are many cases in automated testing where you need to
write multiple tests which are basically the same, except for some minor
changes.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
For example, you need to write a test which inserts a value
to a filed, and the value should change every time. If you write the whole
thing in one test, a simple loop will solve the issue. But if you want a
separate test for each value, you’ll need to create many test files that will
include the test code and will differ only in the desired value.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
Here is an example for a simple python script which takes its “values” from a simple JSON file and creates siesta tests for as many values as there are in the JSON file, a test for each value: (A short explanation regarding the values and flow of the script will follow)<span style="font-family: "Calibri","sans-serif"; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Arial; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><br /></span>
<br />
<div class="MsoNormal">
<span style="font-family: Times, Times New Roman, serif; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">#!/usr/bin/python<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">import json<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">import sys<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">import getopt<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">import time<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">import os.path<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">#######################################<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">## Declaring default values<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">#######################################<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">## This is the default template to generate test files.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">testTemplate = """<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> StartTest(function(t)
{{ <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> t.chain( <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> //here
we click on the button which will open a window<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> function
(next) {{<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> var
fieldToClick = Ext.ComponentQuery.query('element')[0];<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> t.click(fieldToClick,next);<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> }}, <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> //wait
for the window to open<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> {{
waitFor : 'componentQuery', args :
"windowToOpen" }}, <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> //insert
to the text field in the window a value<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> function
(next) {{<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> var
fieldToType = Ext.ComponentQuery.query('textfield')[0];<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> t.type
(fieldToType, '{0}', next);<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> }}<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> );<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> }})<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">"""<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">## Default JSON input file name<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">inputJSONfile = '/home/user/values.json'<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">## The default template for test's file names<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">testFileNameTemplate =
"Insert_Value_{0}_To_Textfield.t.js"<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">#######################################<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">## This is the script's actual code (The MAIN function)<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">#######################################<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">## Printing the final configuration<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">print
("#######################################\nConfiguration\n#######################################")<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">print 'Input JSON file is:', inputJSONfile<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">print 'Template for test''s file names:' ,
testFileNameTemplate<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">print 'Test template used for generating test files:',
testTemplate<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">print
("#######################################\n")<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">## Open the attributes json file<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">with open(inputJSONfile) as data_file: <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> ##
Parsing the JSON data<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> data =
json.load(data_file)<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> # Loop on all the
keys in the json<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> for k in
data.keys():<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> ##
Extract the attribute name for each record in the json<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> valueToInsert
= data[k]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> ## Generating the file name<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> fileName =
testFileNameTemplate.format(valueToInsert)<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> ## Creating the test file (This will
OVERWRITE EXISTING FILES)<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> ## Injecting the values into the
test template<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> with open(fileName,
"w") as fo:<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> fo.write(testTemplate.format(valueToInsert))</span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> print (fileName +
" created.")<o:p></o:p></span></div>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small; line-height: 115%;"><br /></span>
<span style="font-family: "Calibri","sans-serif"; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Arial; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><br /></span>
<br />
<div class="MsoNormal">
<h4>
So what exactly happens in this script?</h4>
Each test clicks on an element, and insert a value into the
textbox which opens.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
The python scripts creates all the test files in the same
directory from which it runs, and you can supply the JSON file path in the
script itself.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
The <i><u>testTemplate</u></i> is the code which you will be
included in each test file.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
The <i><u>inputJSONfile</u></i> is the path of the JSON file<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
The <i><u>testFileNameTemplate</u></i> is the file name for
each test (and can include the value from the JSON, as you can see on this
example). <o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<br />
<div class="MsoNormal">
You can manipulate the script and add more code and more
parameters to it; the purpose of this post is to give you the main idea for
creating such an infrastructure.<o:p></o:p></div>
Anonymoushttp://www.blogger.com/profile/02586783112571690527noreply@blogger.com0tag:blogger.com,1999:blog-3618388943792854715.post-52311291366325047232014-08-12T03:11:00.000-07:002014-08-12T03:11:48.856-07:00Continues Integration – how to run siesta via Jenkins?<div class="MsoNormal">
As you’ve seen in the previous post (<a href="http://automatizetesting.blogspot.co.il/2013_12_01_archive.html">Running siesta from a remote computer</a>), you can run siesta tests remotely. Moreover, you can create a
Jenkins job which will run those tests for you, and will indicate for any
failed test.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
In order to do that, you need first to complete the setup in
the “<a href="http://automatizetesting.blogspot.co.il/2013_12_01_archive.html">Running siesta from a remote computer</a>” post, so that you’ll have server
and client configuration.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
After getting that stage done, you’ll need to:</div>
<div class="MsoNormal">
</div>
<ol>
<li><span style="font-size: 7pt; text-indent: -0.25in;"> </span><span dir="LTR" style="text-indent: -0.25in;"></span><span style="text-indent: -0.25in;">Install siesta on your Jenkins
machine.</span></li>
<li><span style="font-size: 7pt; text-indent: -0.25in;"> </span><span dir="LTR" style="text-indent: -0.25in;"></span><span style="text-indent: -0.25in;">Install java on your Jenkins
machine.</span></li>
<li><span style="font-size: 7pt; text-indent: -0.25in;"> </span><span dir="LTR" style="text-indent: -0.25in;"></span><span style="text-indent: -0.25in;">Validate that you can run
the webdriver commands from your Jenkins machine. it means that from the path
where siesta is installed on your Jenkins, you need to go to the “bin”
directory and run from there a test with webdriver. for example:</span></li>
</ol>
<br />
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<o:p></o:p></div>
<span style="font-family: Courier New, Courier, monospace;"># webdriver http://IP/siestaTests --include=MytestFile.t.js --host YourHostName --port 4444 --browser=ie --report-format=JUnit --report-file=MytestFile_log_</span><br /><div class="MsoNormal">
</div>
<div class="MsoListParagraphCxSpLast">
<br /></div>
<div class="MsoListParagraphCxSpLast">
(If you experience any problems, please refer
to the “<a href="http://automatizetesting.blogspot.co.il/2013_12_01_archive.html">Running siesta from a remote computer</a>” post).<o:p></o:p></div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l1 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l1 level1 lfo1; text-indent: -.25in;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l1 level1 lfo1; text-indent: -.25in;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpLast">
<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
After you successfully managed to run the webdriver command,
you can start to configure the Jenkins job:</div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
<span style="text-indent: -0.25in;"><br /></span></div>
<div class="MsoNormal">
<span style="text-indent: -0.25in;">1. Access your Jenkins server
-> click on “new item” -> choose the “Build a free style software project”
option, and give the job a name.</span></div>
<div class="MsoNormal">
<span style="text-indent: -0.25in;"><br /></span></div>
<div class="MsoNormal">
<span style="text-indent: -0.25in;">2. In the job configuration
window (which will open as you click on the “ok” button), check the “This build
is parameterized” option.</span></div>
<div class="MsoNormal">
<span style="text-indent: -0.25in;"><br /></span></div>
<div class="MsoNormal">
<span style="text-indent: -0.25in;">3. The parameters are used for
your comfort only, and they are NOT a must. I recommend configuring them so
that you can run the same build with different options (such as different
browsers or different clients) without needing to create a new job for each
option.</span></div>
<div class="MsoNormal">
<span style="text-indent: -0.25in;"><br /></span></div>
<div class="MsoNormal">
<span style="text-indent: -0.25in;">4. You’ll need to configure 5
parameters, and in order to do so click on “Add parameter” button under the
option you checked in step 2.</span></div>
<div class="MsoNormal">
<span style="text-indent: -0.25in;"><br /></span></div>
<div class="MsoListParagraphCxSpFirst" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]--><span dir="LTR"></span>Parameter type: <b>Text Parameter</b><o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto;">
Name: CLIENT_NAME<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto;">
Default value: insert here your client http address, which is the URL of
your siesta GUI.<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]--><span dir="LTR"></span>Parameter type: <b>Choice</b><o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto;">
Name: BROWSER<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto;">
Choices: insert here the browsers you want to test on, with a separation of
a new line between each. <o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]--><span dir="LTR"></span>Parameter type: <b>String Parameter</b><o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto;">
Name: SERVER_NAME<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto;">
Default value: insert here your server IP address, which is the machine
you want the tests to run against.<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]--><span dir="LTR"></span>Parameter type: <b>String Parameter</b><o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto;">
Name: PORT<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto;">
Default value: insert here the webderiver server port, which is 4444 by
default.<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]--><span dir="LTR"></span>Parameter type: <b>String Parameter</b><o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto;">
Name: TESTS_TO_INCLUDE<o:p></o:p></div>
<div class="MsoNormal">
</div>
<div class="MsoListParagraphCxSpLast" style="margin-left: 1.0in; mso-add-space: auto;">
Default
value: insert here the path of the tests you want to run. You can remove this
parameter and just run all the tests. If you are using this parameter, note
that the path you give here is relative to the index.js file.<o:p></o:p></div>
<div class="MsoListParagraphCxSpLast" style="margin-left: 1.0in; mso-add-space: auto;">
<br /></div>
<div class="MsoNormal">
<span style="text-indent: -0.25in;">5. Now add a very simple shell script which will run the webdriver command on your Jenkins. in order to do that you need to click on “Add build step” under the Build section on your job configuration.</span></div>
<div class="MsoNormal">
<span style="text-indent: -0.25in;"><br /></span></div>
<div class="MsoNormal">
<span style="text-indent: -0.25in;">6. Choose “execute shell” and
in the window that opens, insert the following:</span></div>
<div class="MsoNormal">
<span style="text-indent: -0.25in;"><br /></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l2 level1 lfo2; text-indent: -.25in;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle">
<span style="font-family: Courier New, Courier, monospace;">export JAVA_HOME={the path of your java
installation, i.e. /opt/java/jdk1.7.0_51}<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle">
<span style="font-family: Courier New, Courier, monospace;">export PATH=$JAVA_HOME/bin:$PATH<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle">
<span style="font-family: Courier New, Courier, monospace;">{full location of siesta webdriver, i.e. /var/siesta/bin/webdriver
} ${ CLIENT_NAME } --report-format JUnit --report-file-prefix junit- --browser
${BROWSER} --host ${ SERVER_NAME } --port ${ PORT } --no-color --include=${ TESTS_TO_INCLUDE }</span></div>
<div class="MsoListParagraphCxSpMiddle">
<span style="text-indent: -0.25in;"><br /></span></div>
<div class="MsoListParagraphCxSpMiddle">
<span style="text-indent: -0.25in;">7. Now all that’s left is to
get the tests results in Jenkins. to do that go to “Post-build Actions” and
click on “Add post-build action”. Choose “Publish JUnit test result report” and
in the “Test report XMLs” field insert “junit-*”.</span></div>
<div class="MsoListParagraphCxSpMiddle">
<span style="text-indent: -0.25in;"><br /></span></div>
<div class="MsoListParagraphCxSpMiddle">
<span style="text-indent: -0.25in;">8.</span><span style="font-size: 7pt; text-indent: -0.25in;"> C</span><span style="text-indent: -0.25in;">lick on “save”.</span></div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l2 level1 lfo2; text-indent: -.25in;">
<o:p></o:p></div>
<br />
<div class="MsoNormal" style="margin-left: .25in;">
<br /></div>
<div class="MsoNormal" style="margin-left: .25in;">
That’s it! All configuration is
done, and from now on you can use siesta tests as a part of the continues
integration process, by running the siesta-tests build before/after other
builds.<o:p></o:p></div>
Anonymoushttp://www.blogger.com/profile/02586783112571690527noreply@blogger.com0tag:blogger.com,1999:blog-3618388943792854715.post-71994335172285273562014-04-13T06:43:00.000-07:002014-04-13T06:43:13.758-07:00Waiting for components in Siesta<div class="MsoNormal">
“waitFor” is one of the most important methods for testing
UI elements, since there are many occasions in which there can be race
conditions in UI testing (which are machine-induced and not user induced). For
example, if you click on a button which opens a window with a combo-box in it,
and you want to click on that combo-box - you must wait until the window is
rendered to the DOM in order to click on its combo-box. <o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
How can you make sure that the window is there? That’s what
“waitFor” does for you – it waits until the elements you want are visible (or
not visible) and only then runs the code after it.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
There are a few options to set waiting times in siesta. The
simple and basic option is to set the “waitFor” attribute for a certain amount
of time:<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;">StartTest(function(t) {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> t.chain(<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .5in; text-indent: .5in;">
<span style="font-family: Courier New, Courier, monospace;">{ waitFor : 2000 },<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .5in; text-indent: .5in;">
<span style="font-family: Courier New, Courier, monospace;">functionX ()<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> );<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;">};</span><o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
This will force the test to wait 2 seconds before executing
the next function in the chain.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Another option is to start the test only after a certain
attribute is rendered to the screen. If you can query this attribute with
ComponentQuery, you can also set the “waitFor” method to wait until it appears:<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;">StartTest(function(t) {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> t.chain(<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .5in; text-indent: .5in;">
<span style="font-family: Courier New, Courier, monospace;">{ waitFor : 'componentQuery',
args : "button[itemId=Foo]" },<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .5in; text-indent: .5in;">
<span style="font-family: Courier New, Courier, monospace;">functionY()<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> );<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;">};</span><o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
This will force the test to wait until it finds the “Foo”
button and only then the test will execute “functionY”.</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoListParagraph" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]--><span dir="LTR"></span>You can also wait for “componentVisible”,
which will wait until the element will be <b><u>rendered</u></b> to the screen
and not only until it can <b><u>query</u></b> for it.<o:p></o:p></div>
<div class="MsoListParagraph" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<br /></div>
<div class="MsoNormal">
Third option is the opposite - to start the test after some
attribute is no longer appears on screen. For example, if there’s a progress
bar on the page and you want some tests to run after the progress bar
disappears, you can use a different form of the “waitFor” method:<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;">StartTest(function(t) {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> t.chain(<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .5in; text-indent: .5in;">
<span style="font-family: Courier New, Courier, monospace;">{ waitFor :
'componentQueryNotFound', args : "progressBar"
},<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .5in; text-indent: .5in;">
<span style="font-family: Courier New, Courier, monospace;">functionY()<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> );<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;">};</span><o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<br />
<div class="MsoNormal">
This will make the tests wait until the progress bar (which
has an xtype of “progressBar” in ComponentQuery) disappears and only then
execute “functionY”. <o:p></o:p></div>
Anonymoushttp://www.blogger.com/profile/02586783112571690527noreply@blogger.com1tag:blogger.com,1999:blog-3618388943792854715.post-70893580928843010532014-02-16T02:32:00.000-08:002014-02-16T02:32:43.755-08:00How to run some code before each test?<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
</xml><![endif]--><br />
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>HE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267">
<w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" Priority="39" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" Name="toc 9"/>
<w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
</w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin-top:0in;
mso-para-margin-right:0in;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0in;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-language:AR-SA;}
</style>
<![endif]-->
<br />
<div class="MsoNormal">
Let’s suppose you need to run some general “code” (a few
commands), like a login process or a button click before every test in siesta.
You want that each and every test in your test suite will be executed from
where the “general code” stopped.</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="mso-bidi-language: HE;">For example, assume that
there are</span> two types of tests suites – the first test suite is running on
a specific window, and the other is running from a different window. The
windows are two different windows entirely, and each of them can be reached
from a “main menu” which has two buttons – one button for each window. This
means that you need a click on button “x” to be performed before the first type
of tests, and a click on button “y” to be performed before the other type of
tests. </div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
In siesta there isn’t yet a solution for this kind of
problems, but we can overcome them by adding a new test class (extending the
test class) and by overriding the isReady function, so before each test will
start to run the code in the new test class will be executed. </div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><u><span style="font-size: 16.0pt; line-height: 115%;">Setting
the environment for a new test class </span></u></b></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Now it’s time to configure the environment to use a new test
class. There are several phases to do this:</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoListParagraph" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">1<span style="font: 7.0pt "Times New Roman";">
</span></span></span><span dir="LTR"></span>1. You need to add the test
class name to the harness.configure function in index.js file:</div>
<div class="MsoListParagraph" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<br /></div>
<div class="MsoNormal" style="margin-left: 0.25in;">
<span style="font-size: small;"><span style="font-family: "Courier New",Courier,monospace;">Harness.configure({</span></span></div>
<span style="font-size: small;"><span style="font-family: "Courier New",Courier,monospace;">
</span></span><div class="MsoNormal" style="margin-left: 0.25in;">
<span style="font-size: small;"><span style="font-family: "Courier New",Courier,monospace;"><span>
</span>title<span> </span>: ‘This is my test
Suite’,</span></span></div>
<span style="font-size: small;"><span style="font-family: "Courier New",Courier,monospace;">
</span></span><div class="MsoNormal" style="margin-left: 0.25in;">
<span style="font-size: small;"><span style="font-family: "Courier New",Courier,monospace;"><span>
</span>testClass<span> </span>: Siesta.Test.Whatever,</span></span></div>
<span style="font-size: small;"><span style="font-family: "Courier New",Courier,monospace;">
</span></span><div class="MsoNormal" style="margin-left: 0.25in;">
<span style="font-size: small;"><span style="font-family: "Courier New",Courier,monospace;">});</span></span></div>
<div class="MsoNormal" style="margin-left: .25in;">
<br /></div>
<div class="MsoNormal" style="margin-left: .25in;">
<b><u>NOTE</u></b>: the new test
class <u>MUST</u> extend the siesta test class, so its name should be inside
the siesta name space. For example, names like “This.Test.Class” will not work,
but names like “Siesta.Test.Whatever” will.</div>
<span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"> </span></span><div class="MsoListParagraphCxSpFirst" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<br /></div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";">
</span></span></span><span dir="LTR"></span> 2. You need to create a file
which will contain the new test class, and locate it in the webapp folder.
Since all the paths are relative to the index.js file, you can create it in the
same folder as index.js located in.</div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">3<span style="font: 7.0pt "Times New Roman";"> </span></span></span>3. Add this line (which is the
new file you created) to the index.html file, right after the
“siesta-all.js”<span style="mso-spacerun: yes;"> </span>file and under “script”
tags:</div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle">
<span style="font-size: small;"><span style="font-family: "Courier New",Courier,monospace;"><script type="text/javascript"
src="Pre-Code.js"></script></span></span></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"> <span style="font: 7.0pt "Times New Roman";">
</span></span></span><span dir="LTR"></span>4. In the new class file, you
need to override the “isReady” function. You can read more about the function
here: <a href="http://www.bryntum.com/docs/siesta/#!/api/Siesta.Test-method-isReady">http://www.bryntum.com/docs/siesta/#!/api/Siesta.Test-method-isReady</a></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle">
There are a few important things to note
when using siesta to test ExtJS and when wanting to use Ext commands or siesta
commands (like Ext.ComponentQuery or t.click):</div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<ul>
<li>The “isa” value should be
Siesta.Test.ExtJS since we are testing ExtJS application.</li>
</ul>
<ul>
<li>
When using Ext commands,
instead of the usual “Ext.ComponentQuery” you should use “this.getExt().ComponentQuery”.</li>
</ul>
<ul>
<li>
When using variables that
are defined in the preload files, you should add “this.global” before their
names.</li>
</ul>
<ul>
<li>
When using siesta methods (like
click or chain), you should add “this” before the method instead on the usual “t”.</li>
</ul>
<ul>
<li>
After you finish writing
the code you want to do before each test, don’t forget to set the value of “isCustomSetupDone”
to true – this will start the test itself.</li>
</ul>
Anonymoushttp://www.blogger.com/profile/02586783112571690527noreply@blogger.com0tag:blogger.com,1999:blog-3618388943792854715.post-46602486647422371092014-01-25T09:55:00.002-08:002014-01-25T09:55:56.310-08:00Callback Method<div class="MsoNormal">
<div class="MsoNormal">
If you’re a frequent siesta user, you are probably familiar
with the “callback” parameter – you can find it in almost all common methods
like “click”, “type”, “drag” etc. <o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Here is the official documentation:<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: 14.65pt; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 24.0pt; margin-right: 0in; margin-top: 0in; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -.25in;">
<!--[if !supportLists]--><span style="color: #444444; font-family: Symbol; font-size: 10.0pt; mso-bidi-font-family: Symbol; mso-bidi-language: HE; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt; line-height: normal;">
</span></span><!--[endif]--><span dir="LTR"></span><span style="color: #444444; font-family: "Courier New"; font-size: 9.0pt; mso-bidi-language: HE; mso-fareast-font-family: "Times New Roman";">callback</span><span style="color: #444444; font-family: "Helvetica","sans-serif"; font-size: 10.0pt; mso-bidi-language: HE; mso-fareast-font-family: "Times New Roman";"> : Function (optional)<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 14.65pt; margin-left: 24.0pt;">
<span style="color: #444444; font-family: "Helvetica","sans-serif"; font-size: 10.0pt; mso-bidi-language: HE; mso-fareast-font-family: "Times New Roman";">A
function to call after click.<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
In other words, the callback is a method to be called after
the current operation is complete. <o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
To better understand that let’s stop for a moment and
explain how these common methods behave. When you call the “type” method in
your test code some ‘magic’ happens: the browser will start the operation of typing
as you requested and running the code that should run as a result of this. <u>At
the same time</u>, your test code will continue to run and the next line in
your code will be executed. This is best described as an asynchronous method because
it is running “in the background” while your next line of code is already being
executed. <o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Now suppose you want a click to be performed after a type
operation. That means that you want the test to “wait” and execute the click
only after the typing operation is complete. In order to do that you need to
provide a function as a callback to the type operation, so when the typing
operation is complete it will call this function which in our examples will
perform the click.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Let’s take a look at some examples:<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
if you want to run click after type you can provide the
“next” function as a callback in the type method:<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;">t.chain( <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> function
(next) {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> t.type(typeField,'text
to type',next);<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> },<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> function
(next) { <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> t.click(button,
next);<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> }</span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;">); </span><span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> </span></div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
You can also call the “next” function yourself after a
method that does not have a callback option, like the diag method:<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;">t.chain(
<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> function
(next) {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> t.diag('Im
going to click a button!');<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> next();<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> },<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> function
(next) { <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> t.click(button,
next);<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> }</span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;">);</span></div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
if you want to write a function of your own which uses the
callback option – for example, a function that clicks on a certain button, you
can write this in your preload file (if you don’t know what a preload file is
or why do you need it – go back to the previous posts):<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;">function clickOnFooButton (t, callback) {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;">var
fooBtn = Ext.ComponentQuery.query(‘button[itemId=Foo]’);<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> t.chain(<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .5in; text-indent: .5in;">
<span style="font-family: Courier New, Courier, monospace;">function (next) {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> t.click(fooBtn[0],next)<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> },<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> function
(next) {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> callback();<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> }<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> );<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;">};</span><o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
And on your test file you can simply call the
“clickOnFooButton” function the same way as you would click on a button:<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;">StartTest(function(t) {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> t.chain(<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> function
(next) {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> clickOnFooButton
(t, next);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> </span><span style="font-family: 'Courier New', Courier, monospace;"> },</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> function (next) {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> </span><span style="font-family: 'Courier New', Courier, monospace;"> </span><span style="font-family: 'Courier New', Courier, monospace;">t.type(typeArea,‘hello’);</span><span style="font-family: 'Courier New', Courier, monospace;"> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> }</span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;"> );<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Courier New, Courier, monospace;">};</span><o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<br />
<div class="MsoNormal">
This will make the test to click on the button which has the
itemId of “Foo” and only <b><u>after</u></b> that, will type ‘hello’ to the
typeArea. <o:p></o:p></div>
</div>
Anonymoushttp://www.blogger.com/profile/02586783112571690527noreply@blogger.com1tag:blogger.com,1999:blog-3618388943792854715.post-78331938822767067712013-12-01T10:12:00.000-08:002013-12-01T10:12:17.636-08:00Running Siesta from a remote computer<h2>
<b><u><span style="font-size: 14.0pt; line-height: 115%;">How to
run Siesta from a remote computer using Selenium Webdriver:</span></u></b></h2>
<br />
<div class="MsoNormal">
Suppose you have a machine which has linux file system and you
write your test on it; But the test you execute need to run on a windows
machine (for all browsers support, or from any other reason). </div>
<div class="MsoNormal">
Now you want to
run a command in your linux machine, that will execute remotely all the desired
tests on the windows machine and send back to the linux the alerts regarding
which test passed and which tests failed.<o:p></o:p></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyVizMXWJAr9a2K5p_p3j8sP987c7-bvP8CjQXsgUH7cGOww-tF1aE3WezwMl8ZnR7WmnztFtSOPy8rNRMpXMmBuG-BdoAp4bqdYnZ32mwmgnBBGrkUl_3K_iwyYNejrmjLTXdexXIYpcc/s1600/webdriver.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="202" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyVizMXWJAr9a2K5p_p3j8sP987c7-bvP8CjQXsgUH7cGOww-tF1aE3WezwMl8ZnR7WmnztFtSOPy8rNRMpXMmBuG-BdoAp4bqdYnZ32mwmgnBBGrkUl_3K_iwyYNejrmjLTXdexXIYpcc/s400/webdriver.png" width="400" /></a></div>
<div class="MsoNormal">
<h3>
</h3>
<h3>
On the "Server"</h3>
</div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
</div>
<ol>
<li><span style="text-indent: -0.25in;">On the “server” – where you
want to run the browser (aka - the windows machine) copy the siesta files and
folders (the latest version which you can get from here: </span><a href="http://www.bryntum.com/customerzone/home.php" style="text-indent: -0.25in;">http://www.bryntum.com/customerzone/home.php</a><span style="text-indent: -0.25in;">
) to c:\program files\</span></li>
<li><span style="font-size: 7pt; text-indent: -0.25in;"> </span><span dir="LTR" style="text-indent: -0.25in;"></span><span style="text-indent: -0.25in;">Install java (if not
installed) from: </span><a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html" style="text-indent: -0.25in;">http://www.oracle.com/technetwork/java/javase/downloads/index.html</a></li>
<li><span style="text-indent: -0.25in;">Access the siesta directory
from cmd, and run the following commands:</span></li>
</ol>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle">
<span style="font-family: Courier New, Courier, monospace;"> # cd c:\Program
Files\siesta-2.0.4-standard\bin</span></div>
<div class="MsoListParagraphCxSpMiddle">
<span style="font-family: Courier New, Courier, monospace;"><o:p></o:p></span></div>
<div class="MsoListParagraphCxSpLast">
<span style="font-family: Courier New, Courier, monospace;"> # webdriver-server -port 4444</span><o:p></o:p></div>
<div class="MsoListParagraphCxSpLast">
<br />
<h3>
On the "Client"</h3>
</div>
<div class="MsoListParagraphCxSpLast">
On the "client" - (in this example, it's the linux machine) navigate to Siesta's installation folder (the webapp directory) and cd to webapp/bin.</div>
<div class="MsoListParagraphCxSpLast">
<br /></div>
<div class="MsoListParagraphCxSpLast">
From the bin directory, execute the command:</div>
<div class="MsoListParagraphCxSpLast">
<br /></div>
<div class="MsoListParagraphCxSpLast">
<span style="font-family: Courier New, Courier, monospace;"># webdriver <span style="background-color: lime; background-position: initial initial; background-repeat: initial initial;">[the URL of your siesta GUI]</span> <span style="background-color: red; background-position: initial initial; background-repeat: initial initial;">--host</span>
<span style="background-color: lime; background-position: initial initial; background-repeat: initial initial;">["server" - windows host name or IP address]</span> <span style="background-color: red; background-position: initial initial; background-repeat: initial initial;">--port</span> <span style="background-color: lime; background-position: initial initial; background-repeat: initial initial;">4444</span> <span style="background-color: red; background-position: initial initial; background-repeat: initial initial;">--browser</span><span style="background-color: lime; background-position: initial initial; background-repeat: initial initial;">=[which
browser to run on the windows client, i.e: firefox, chrome, ie, safari ]</span></span></div>
<div class="MsoListParagraphCxSpLast">
<h4>
<span style="font-family: inherit; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Arial; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><b><u><br /></u></b></span></h4>
<h4>
<span style="font-family: inherit; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Arial; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><b><u>Additional Flags</u></b></span></h4>
<span style="font-family: inherit; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Arial; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">If you want to run
just one test you can use the “--include” flag. If you want the output to be in
JUnit format you can use the “--report-format” and “--report-file” flags. </span></div>
<div class="MsoListParagraphCxSpLast">
<span style="font-family: inherit; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Arial; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoListParagraphCxSpLast">
<span style="font-family: inherit; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Arial; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">For Example:</span></div>
<div class="MsoListParagraphCxSpLast">
<span style="font-family: "Calibri","sans-serif"; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Arial; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoListParagraph">
<span style="font-family: Courier New, Courier, monospace;"># webdriver http://IP/siestaTests --include=MytestFile.t.js --host YourHostName --port 4444
--browser=ie --report-format=JUnit --report-file=MytestFile_log_<o:p></o:p></span></div>
<div class="MsoListParagraph">
<br /></div>
<div class="MsoNormal">
<h4>
<b><u>For IE</u></b></h4>
</div>
<div class="MsoNormal">
This configuration works fine on firefox and chrome, but for
IE there is some adjustments to make:</div>
<div class="MsoNormal">
</div>
<ol>
<li><span style="text-indent: -0.25in;">Download the driver from here: </span><a href="https://code.google.com/p/selenium/downloads/list" style="text-indent: -0.25in;">https://code.google.com/p/selenium/downloads/list</a></li>
<li><span style="text-indent: -0.25in;">Copy to the windows machine (to C:\installations\selenium-2.37.0).</span></li>
<li><span style="text-indent: -0.25in;">Add this location in the PATH environment
variables on your windows machine.</span></li>
<li><span style="font-size: 7pt; text-indent: -0.25in;"> </span><span dir="LTR" style="text-indent: -0.25in;"></span><span style="text-indent: -0.25in;">Set the protector mode:
open the IE browser, choose "Internet Options..." from the Tools
menu, and click on the Security tab. For each zone (4 zones usually), there
will be a check box at the bottom of the tab labeled "Enable Protected
Mode" – all of them should be the same, all checked or all unchecked.</span></li>
<li><span style="text-indent: -0.25in;">Set the browser to IE9 mode
(press F12 and change the browser mode), and place it on top of all other
windows. </span></li>
</ol>
<br />
<div class="MsoListParagraph">
In order to make IE run in standard mode, add this
line to the index.html file in webapp directory, right after the <head> tag:<o:p></o:p></div>
<div class="MsoListParagraph">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhl-xhMlwLDRlh0YcmSB3KWWy0MWW6kh0E_lY3sQ1dT8sK7_uIqsI9rJXuGyGraXi7o1dY17rCjY_XFcLxxhHv8dCXGE7Jp0sigEoI_WS3H097YNadKG1wCnCfsiJL0NQZLIhAKDbCe1BHp/s1600/lineforIE.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="17" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhl-xhMlwLDRlh0YcmSB3KWWy0MWW6kh0E_lY3sQ1dT8sK7_uIqsI9rJXuGyGraXi7o1dY17rCjY_XFcLxxhHv8dCXGE7Jp0sigEoI_WS3H097YNadKG1wCnCfsiJL0NQZLIhAKDbCe1BHp/s400/lineforIE.png" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="MsoListParagraph">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<o:p></o:p></div>
<div class="MsoListParagraph">
</div>
<div class="MsoListParagraphCxSpLast">
Good luck!</div>
<div class="MsoListParagraph">
<o:p></o:p></div>
Anonymoushttp://www.blogger.com/profile/02586783112571690527noreply@blogger.com1tag:blogger.com,1999:blog-3618388943792854715.post-48321771043307392812013-11-23T07:23:00.002-08:002013-11-28T04:49:05.280-08:00Siesta - Getting Started<h2>
<span style="font-family: inherit; font-size: x-large;">Siesta - writing automated tests</span></h2>
<span style="font-family: Arial, sans-serif; font-size: 10pt;">Since
this page will <b><span style="font-family: "Arial","sans-serif";">NOT</span></b>
teach you all you need to know about siesta configuration, settings and
functions I strongly recommend that you spend some time reading about
siesta.<o:p></o:p></span><br />
<span style="font-family: Arial, sans-serif; font-size: 10pt;">Here
are a few useful links:<o:p></o:p></span><br />
<ul type="disc">
<li class="MsoNormal"><span style="font-family: "Arial","sans-serif"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">Siesta
homepage - </span><span style="color: windowtext;"><a href="http://www.bryntum.com/products/siesta/"><span style="font-family: "Arial","sans-serif"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">http://www.bryntum.com/products/siesta/</span></a></span><span style="font-family: "Arial","sans-serif"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></li>
<li class="MsoNormal"><span style="font-family: "Arial","sans-serif"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">Siesta
API - </span><span style="color: windowtext;"><a href="http://www.bryntum.com/docs/siesta/#!/api"><span style="font-family: "Arial","sans-serif"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">http://www.bryntum.com/docs/siesta/#!/api</span></a></span><span style="font-family: "Arial","sans-serif"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></li>
<li class="MsoNormal"><span style="font-family: "Arial","sans-serif"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">Siesta
Introduction - </span><span style="color: windowtext;"><a href="http://www.bryntum.com/docs/siesta/#!/guide/siesta_getting_started"><span style="font-family: "Arial","sans-serif"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">http://www.bryntum.com/docs/siesta/#!/guide/siesta_getting_started</span></a></span><span style="font-family: "Arial","sans-serif"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";"><o:p></o:p></span></li>
</ul>
<h2>
<span style="font-family: Arial, sans-serif; font-size: x-large;"><br /></span></h2>
<h2>
<span style="font-family: Arial, sans-serif; font-size: x-large;">Siesta Basics (Briefly)</span></h2>
<span style="font-family: Arial, sans-serif; font-size: 10pt;">There
are 3 files that needs to be modified when writing a new test in siesta:<o:p></o:p></span><br />
<ol start="1" type="1">
<li class="MsoNormal"><span style="font-family: "Arial","sans-serif"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">index.js<o:p></o:p></span></li>
<li class="MsoNormal"><span style="font-family: "Arial","sans-serif"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">preload.js
– This file is loaded before your tests run.<o:p></o:p></span></li>
<li class="MsoNormal"><span style="font-family: "Arial","sans-serif"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">your
test file (you can pick any name you want, but keep it meaning-full and in
order) for example - Mytestfile.t.js<o:p></o:p></span></li>
</ol>
<span style="font-family: Arial, sans-serif; font-size: 10pt;">The
files are located in the siesta installation folder:<o:p></o:p></span><br />
<span style="font-family: Arial, sans-serif; font-size: 10pt;">In
your <b><span style="font-family: "Arial","sans-serif";">webapp</span></b>
directory you can place your new siesta tests and directories.<o:p></o:p></span><br />
<span style="font-family: Arial, sans-serif; font-size: 10pt;"><br /></span>
<br />
<h4>
<span style="font-family: Arial, sans-serif; font-size: large;">index.js</span></h4>
<div class="MsoNormal">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">Configuration file for
the siesta. In order to view and execute a test, you need an entry for your
test file in index.js <o:p></o:p></span><br />
<span style="font-family: Arial, sans-serif; font-size: 10pt;"><br /></span></div>
<h4>
<span style="font-family: Arial, sans-serif; font-size: large;">preload.js (not mandatory)</span></h4>
<div class="MsoNormal">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">In your index.js file
you can define which files should be loaded before your tests run. You can name
it anyway you want, “<i>preload.js”</i> is a nice name. Though this file isn’t
mandatory once you start developing more tests you’ll need a common place to
store common functions and variables. This is why it is very useful. <o:p></o:p></span><br />
<span style="font-family: Arial, sans-serif; font-size: 10pt;"><br /></span>
<span style="font-family: Arial, sans-serif; font-size: 10pt;"><br /></span></div>
<h2>
<span style="font-family: Arial, sans-serif; font-size: x-large;">Writing a Test in Siesta - an Example</span></h2>
<h3>
<div class="MsoNormal" style="font-size: medium; font-weight: normal;">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">Create a test file in your <b>webapp</b> folder – Mytestfile.t.js<o:p></o:p></span></div>
<div class="MsoNormal" style="font-size: medium; font-weight: normal;">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">Code that you think you will use again (in other tests) should be added to your preload.js file.<o:p></o:p></span></div>
<div class="MsoNormal" style="font-size: medium; font-weight: normal;">
<br /></div>
<div class="MsoNormal" style="font-size: medium; font-weight: normal;">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">For example, write a function that finds the submit button on your page and clicks it. (You’ll probably need to click the submit button in many of your tests).<o:p></o:p></span></div>
<div>
<br /></div>
</h3>
<pre class="brush: js">function clickOnButtonSubmit (t, callback) {
// Searching for our Submit button
var button = Ext.ComponentQuery.query('button[action=submit]');
t.chain(
function (next) {
// Clicking the button
t.click(button[0],callback);
});
};
</pre>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">Call the function in
your test file. <o:p></o:p></span></div>
<pre class="brush: js">StartTest(function(t) {
t.chain(
function (next) {
clickOnButtonSubmit(t,next);
}
);
});
</pre>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">Add the test file to
index.js <o:p></o:p></span></div>
<pre class="brush: js">var Harness = Siesta.Harness.Browser.ExtJS;
Harness.configure({
title : 'Awesome Test Suite',
hostPageUrl : '../yourapp/index.html',
preload : [ 'preload.js' ] // Path is relative to the location of the index.js file
});
Harness.start(
'Mytestfile.js', // Path is relative to the location of the index.js file
);
</pre>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<br />
<div class="MsoNormal">
<span style="font-family: Arial, sans-serif; font-size: 10pt;">Open siesta UI and execute
your test!<o:p></o:p></span></div>
</div>
<div class="MsoNormal">
<br /></div>
Anonymoushttp://www.blogger.com/profile/02586783112571690527noreply@blogger.com1