Unit Testing Group

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with overriding setUp.vi in JKI VI Tester

Hi all,

 

Apologies if I posted this twice!

 

I am trying to get started with VI Tester. I would like to leverage the inheritance of TestCases to reduce the amount of code I need to write. I first tried to add tests to a large AF project I am working on and hit a problem, so I then tried to make practice project based on Nate Mohering's LAF talk. Please find attached!

 

I have created an Animal parent class and Rabbit and Fox child classes with a parallel TestCase hierarchy. The children's Create.vi gives them each a specific string to say. The setUp.vi for each classes inserts a configured Animal object into the TestCase. The test behaviour is general and implemented in the Animal class (testSpeak.vi). I want to run a test for each child, so I created dummy testSpeak.vi TestCases in the children so that VI Tester picks them up.

 

When I run VI Tester I get an error:

-------

testSpeak (Rabbit_TestCase)
 ...
ERROR 0.000 sec details [code: 1 source: Rabbit_TestCase.lvclass:setUp.vi<ERR>
TestCase object returned by the test method must be same object that was passed in by the framework.]

-------

 

Any advice on what I am doing wrong or a better approach would be much appreciated!

 

In my real project I have an actor parent with simulation and hardware interacting children. I want use setUp.vi to initialise and insert a specific child into the TestCase and then call a generic test method in the TestCase of the parent, since the test method is general: Send GetData.msg, receive Data.msg. The implementation is specific to each child and carried out with a set of helper actors. I then want to shut down the helpers in overrides of tearDown.vi which are specific to the children. But here, again, I could use a Destroy.vi method call that could mean that tearDown.vi becomes generic. But to do all of this I first have to get the basic system described above to work!

 

Thanks in advance,

 

Max

 

CLA - Kudos is how we show our appreciation for comments that helped us!
0 Kudos
Message 1 of 2
(2,844 Views)

Oh! I think I fixed it!

 

The problem occurs when I have the WaitOnTestComplete.vi in the parent method. The problem does not occur when WaitOnTestComplete is in the child, after the Call Parent Method, in setUp.vi.

 

I will include a fixed project shortly!

 

Max

CLA - Kudos is how we show our appreciation for comments that helped us!
0 Kudos
Message 2 of 2
(2,830 Views)