Ask a Question

Imported Keyword test does not work

SOLVED
PingS
Occasional Contributor

Imported Keyword test does not work

I am developing some autotest for a web site. All the tests will start from login page and login with user name and password. I planed to have to projects in the project suite: Project A to Project B. In Project A, I recorded a keyword test i to perform the login actions. In Project B, I imported the LoginTest of Project A. Then I created a keyword test (DashBoardTest) in Project B. The first step of the DashBoardTest is to run LoginTest.

 

I run the LoginTest in Project A, it works fine.

 

I run the DashBoard test in Project B, it launched the LoginPage but it can not find the Username input box and then it stops working.

 

This is a simple test to test the importing keyword test from one project to another. But it seems not working well.

What have I missed? I also notice, there is no "Reload" right click menu context. I am using Test Complete 12. How do I refresh the imported test?

7 REPLIES 7
tristaanogre
Esteemed Contributor

The keyword test is probably referencing name mapped objects.  So, you may have copied the keyword test to the new project but it is dependant upon the NameMapping scheme as well.  Try sharing the name mapping between projects as well.


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
PingS
Occasional Contributor

I am new to Test Complete. How do I share the Name mapping? 

tristaanogre
Esteemed Contributor

One of two ways:

1) Right click on the project and select "Add -> Existing Item" and navigate to the NameMapping.tcNM from Project A and add it to Project B.  The benefit of doing it this way is that, anytime you update object identification in either project, it will immediately update it in the other project.  Requires Project B to not have a pre-existing NameMapping node... can be removed/deleted from the project if you desire to go this route.

 

2) Right click on the NameMapping node of Project B and select "Merge" then navigate to the NameMapping file from Project A and complete the merge.  The benefit of doing it this way is that you can isolate the NameMapping for the two projects so that changes in one don't affect the other.

 

On a side note:

Please find and view a TestComplete 101 webinar... you can attend one live or watch the recording of one.  Either way, this will give you the basics of TestComplete.  NameMapping is one of the core pieces of TestComplete and is the default behavior for object identification.  Everything dealing with onscreen components references NameMapping.  SO, get an understanding of NameMapping and you'll have a good portion of TestComplete known... and the webinars cover a good bit of this.


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
PingS
Occasional Contributor

Thank you for your guidance. The importing feature is supposed to have just references to the imported tests. It seems like that the Name mapping object does not have the Namespace concept build in. 

 

By the way, how do I refresh the imported keyword test if it is modified or its name modified in the original project? How do I get that "Reload" menu option? The image shows what I see in my project. The CU_LaunchLogin is an imported test.

tristaanogre
Esteemed Contributor

Import feature? Reload option?  Namespace of NameMapping? I'm not sure what you're referencing.  What I see on your screenshot is that the CU_LaunchLogin keyword test is shared with another project.  So, I'm assuming you used the Add -> Existing item to add that keyword test to project B.  

 

And yes, the "importing" references the imported test... FILE... So, there's a file on your drive called CU_LaunchLogin.tcKDT.  When you did "add existing item", it linked that file to the new project.  Renaming the file will break that link.  If you change the file contents in one project, the update is automatic to the other.

 

Here's some hints:

1) Think of each "project" in TestComplete as if it is an application being developed in an IDE.  

2) Each keyword test is a unit of code in that application

3) As in an application, if you change a unit of code in one application, all applications that use that same unit of code are automatically updated.

4) If you delete, remove, rename, or otherwise alter the file identification of the unit of code, that will "break" all those other applications unless you go to them and make the same updates

5) NameMapping, while not quite like a unit of code, follows the same rules.  It is a file that, by default, "belongs" to a project.  So, each project has it's own NameMapping file.  As mentioned above, you can share the NameMapping between projects either by having them share the same file directly OR by manually merging the files as necessary.

 

Again, please look into getting into the basic TestComplete 101 training.  These are basic concepts to TestComplete covered in the training and in the documentation.


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

I did some quick research... the "Reload" option only becomes visible if necessary.  By default, if you change a file in one project and save it, you will get a prompt saying something like the following:

 

reloadprompt.png

 

If you say "Yes" to that, it will reload automatically and the "reload" option will not display in the context menu.  If you select "No", then the contents will remain as is until you right-click and select "Reload" manually from the context.  So, based upon this, your screenshot does not show the "Reload" because no reload is necessary.


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
PingS
Occasional Contributor

Thank you very much! I will start to review the 101.

cancel
Showing results for 
Search instead for 
Did you mean: