-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Pasilla is a framework that allows a tester to create Protractor tests without writing any JavaScript code. The tester uses familiar tools to simply assemble a sequence of keywords and data into a test script. Excel is used to create the test script and is also used to maintain a centralised store of test data. Pasilla provides utilities to automatically convert the Excel test script and data into pure JavaScript Protractor code. This means that the tests can be run using any tool that supports Protractor like WebStorm IDE, Grunt and TeamCity. So, Pasilla takes the pain out of developing Protractor tests without losing the benefits of the Jasmine BDD format and the integration with other tools.
It all sounds a little too good to be true and, in a way, it is. The JavaScript Protractor code underpinning each keyword still has to be handcrafted. Pasilla helps with this by standardising the way in which the keyword program code is written - how it is called, how it handles data passed to it, and how it can be reused and combined with other keywords.
The diagram below shows the "traditional" organisation of a Protractor test. It involves a protractor config file (eg "protractorConfig.js") and one or more specification files that end with ".pro.js". These files contain JavaScript code. The specification file, "myTest.pro.js" in the example below, is in the Jasmine "describe/it" format.
Pasilla is pretty much the same except for the introduction of a script file (ending with ".script.js") and an optional test data file (ending with ".data.js") as shown in the diagram below. Again, these files are JavaScript code files. This time the "myTest.pro.js" specification file has a slightly different structure. It still contains the "describe" but instead of a static sequence of "it" sections it uses a looping mechanism that reads in the "myTest.script.js" file and implements the appropriate set of "it" sections dynamically at run-time.
The main premise behind Pasilla is that its keyword-based approach makes the creation of test scripts easier. This section compares a Protractor specification with the equivalent Pasilla script.
describe('Example test scenario', function () {
// --------------------------------------------------- // ---------------------------------------------------
it("Start", function () { it("DoSomething C", function () {
var browser="chrome"; var param1='data1';
var url='http://www.Example.com'; var param2='data2';
// code for functionality goes here // code for functionality goes here
// can use expect().toEqual() for assertions // can use expect().toEqual() for assertions
},120000); },120000);
// --------------------------------------------------- // ---------------------------------------------------
it("Signin", function () { it("DoSomething D", function () {
var username='testuser1'; var param1='data1';
var password='3X4mpl3'; var param2='data2';
// code for functionality goes here // code for functionality goes here
// can use expect().toEqual() for assertions // can use expect().toEqual() for assertions
},120000); },120000);
// --------------------------------------------------- // ---------------------------------------------------
it("DoSomething A", function () { it("DoSomething E", function () {
var param1='data1'; var param1='data1';
var param2='data2'; var param2='data2';
// code for functionality goes here // code for functionality goes here
// can use expect().toEqual() for assertions // can use expect().toEqual() for assertions
},120000); },120000);
// --------------------------------------------------- // ---------------------------------------------------
it("DoSomething B", function () { it("Signout", function () {
var param1='data1'; // code for functionality goes here
var param2='data2'; // can use expect().toEqual() for assertions
// code for functionality goes here },120000);
// can use expect().toEqual() for assertions // ---------------------------------------------------
},120000); it("End", function () {
// code for functionality goes here
// can use expect().toEqual() for assertions
},120000);
}, 60000);
###Pasilla Script
var Session1 = [
[{action:'Example.Start',params:[{browser:'chrome',url:'http://www.Example.com'}]}],
[{action:'Example.Signin',params:[{username:'testuser1',password:'3X4mpl3'}]}],
[{action:'Example.DoSomethingA',params:[{param1:'data1',param2:'data2'}]}],
[{action:'Example.DoSomethingB',params:[{param1:'data1',param2:'data2'}]}],
[{action:'Example.DoSomethingC',params:[{param1:'data1',param2:'data2'}]}],
[{action:'Example.DoSomethingD',params:[{param1:'data1',param2:'data2'}]}],
[{action:'Example.DoSomethingE',params:[{param1:'data1',param2:'data2'}]}],
[{action:'Example.Signout',params:[{none:''}]}],
[{action:'Example.End',params:[{none:''}]}]
];
module.exports = Session1;The script above was actually generated from the following spreadsheet.
Pasilla
Links: Home, [General Concepts](General Concepts), Tutorial - Create a New Test, Data Parameters