Difference between revisions of "Test-Suite Template"

From ApCoCoAWiki
m
Line 6: Line 6:
  
 
   -- Test suite for "package name" <br>
 
   -- Test suite for "package name" <br>
  Alias TSL := $ts/ts_lib;
 
 
   -------------------------------
 
   -------------------------------
 
   -- TEST 01:<br>   
 
   -- TEST 01:<br>   
Line 32: Line 31:
 
==Adding your test-suite to the file apcocoats.cpkg==
 
==Adding your test-suite to the file apcocoats.cpkg==
 
To add your new test to the complete ApCoCoA-test-suite, you have to add some lines to the file apcocoats.cpkg, This file can be found in the /apcocoa/ts directory.
 
To add your new test to the complete ApCoCoA-test-suite, you have to add some lines to the file apcocoats.cpkg, This file can be found in the /apcocoa/ts directory.
Insert 3 lines like this:
+
Insert the name of the testet package into the list "RegisteredTests":
  
   Print "package_name.ts";
+
   RegisteredTests :=  ["glpk",
  Source CocoaPackagePath()+"/ts/package_name.ts";
+
    "latte",
  TSL.Do();
+
    "borderbasis",
 
+
    "linalg",
to the function RunTests() in the apcocoats package
+
    "linbox",
 +
    "iml",
 +
    "fglm",
 +
    "numabm",
 +
    "numbasics",
 +
    "numavi",
 +
    "yourpackage"];

Revision as of 15:32, 8 October 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" 
------------------------------- -- 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 apcocoats.cpkg

To add your new test to the complete ApCoCoA-test-suite, you have to add some lines to the file apcocoats.cpkg, This file can be found in the /apcocoa/ts directory. Insert the name of the testet package into the list "RegisteredTests":

 RegisteredTests :=  ["glpk",
   "latte",
   "borderbasis",
   "linalg",
   "linbox",
   "iml",
   "fglm",
   "numabm",
   "numbasics",
   "numavi",
   "yourpackage"];