Support Forum
My project is web project(say A), in that i have created 1 more Siesta web project where I have kept all the test scripts.
I want to keep my button specification like style, height etc in a singleton constant file in the Siesta project. When I try to access this constant file from the testscript in siesta, it gives file not found error as it tries to
find the file in the Web Project(A) instead of Siesta project.
Request you to please suggest..
Thanks
Sonika
I want to keep my button specification like style, height etc in a singleton constant file in the Siesta project. When I try to access this constant file from the testscript in siesta, it gives file not found error as it tries to
find the file in the Web Project(A) instead of Siesta project.
Request you to please suggest..
Thanks
Sonika
/*suppose this is class A containing variable**************************************************************************************/
Class('appTesting.com.adaptiveAnalytics.reqSpecification.CssSpecification', {
isa : Siesta.Test.ExtJS,
has : {
// will be initialized with atomic values
attribute1 : null,
attribute2 : 'foo',
attribute3 : 11,
}
});
/* This is class B containing method login**********************************************************************************************/
Class('appTesting.com.adaptiveAnalytics.utils.LoginApp', {
isa : Siesta.Test.ExtJS,
methods: {
login : function (user, pw, next) {
var me = this;
this.chain(
{ waitFor : 'componentVisible', args : '#loginButton' },
function(next) {
me.cq1('#user').setValue(user);
me.cq1('#pwd').setValue(pw);
next();
},
{ action : 'click', target : '>> #loginButton' },
{ waitFor : 'xType', args : 'menu'},
next
);
}
}
});
/* there is 3rd class C which will access both class A and Class B by calling there method and attribute*********************************************************************/
StartTest(function(t)
{
t.chain(
function(next)
{
alert(t.attribute1); /* from class A */
t.login('admin', 'test@123',next); /* from Class B*/
},
);
});
In order that Class C can use variable and method of Class A and Class B we have included the path in Harness.js
Harness.configure({
title : 'Sencha Touch 2 samples',
enableCodeCoverage : true,
testClass : appTesting.com.adaptiveAnalytics.reqSpecification.CssSpecification,
transparentEx:false,
preload : [
"./appTesting/resources/css/sencha-touch.css",
"./appTesting/resources/sencha-touch-all-debug.js",
"appTesting.com.adaptiveAnalytics.reqSpecification.CssSpecification", /* This is Class A*/
" appTesting.com.adaptiveAnalytics.utils.LoginApp" /*This is Class B*/
],
keepNLastResults : 2
});
if we give Class B i.e " appTesting.com.adaptiveAnalytics.utils.LoginApp " in testClass . then Class C will access attribute/method of Class B.
How can Class C access the attribute and method of both Class A and Class B
Hi,
1) I see you include sencha-touch files in your preload, but your test classes inherits from Siesta.Test.ExtJS? Perhaps they should inherit from Siesta.Test.SenchaTouch?
2) Do not include your test classes files in the preloads. Treat those files as your extensions for Siesta, and thus include them on the harness page, right after the "siesta-all.js".
3) If I understood you correctly, you have 2 test classes, both of which inherit from Siesta.Test.ExtJS and you would like to re-use some methods from both classes in the 3rd test class. To do that, move such methods to the Joose role (role is something similar to mixin), and then consume that role in appropriate classes, using the "does" keyword.
For example:
Both TestClass1 and TestClass2 will have the "reusableMethod1" and "reusableMethod2" from the consumed role.
1) I see you include sencha-touch files in your preload, but your test classes inherits from Siesta.Test.ExtJS? Perhaps they should inherit from Siesta.Test.SenchaTouch?
2) Do not include your test classes files in the preloads. Treat those files as your extensions for Siesta, and thus include them on the harness page, right after the "siesta-all.js".
3) If I understood you correctly, you have 2 test classes, both of which inherit from Siesta.Test.ExtJS and you would like to re-use some methods from both classes in the 3rd test class. To do that, move such methods to the Joose role (role is something similar to mixin), and then consume that role in appropriate classes, using the "does" keyword.
For example:
Role('ReusableMethods', {
has : {
reusableAttribute1 : null
},
methods : {
reusableMethod1 : function () {
},
reusableMethod2 : function () {
}
}
})
Class('TestClass1', {
isa : Siesta.Test.ExtJS,
does : ReusableMethods,
methods : {
methodForTestClass1 : function () {}
}
})
Class('TestClass2', {
isa : Siesta.Test.ExtJS,
does : ReusableMethods,
methods : {
methodForTestClass2 : function () {}
}
})
Read the API documentation
Hi,
The example given by you in last post having
one class 'ReusableMethods' which contains variable and method .
two class 'TestClass1' and 'TestClass2' uses the method defined in class 'ReusableMethods'.
But we need to implement suppose there is
2 class 'TestClass1' and 'TestClass2' both have their own variable and methods defined , then
3rd class suppose 'MasterClass' need to call the method defined in TestClass1 as well as TestClass2.
Then how can masterClass can call the methods of TestClass1 and TestClass2
The example given by you in last post having
one class 'ReusableMethods' which contains variable and method .
two class 'TestClass1' and 'TestClass2' uses the method defined in class 'ReusableMethods'.
But we need to implement suppose there is
2 class 'TestClass1' and 'TestClass2' both have their own variable and methods defined , then
3rd class suppose 'MasterClass' need to call the method defined in TestClass1 as well as TestClass2.
Then how can masterClass can call the methods of TestClass1 and TestClass2
Hi Mats,
Thanks for the reply.
There is one issue that when we use the does keyword in the code it is not able to recognize the Role file ReusableMethods and gives an exception "Uncaught ReferenceError: ReusableMethods is not defined " on the below line.
does: [ReusableMethods],
It seems may be there is some configuration entry required by which the siesta framework can recognize the ReusableMethods class which we are missing.
Request you to please assist.
Thanks for the reply.
There is one issue that when we use the does keyword in the code it is not able to recognize the Role file ReusableMethods and gives an exception "Uncaught ReferenceError: ReusableMethods is not defined " on the below line.
does: [ReusableMethods],
It seems may be there is some configuration entry required by which the siesta framework can recognize the ReusableMethods class which we are missing.
Request you to please assist.