|
|
||||||||||
|
|||||||||||
Advice and Techniques for Real-time TestingReal-time software can be difficult to test and debug. This article presents some techniques and advice that may be useful.Prevent ProblemsThe purpose of testing is to uncover problems. Problems can be minimized up front by adhering to the following guidelines.
Write Simple CodeWrite code that can be easily understood. Do not optimize at the expense of clarity. Do not get too elegant as this can complicate code unnecessarily. Avoid multiple levels of code or data (too many levels of functions or structures within structures within...). Use comments for function headers and where absolutely necessary, but in general, do not clutter the code with comments.Use Simple AlgorithmsComplexity provides more opportunity for error. Take the simple approach. Avoid implementing complex mathematical algorithms. Rather, implement simple algorithms derived from first hand experience.Develop Code From the Bottom UpDevelop and test low level code first. Once low level code is working you can develop the next level of code and so on.Avoid Recovery SchemesReal-time applications can be quite complex, involving a number of different states, especially when dealing with mechanical systems. When fault conditions occur in such systems choose to fail simply and gracefully rather than attempt an elaborate recovery.Avoid PreemptionPreemption can cause time dependent errors and should be avoided. Preemption can occur when tasks run at different priorities or time-slicing is enabled.Allocate Time for TestingTime must be allocated for testing. Testing usually takes at least as long as code development time and usually longer. Plan accordingly.System TestingAfter modules have been individually tested the entire system should be tested. For simple systems testing can be effected by turning on the system and running it through its various modes of operation. For more complex systems, this is not possible, in which case simulation can be used.Simulation or Scenario TestingSome systems are so complex that they must be tested using software simulation. Consider a central telephone switching computer which accepts and routes calls. A system such as this requires thousands of incoming phone calls per second under various loading conditions and modes of operation for adequate testing. One testing approach would be to put the system into public operation and observe how it performs. A more acceptable approach would be to simulate the thousands of calls, loading conditions, and modes of operation with simulation software.RemarksMuch more could be written on this subject. If you have an interest please let us know and we may write a more comprehensive article.
We welcome comments. Let us know what subjects you would like written up.
Send comments to Mike@TicsRealtime.com
Copyright © 2000, Tics Realtime
| |||||||||||