Index: openacs-4/packages/acs-core-docs/www/tutorial-debug.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/tutorial-debug.html,v diff -u -N -r1.45 -r1.46 --- openacs-4/packages/acs-core-docs/www/tutorial-debug.html 8 Nov 2017 09:42:12 -0000 1.45 +++ openacs-4/packages/acs-core-docs/www/tutorial-debug.html 25 Apr 2018 08:38:28 -0000 1.46 @@ -5,7 +5,7 @@

by Joel Aufrecht

</authorblurb> -

Debugging

+

Debugging

Developer Support.  The Developer Support package adds several goodies: debug @@ -42,7 +42,7 @@           

-

Manual testing

+

Manual testing

Make a list of basic tests to make sure it works

@@ -75,14 +75,14 @@ Search for a note.

-

Write automated tests

+

Write automated tests

<authorblurb>

by Simon Carstensen and Joel Aufrecht

</authorblurb>
-

+

It seems to me that a lot of people have been asking for some guidelines on how to write automated tests. I've done several tests by now and have found the process to be extremely easy and useful. It's a joy to work with automated testing once you get the hang of it.

Create the directory that will contain the test script and edit the script file. The directory location and file name are standards which are recognized by the automated testing package:

@@ -134,11 +134,11 @@ aa_true "Note add succeeded" ([info exists new_id] && $new_id ne "")

To test our simple case, we must load the test file into the system (just as with the /tcl file in the basic tutorial, since the file didn't exist when the system started, the system doesn't know about it.) To make this file take effect, go to the APM and choose "Reload changed" for "MyFirstPackage". Since we'll be changing it frequently, select "watch this file" on the next page. This will cause the system to check this file every time any page is requested, which is bad for production systems but convenient for developing. We can also add some aa_register_case flags to make it easier to run the test. The -procs flag, which indicates which procs are tested by this test case, makes it easier to find procs in your package that aren't tested at all. The -cats flag, setting categories, makes it easier to control which tests to run. The smoke test setting means that this is a basic test case that can and should be run any time you are doing any test. (a definition of "smoke test")

Once the file is loaded, go to ACS Automated Testing and click on myfirstpackage. You should see your test case. Run it and examine the results.

-

TCLWebtest tests

+

TCLWebtest tests

API testing can only test part of our package - it doesn't test the code in our adp/tcl pairs. For this, we can use TCLwebtest. TCLwebtest must be installed for this test to work. This provides a library of functions that make it easy to call a page through HTTP, examine the results, and drive forms. TCLwebtest's functions overlap slightly with acs-automated-testing; see the example provided for one approach on integrating them.

-

Example

+

Example

Now we can add the rest of the API tests, including a test with deliberately bad data. The complete test looks like:

ad_library {
Test NumActionExpected Result