cancel
Showing results for 
Search instead for 
Did you mean: 

Can't have objects methods

SOLVED
Highlighted
New Contributor

Can't have objects methods

Hello!
I have the following trouble.
In Unit 1 I create a class and define its properties and methods.

function MyClass() 
{
  this.myProperty;
}

FileClass.prototype.myMethod = function(){
  \\code
  return result;
}

I have written export.

module.exports.MyClass = MyClass; 

Now I want to use it in Unit 2.
I connect import.

var MyClassUnit = require("Unit1");

I create an object and use it.

myObject = new MyClassUnit.MyClass();
// do something
myObject.myMethod();
// it works

But there is one question: when I write the name of the object and put a dot after it TestComplete (IDE) does not offer me the available methods and attributes, I have to write with my hands, which is inconvenient when there are a lot of methods to constantly look at a Unit1.


How can I solve this problem?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: Can't have objects methods

I'm not sure what you're asking... another way to do what?  Get a Code Completion to popup on objects instantiated on classes declared in another unit?  Not really, no.  


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

4 REPLIES 4
Highlighted
Community Hero

Re: Can't have objects methods

You can't.  The code completion of TestComplete does not bring over methods and properties of objects declared in another unit using the module.exports method.  


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Highlighted
New Contributor

Re: Can't have objects methods

Thank you!

But maybe is there some other way to make what I want?

Highlighted
Community Hero

Re: Can't have objects methods

I'm not sure what you're asking... another way to do what?  Get a Code Completion to popup on objects instantiated on classes declared in another unit?  Not really, no.  


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

Highlighted
New Contributor

Re: Can't have objects methods

Thanks for your answer!

New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!

Challenge Status

How to execute remote test and obtain results via Test Runner REST API

Participate!

Comparing content of HTML table with Excel file data

Participate!

Compare HTML table with Excel file and correct data in the file

Participate!

Retrieve Data from a Web Page

Participate!
Top Kudoed Authors