Siesta - writing automated tests
Since this page will NOT teach you all you need to know about siesta configuration, settings and functions I strongly recommend that you spend some time reading about siesta.Here are a few useful links:
- Siesta
homepage - http://www.bryntum.com/products/siesta/
- Siesta
API - http://www.bryntum.com/docs/siesta/#!/api
- Siesta
Introduction - http://www.bryntum.com/docs/siesta/#!/guide/siesta_getting_started
Siesta Basics (Briefly)
There are 3 files that needs to be modified when writing a new test in siesta:- index.js
- preload.js
– This file is loaded before your tests run.
- your
test file (you can pick any name you want, but keep it meaning-full and in
order) for example - Mytestfile.t.js
In your webapp directory you can place your new siesta tests and directories.
index.js
Configuration file for
the siesta. In order to view and execute a test, you need an entry for your
test file in index.js
preload.js (not mandatory)
In your index.js file
you can define which files should be loaded before your tests run. You can name
it anyway you want, “preload.js” 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.
Writing a Test in Siesta - an Example
Create a test file in your webapp folder – Mytestfile.t.js
Code that you think you will use again (in other tests) should be added to your preload.js file.
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).
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); }); };
Call the function in
your test file.
StartTest(function(t) { t.chain( function (next) { clickOnButtonSubmit(t,next); } ); });
Add the test file to
index.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 );
Open siesta UI and execute
your test!
Hi ,
ReplyDeleteCould you please tell how to Send an E-mail with the siesta Test Execution Reports.