Forum Discussion

Amna_Saeed321's avatar
Amna_Saeed321
Occasional Contributor
6 years ago

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!

  • 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.

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

  • Bobik's avatar
    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's avatar
      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.

      • LinoTadros's avatar
        LinoTadros
        Community Hero

        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

    • Amna_Saeed321's avatar
      Amna_Saeed321
      Occasional Contributor

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