TestQA1
4 years agoFrequent Contributor
Calling JavaScript routines in TestComplete
Hi Folks,
I have been trying to use //[Commonunit] and //[MainUnit] to use one unit into another but it's not working.
Let's say i have one unit called A and another called B. I'm trying to pass call constructor from B.
A:
//[A]
var u, p;
function A(u,p){
this.u = u;
this.p = p;
}
module.exports.A()=A;
B:
//[B]
var c = require(A);
c.A("abc","xyz");
I don't know how to use commonunit and mainunit at the beginning.
Also, I'm using BDD cucumber and want to adopt modularity in my scripts but gherkin supplies parameters in it's when, then statements in feature file. Is there a way I can use variable instead of values in gherkin feature file and supply data from some other unit such as from executing constructor etc. like in oop.
Thanks
I have been trying to use //[Commonunit] and //[MainUnit] to use one unit into another but it's not working.
Let's say i have one unit called A and another called B. I'm trying to pass call constructor from B.
A:
//[A]
var u, p;
function A(u,p){
this.u = u;
this.p = p;
}
module.exports.A()=A;
B:
//[B]
var c = require(A);
c.A("abc","xyz");
I don't know how to use commonunit and mainunit at the beginning.
Also, I'm using BDD cucumber and want to adopt modularity in my scripts but gherkin supplies parameters in it's when, then statements in feature file. Is there a way I can use variable instead of values in gherkin feature file and supply data from some other unit such as from executing constructor etc. like in oop.
Thanks
Great! thanks, works fine.
I'm trying to make my scripts to be able to some OOP things, would that be possible?