cancel
Showing results for 
Search instead for 
Did you mean: 

Can I use any unit testing framework like NUnit so that I can use attributes like before/after test?

SOLVED
Highlighted
Occasional Contributor

Can I use any unit testing framework like NUnit so that I can use attributes like before/after test?

This is for desktop application automation

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

Re: Can I use any unit testing framework like NUnit so that I can use attributes like before/after t

Just note:

Natively, there are no "attributes" like exists in NUnit.  TestComplete is not, natively, a unit testing tool.  It is a UI driven functional testing tool that allows you to write code to do so.  So, any "attribute" implementation you'll have to write your own custom code to simulate the NUnit framework... the framework, itself, does NOT exist in TestComplete so you'll have to, basically, "reinvent the wheel" to implement it in TestComplete.

 

I would recommened building a framework of your own, potentially borrowing from what NUnit does, but you don't need to go quite as far as the Unit Testing framework does.


Robert Martin
[Community Expert Group]
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
Extensions available
5 REPLIES 5
Community Hero

Re: Can I use any unit testing framework like NUnit so that I can use attributes like before/after t

Not sure what you're asking...  Are you asking can you call NUnit tests from within TestComplete? 

the answer is yes, along with a number of frameworks.

https://support.smartbear.com/testcomplete/docs/working-with/integration/unit-test-frameworks/index....

 

If you're asking can you write NUnit code in TestComplete... not exactly.  You can write pretty good complicated code in TestComplete but you're limited in that TestComplete is script code so single threaded and not necessarily fully OOP.  

There are also "OnStartTest" and "OnStopTest" event handlers that you can use to execute before/after stuff.


Robert Martin
[Community Expert Group]
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
Extensions available
Occasional Contributor

Re: Can I use any unit testing framework like NUnit so that I can use attributes like before/after t

I am asking that is there any way to organize my test methods in test complete by using attributes of any kind?

so that test complete interpreter can automatically detect my test and run

Occasional Contributor

Re: Can I use any unit testing framework like NUnit so that I can use attributes like before/after

 
Community Hero

Re: Can I use any unit testing framework like NUnit so that I can use attributes like before/after t

The concept of "attributes" of a test is not part of TestComplete...  tests are not "objects" like a Unit test is in NUnit or JUnit.  In fact, a "test" in TestComplete can consist of Script, KeywordTests, etc., and even a whole bunch of code that turns into a "Test" depending upon how you code it.  So, to define a "test" is your first step... what is a test in your methodology?  Once you've defined that, you can write code around that to assign whatever functions, methods, properties, etc., you want to.

 

In my case, I have a framework where a test consistes of a KeywordTest.  However, I use an SQL structure to determine what tests to run and determine, based upon events and other processes within the tests, whether the test is successful or not and do any "set up" or "tear down" processes that go along with that test.

It really is all about how you're writing your code for tests.  I would say... give it a try.  Start trying things out and see what works.  If you need specific help in implementing something, feel free to ask about it.  Generally speaking, TestComplete is VERY flexible in how you implement tests and such so there probably IS a way to do what you want. So... try it.  See what you can do.  And then ask questions.


Robert Martin
[Community Expert Group]
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
Extensions available
Community Hero

Re: Can I use any unit testing framework like NUnit so that I can use attributes like before/after t

Just note:

Natively, there are no "attributes" like exists in NUnit.  TestComplete is not, natively, a unit testing tool.  It is a UI driven functional testing tool that allows you to write code to do so.  So, any "attribute" implementation you'll have to write your own custom code to simulate the NUnit framework... the framework, itself, does NOT exist in TestComplete so you'll have to, basically, "reinvent the wheel" to implement it in TestComplete.

 

I would recommened building a framework of your own, potentially borrowing from what NUnit does, but you don't need to go quite as far as the Unit Testing framework does.


Robert Martin
[Community Expert Group]
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
Extensions available