Ask a Question

Can we access the variables or objects in TestComplete from nunit Test

SOLVED
Amna_Saeed321
Occasional Contributor

Can we access the variables or objects in TestComplete from nunit Test

I am automating rest webservices in c# using nunit framework. Now I want to get the response in variable in my test complete Project. Currently , when I execute the nunit test through Test Complete, It just return the true status. I am wondering if there is any way that i can get access to variable of my nunit test in TestComplete? or i can access the Project variable of TestComplete project in Visual Studio so that i can set the variable with results in nunit test? Please Help!

7 REPLIES 7
Bobik
Frequent Contributor

There is no way to access TC variables from the unit test. The best way I think is to write values into files and then read it by TC script.

tristaanogre
Esteemed Contributor

To expand on @Bobik , generally speaking, running Unit tests via TestComplete is simply provided to give you a central execution point for your tests rather than having unit tests run in one tool and functional in another.  So, all that is supported is generally a way of executing.  Passing variables back and forth between the unit test and TestComplete automation will have to be done via some other vehicle, either via file, registry key, data table, etc.


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

You can get access to TestComplete Project variables and ProjectSuite variables from NUnit tests in C# (Visual Studio).  You will need to instantiate the TestComplete Automation Server in C#, open the project and make changes to the variable object in the project using COM automation.

 

Cheers

Lino


@LinoTadros wrote:

You can get access to TestComplete Project variables and ProjectSuite variables from NUnit tests in C# (Visual Studio).  You will need to instantiate the TestComplete Automation Server in C#, open the project and make changes to the variable object in the project using COM automation.

 

Cheers

Lino


I think there's also an API now for TestComplete, typically accessed via TestLeft but you should be able to get to it from VisualStudio.


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
TanyaYatskovska
SmartBear Alumni (Retired)

Community, thanks for your great suggestions!

 

@Amna_Saeed321, was the question answered? Please select the best answer as a solution or share your own solution.

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager



Amna_Saeed321
Occasional Contributor

Thanks everyone for the help. much appreciated

Amna_Saeed321
Occasional Contributor

I exported API response in text file through nunit test and import it in test complete. It worked for me.

cancel
Showing results for 
Search instead for 
Did you mean: