Jump to content
Sign in to follow this  
JKI

Creating New Tests

Recommended Posts

Add a new test case to your project.

A "test case" is a special LabVIEW class that contains unit test methods. VI Tester recognizes unit test methods as members of a test case class whose name starts with "test". To get started, please watch this brief tutorial video and then follow the walkthrough below.

 

You can create a new test case by selecting Tools >> VI Tester >> New >> Test Case... from the menubar of the Project Explorer window.

 

Browse to a folder where you want to create the test case, type a name for the test case, and press the "OK" button. VI Tester will create a folder for your test case (having the same name as your test case). Inside this folder will be your new test case class along with some other useful VIs. The new test case class will will be added to your LabVIEW project and under the "My Computer" node.

 

New_Test.png

 

Add a new unit test (method) to your new test case.

To create new tests, save a new copy of "testExample.vi" using the "Open additional copy" option of the "Save As" dialog. Make sure to check the box that says 'Add copy to {MyTest}.lvclass' where {MyTest} is the test you created.

 

Customize the unit test and its pass/fail criteria.

The following video gives a short tutorial on how to define the test pass/fail criteria:

 

 

Tests pass when there are no test failures or errors. You can write tests quickly by using the built in test evaluations found on the Test Case palette, shown below:

 

VI_Tester_Evaluations.png

 

For example, if you need to test that an error is raised, use 'passIfError.vi'. If none of the built-in evaluations is sufficient for the type of test you need to perform, you can use the Error status to define test behavior, any test with an Error will fail.

 

But, don't branch your test case object wire!

 

Note: Be careful not to branch the TestCase object wire! The easiest way to avoid this, is to treat the TestCase object wire much like you would treat the error cluster, never allow it to branch.

 

Good (no branching of the TestCase object):

Good_Test.png

 

Note how the object wire is not branched.

 

Bad (branching of the TestCase object):

Bad_Test_1.png

 

Note that the object wire is branched. VI Tester will not be able to evaluate the result correctly.

 

Move on to designing a test.

If you've gotten this far, why not learn some other aspects of designing a test.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.