Difference between revisions of "Test-Suite Template"

From ApCoCoAWiki
m
Line 14: Line 14:
 
   ''CoCoAL-code to test''  
 
   ''CoCoAL-code to test''  
 
   ";<br>
 
   ";<br>
   Test.ExpectedOutput :=
+
   Test.ExpectedOutput :="
 
   ''Output of ApCoCoA after executing the code above''
 
   ''Output of ApCoCoA after executing the code above''
   ;<br>
+
   ";<br>
 
   TSL.RegisterTest(Test);<br>
 
   TSL.RegisterTest(Test);<br>
 
   -------------------------------
 
   -------------------------------
Line 24: Line 24:
 
   ''CoCoAL-code to test''  
 
   ''CoCoAL-code to test''  
 
   ";<br>
 
   ";<br>
   Test.ExpectedOutput :=
+
   Test.ExpectedOutput :="
 
   ''Output of ApCoCoA after executing the code above''
 
   ''Output of ApCoCoA after executing the code above''
   ;<br>
+
   ";<br>
 
   TSL.RegisterTest(Test);
 
   TSL.RegisterTest(Test);
 
   -------------------------------
 
   -------------------------------

Revision as of 18:39, 18 June 2009

Testing an ApCoCoA-Package

This page explains how to create a test-suite for your package. Testing is important to make sure, that your package is still working correctly, when something in ApCoCoA or the ApCoCoALib changes.

A template for a test-suite

Your test should be named like the corresponding package and file ending should be .ts

 -- Test suite for "package name" 
Alias TSL := $ts/ts_lib; TSL.Initialize();
------------------------------- -- TEST 01:
Test := Record[Id = "package_01", Descr = "your description"];
Test.Input :=" CoCoAL-code to test ";
Test.ExpectedOutput :=" Output of ApCoCoA after executing the code above ";
TSL.RegisterTest(Test);
------------------------------- -- TEST 02:
Test := Record[Id = "package_02", Descr = "your description"];
Test.Input :=" CoCoAL-code to test ";
Test.ExpectedOutput :=" Output of ApCoCoA after executing the code above ";
TSL.RegisterTest(Test); ------------------------------- ...

Adding your test-suite to the file all.ts

To add your new test to the complete ApCoCoA-test-suite, you have to add some lines to the file all.ts, This file can be found in the modified-cocoa-files directory.

 Print "package_name.ts";
 Source CocoaPackagePath()+"/ts/package_name.ts";
 TSL.Do();