Difference between revisions of "Multi-Node Unit Testing"
(New page: frame|Multi-node testing consists of a single [[Driving Node and several Supporting Nodes.]] Multi-Node unit tests require some thinking up front about how t...) |
|||
Line 1: | Line 1: | ||
[[Image:tunit_nodes.jpg|frame|Multi-node testing consists of a single [[Driving Node]] and several [[Supporting Node]]s.]] | [[Image:tunit_nodes.jpg|frame|Multi-node testing consists of a single [[Driving Node]] and several [[Supporting Node]]s.]] | ||
− | Multi-Node unit tests require some thinking up front about how to setup the test. Unlike isolation tests and single-node test suites, there is typically only a single test in each multi-node test suite. | + | Multi-Node unit tests require some thinking up front about how to setup the test. Unlike isolation tests and single-node test suites, there is typically only a single test in each multi-node test suite. A multi-node test implies the radio is in use and communicating to a nearby node. Multiple nodes in a TUnit test bed are intentionally placed close together to reduce the effects of RF issues. After all, we're testing software, not physical RF performance. |
+ | |||
+ | == Setup == | ||
+ | |||
+ | When using the radio, we need to turn it on before the test begins and turn it back off when the test is complete. To do this, access the ''SetUpOneTime'' and ''TearDownOneTime'' TestControl interfaces to turn the radio on and off. | ||
+ | |||
+ | '''TUnit Tip''' | ||
+ | ''Be polite to the next test suite that runs!'' | ||
+ | ''Always turn off your radio when your current test is complete with the'' | ||
+ | ''TearDownOneTime interface.'' | ||
+ | |||
+ | Every node defined in your [[tunit.xml]] Test Run will execute SetUpOneTime before the test runs and TearDownOneTime when the test completes. Here's an example: | ||
+ | |||
+ | '''MultiNodeTestC.nc example configuration file''' | ||
+ | |||
+ | ''0|'' configuration MultiNodeTestC { | ||
+ | ''1|'' } | ||
+ | ''2|'' | ||
+ | ''3|'' implementation { | ||
+ | ''4|'' | ||
+ | ''5|'' components new TestCaseC() as TestSendReceiveC; | ||
+ | ''6|'' | ||
+ | ''7|'' components MultiNodeTestP, | ||
+ | ''8|'' new AMSenderC(0), | ||
+ | ''9|'' new AMReceiverC(0), | ||
+ | ''10|'' ActiveMessageC; | ||
+ | ''11|'' | ||
+ | ''12|'' MultiNodeTestP.SetUpOneTime -> TestSendReceiveC.SetUpOneTime; | ||
+ | ''13|'' MultiNodeTestP.TearDownOneTime -> TestSendReceiveP.TearDownOneTime; | ||
+ | ''14|'' | ||
+ | ''15|'' MultiNodeTestP.AMSend -> AMSenderC; | ||
+ | ''16|'' MultiNodeTestP.Receive -> AMReceiverC; | ||
+ | ''17|'' MultiNodeTestP.SplitControl -> ActiveMessageC; | ||
+ | ''18|'' | ||
+ | ''19|'' } | ||
+ | |||
+ | '''MultiNodeTestP.nc example module file''' |
Revision as of 15:05, 14 January 2008
Multi-Node unit tests require some thinking up front about how to setup the test. Unlike isolation tests and single-node test suites, there is typically only a single test in each multi-node test suite. A multi-node test implies the radio is in use and communicating to a nearby node. Multiple nodes in a TUnit test bed are intentionally placed close together to reduce the effects of RF issues. After all, we're testing software, not physical RF performance.
Setup
When using the radio, we need to turn it on before the test begins and turn it back off when the test is complete. To do this, access the SetUpOneTime and TearDownOneTime TestControl interfaces to turn the radio on and off.
TUnit Tip Be polite to the next test suite that runs! Always turn off your radio when your current test is complete with the TearDownOneTime interface.
Every node defined in your tunit.xml Test Run will execute SetUpOneTime before the test runs and TearDownOneTime when the test completes. Here's an example:
MultiNodeTestC.nc example configuration file 0| configuration MultiNodeTestC { 1| } 2| 3| implementation { 4| 5| components new TestCaseC() as TestSendReceiveC; 6| 7| components MultiNodeTestP, 8| new AMSenderC(0), 9| new AMReceiverC(0), 10| ActiveMessageC; 11| 12| MultiNodeTestP.SetUpOneTime -> TestSendReceiveC.SetUpOneTime; 13| MultiNodeTestP.TearDownOneTime -> TestSendReceiveP.TearDownOneTime; 14| 15| MultiNodeTestP.AMSend -> AMSenderC; 16| MultiNodeTestP.Receive -> AMReceiverC; 17| MultiNodeTestP.SplitControl -> ActiveMessageC; 18| 19| }
MultiNodeTestP.nc example module file