Ask a Question

Calling JavaScript routines in TestComplete

SOLVED
TestQA1
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
2 REPLIES 2
ApplePen
Community Leader

Please try it below capture.

unit2.JPGcomunit.JPG

 

About gherkin, I haven't done it before. Sorry, I can't help you.

Great! thanks, works fine.

 

I'm trying to make my scripts to be able to some OOP things, would that be possible?

 

 

cancel
Showing results for 
Search instead for 
Did you mean: