When my project is growing...

and the code is spread over multiple files it is helpful if I have a test in place to check if my code is still working as expected after some changes or added new features. As you know such test is named regression testing.

To do so, you have to write some test cases where you call methods of your code and check the result if it is working as expected. If you have some of those test cases you will run an automated test that will check that all test cases are successful or show you where are problems.

In other programming languages some test libraries have been mainstream. For Spin I did some work inspired from the Assert class of the Java JUnit library to have the same functionality available for tests.

There is an example (jm_nstrTest.spin2) included how to write a test object including test cases with detailed description as comments.

Note: This Spin object uses the debug feature which was introduced with PNut and will be available soon on the Propeller Tool. Hence, until then such test code is usable only with PNut.

Have fun!
Sign In or Register to comment.