Index: openacs-4/packages/acs-automated-testing/acs-automated-testing.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-automated-testing/acs-automated-testing.info,v diff -u -N -r1.10 -r1.11 --- openacs-4/packages/acs-automated-testing/acs-automated-testing.info 24 Feb 2004 14:23:03 -0000 1.10 +++ openacs-4/packages/acs-automated-testing/acs-automated-testing.info 26 Feb 2004 14:40:27 -0000 1.11 @@ -7,14 +7,17 @@ t f - + OpenACS The interface to the automated testing facilities within OpenACS. - 2004-01-21 + 2004-02-26 OpenACS - Provides a UI for viewing and running automated tests provided by each package within the OpenACS system. + Provides a UI for viewing and + running automated tests provided by each package within the + OpenACS system. Also provides a UI for managing + automatic-rebuild servers as in a test farm. - + Index: openacs-4/packages/acs-automated-testing/www/doc/index.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-automated-testing/www/doc/index.html,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/acs-automated-testing/www/doc/index.html 29 Jan 2004 12:57:18 -0000 1.5 +++ openacs-4/packages/acs-automated-testing/www/doc/index.html 26 Feb 2004 14:40:27 -0000 1.6 @@ -1 +1 @@ -Automated Testing

Automated Testing


Table of Contents

Installation
Requirements
View comments on this page at openacs.org
+Automated Testing

Automated Testing


View comments on this page at openacs.org
Index: openacs-4/packages/acs-automated-testing/www/doc/install.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-automated-testing/www/doc/install.html,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/acs-automated-testing/www/doc/install.html 29 Jan 2004 12:57:18 -0000 1.3 +++ openacs-4/packages/acs-automated-testing/www/doc/install.html 26 Feb 2004 14:40:27 -0000 1.4 @@ -1,7 +1,7 @@ -Installation

Installation

+Installation

Installation

by Joel Aufrecht

OpenACS docs are written by the named authors, and may be edited by OpenACS documentation staff.

Automated Testing is part of acs-core, and therefore should already be installed in any OpenACS system. Individual automated tests are stored within each package in package/tcl/test. -

View comments on this page at openacs.org
+

View comments on this page at openacs.org
Index: openacs-4/packages/acs-automated-testing/www/doc/requirements.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-automated-testing/www/doc/requirements.html,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/acs-automated-testing/www/doc/requirements.html 29 Jan 2004 12:57:18 -0000 1.3 +++ openacs-4/packages/acs-automated-testing/www/doc/requirements.html 26 Feb 2004 14:40:27 -0000 1.4 @@ -1,14 +1,16 @@ -Requirements

Requirements

by Joel Aufrecht

+Requirements

Requirements

by Joel Aufrecht

OpenACS docs are written by the named authors, and may be edited by OpenACS documentation staff. -

Introduction

Automated Testing provides a framework for executing tests of all varieties and for storing and viewing the results.

Functional Requirements

Req #Status in 5.0Priority for 5.1 (A=required, B=optional)Description
1DoneDoneExecute TCL tests. Execute a sequence of TCL code is executed and determine the correctness of the results.
1.1partialAExecute HTTP tests. Execute tests that can interact with a the webserver via the external, HTTP interface, including retrieving pages, following links, and submitting forms. (This is partially done in the sense that we can make http calls from tcl api, but there is no framework for doing anything complicated.)
1.1.1AExecute tclwebtest scripts. A test can contain tclwebtest commands. If tclwebtest is not installed, those commands fail gracefully.
1.1.1.1partialAtclwebtest is easy to install. Tclwebtest installation is fully documented and can be installed with less than five steps. (Install is documented in 5.0, but there's a can't-find-config error; also, some new work in tclwebtest HEAD needs to packaged in a new tarball release.)
2ATests have categories. Individual tests can be marked as belonging to zero, one, or many of these categories. The UI provides for running only tests in selected categories, and for viewing only results of tests in selected categories. -
Testing Mode
+        

Introduction

Automated Testing provides a framework for executing tests of all varieties and for storing and viewing the results.

Functional Requirements

Req #Status in 5.0Priority for 5.1 (A=required, B=optional)Description
1DoneDoneExecute TCL tests. Execute a sequence of TCL code is executed and determine the correctness of the results.
1.1partialDoneExecute HTTP tests. Execute tests that can interact with a the webserver via the external, HTTP interface, including retrieving pages, following links, and submitting forms. (This is partially done in the sense that we can make http calls from tcl api, but there is no framework for doing anything complicated.)
1.1.1DoneExecute tclwebtest scripts. A test can contain tclwebtest commands. If tclwebtest is not installed, those commands fail gracefully.
1.1.1.1partialAtclwebtest is easy to install. Tclwebtest installation is fully documented and can be installed with less than five steps. (Install is documented in 5.0, but there's a can't-find-config error; also, some new work in tclwebtest HEAD needs to packaged in a new tarball release.)
2DoneDoneTests have categories. Individual tests can be marked as belonging to zero, one, or many of these categories. The UI provides for running only tests in selected categories, and for viewing only results of tests in selected categories.
2.1AEach test can be associated with a single OpenACS.org bug (ie, store bug id as in integer, or store full url so that this can point to other bugs)
3BTests can be ordered lists of other tests. minimal: verify that a test proc can call other test procs. Better: A test can be created within the GUI by selecting other tests. This test is stored in the database and can be exported. (This is related to a bigger issue of storing test scripts in some format other than tcl procs.)
4CTest scripts can be imported and exported. It should be possible to import a test into the database from a file, and to export it to a file. These files should be sharable by different OpenACS installations. It should be possible to import/export directly between running OpenACS sites. (We should look at what did and didn't work in acs-lang catalog files and work from there.)
5BMacro Recording. End users can create and run tests from the web interface without writing code. +

1) UI to turn on macro mode.

2) basic recording: when you fill out a form while macro mode is on, the submit is caught and displayed as tclwebtest code, and then executed.

3) UI for creating aa_true tests automatically, based on the content of the page. (For example, a form that says "the returned page must contain [ type regexp here] that spits out aa_true "test X" [string regexp blah blah]

6ANotification subscriptions are available for "email me whenever this test fails" and "notify me whenever a test in this category fails"
7AThe results of an automated test are optionally written to an xml file.

Because the current test package uses in-memory variables instead of database objects to track its tests, it is incompatible with the standard category package. It uses an internal, single-dimension category field. Should this eventually get extended, a more complete list of categories to implement could be:

Testing Mode
   Regression
   Smoke
   Stress
   Default-Only (for tests, such as front page UI tests, that will break 
                 once the default site is modified and can be ignored on 
                 non-default sites)
+  production-safe
+  security_risk
 Layer
   Web Page
   TCL Page Contract
@@ -25,5 +27,4 @@
 Package Version
   5.0.0
   etc
-
2.1AEach test can be associated with a single OpenACS.org bug (ie, store bug id as in integer, or store full url so that this can point to other bugs)
3BTests can be ordered lists of other tests. minimal: verify that a test proc can call other test procs. Better: A test can be created within the GUI by selecting other tests. This test is stored in the database and can be exported. (This is related to a bigger issue of storing test scripts in some format other than tcl procs.)
4CTest scripts can be imported and exported. It should be possible to import a test into the database from a file, and to export it to a file. These files should be sharable by different OpenACS installations. It should be possible to import/export directly between running OpenACS sites. (We should look at what did and didn't work in acs-lang catalog files and work from there.)
5BMacro Recording. End users can create and run tests from the web interface without writing code. -

1) UI to turn on macro mode.

2) basic recording: when you fill out a form while macro mode is on, the submit is caught and displayed as tclwebtest code, and then executed.

3) UI for creating aa_true tests automatically, based on the content of the page. (For example, a form that says "the returned page must contain [ type regexp here] that spits out aa_true "test X" [string regexp blah blah]

6ANotification subscriptions are available for "email me whenever this test fails" and "notify me whenever a test in this category fails"
7AThe results of an automated test are optionally written to an xml file.

Revision History

Document Revision #Action Taken, NotesWhen?By Whom?
1Creation17 Jan 2004Joel Aufrecht
2Updated with notes from chat meeting21 Jan 2004Joel Aufrecht
View comments on this page at openacs.org
+

Revision History

Document Revision #Action Taken, NotesWhen?By Whom?
1Creation17 Jan 2004Joel Aufrecht
2Updated with notes from chat meeting21 Jan 2004Joel Aufrecht
View comments on this page at openacs.org
Index: openacs-4/packages/acs-automated-testing/www/doc/usage.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-automated-testing/www/doc/usage.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-automated-testing/www/doc/usage.html 26 Feb 2004 14:40:27 -0000 1.1 @@ -0,0 +1,28 @@ +Usage

Usage

by Joel Aufrecht

+ OpenACS docs are written by the named authors, and may be edited + by OpenACS documentation staff. +

Here's the entire chain of code used to set up auto-rebuilding servers on test.openacs.org

  • The master server shows the status of all other servers. For test.openacs.org, it listens on port 80.

    1. The acs-automated-testing parameter IsInstallReportServer is set to 1

    2. The acs-automated-testing parameter XMLReportDir is set to /var/log/openacs-install. This is arbitrary - it just needs to be somewhere all the servers can write to.

  • For each server that will be monitored:

    1. Suppose the first test server is service1. Set up a dedicated user and automated install script.

    2. To run automated testing automatically each time the server is rebuilt, add this to /home/service1/install/install.tcl:

             set do_tclapi_testing "yes"
    3. Get the results of the automated tests dumped where the master server can see them - in this example, the same directory as above, /var/log/openacs-install, by adding this to install.tcl (requires 5.1):

                set install_xml_file          "/var/lib/aolserver/service0/packages/acs-core-docs/www/files/install-autotest.xml"

      This will copy in the file install-autotest.xml:

      <?xml version="1.0"?>
      +
      +<!-- This is an install.xml which can be used to configure servers for reporting their automated test results.  Requires acs-automated-testing 5.1.0b2 or better -->
      +
      +<application name="acs-automated-testing" pretty-name="Automated Testing" home="http://openacs.org/">
      +
      +  <actions>
      +
      +    <set-parameter package="acs-automated-testing" name="XMLReportDir" value="/var/log/openacs-install"/>
      +  </actions>
      +
      +</application>
      +

      which will, during install, configure that parameter in acs-automated-testing on the monitored server.

  • To enable the 'rebuild server' link, edit the file /usr/local/bin/rebuild-server.sh:

    #!/bin/sh
    +# script to trigger a server rebuild
    +
    +# hard-coding the valid server names here for some minimal security
    +case $1 in
    +    service1) ;;
    +    service2) ;;
    +    *)
    +        echo "Usage: $0 servername"
    +        exit;;
    +esac
    +
    +sudo /home/$1/install/install.sh 2>&1

    and allow the master user to execute this file as root (this is a limitation of the automatic install script, which must be root). In /etc/sudoers, include a line:

    master ALL = NOPASSWD: /usr/local/bin/rebuild-server.sh
View comments on this page at openacs.org
Index: openacs-4/packages/acs-automated-testing/www/doc/xml/index.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-automated-testing/www/doc/xml/index.xml,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/acs-automated-testing/www/doc/xml/index.xml 21 Jan 2004 18:26:58 -0000 1.3 +++ openacs-4/packages/acs-automated-testing/www/doc/xml/index.xml 26 Feb 2004 14:40:27 -0000 1.4 @@ -8,6 +8,9 @@ Section Missing + + Section Missing + Section Missing Index: openacs-4/packages/acs-automated-testing/www/doc/xml/using.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-automated-testing/www/doc/xml/using.xml,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-automated-testing/www/doc/xml/using.xml 26 Feb 2004 14:40:27 -0000 1.1 @@ -0,0 +1,64 @@ + + + + Usage + + by Joel Aufrecht + + + Here's the entire chain of code used to set up auto-rebuilding servers on test.openacs.org + + + + The master server shows the status of all other servers. For test.openacs.org, it listens on port 80. + + + The acs-automated-testing parameter IsInstallReportServer is set to 1 + + + The acs-automated-testing parameter XMLReportDir is set to /var/log/openacs-install. This is arbitrary - it just needs to be somewhere all the servers can write to. + + + + + For each server that will be monitored: + + + Suppose the first test server is service1. Set up a dedicated user and automated install script. + + + To run automated testing automatically each time the server is rebuilt, add this to /home/service1/install/install.tcl: + set do_tclapi_testing "yes" + + + Get the results of the automated tests dumped where the master server can see them - in this example, the same directory as above, /var/log/openacs-install, by adding this to install.tcl (requires 5.1): + set install_xml_file "/var/lib/aolserver/service0/packages/acs-core-docs/www/files/install-autotest.xml" + This will copy in the file install-autotest.xml: + example missing + which will, during install, configure that parameter in acs-automated-testing on the monitored server. + + + + + To enable the 'rebuild server' link, edit the file /usr/local/bin/rebuild-server.sh: + #!/bin/sh +# script to trigger a server rebuild + +# hard-coding the valid server names here for some minimal security +case $1 in + service1) ;; + service2) ;; + "") echo "Usage: $0 servername" + exit;; + *) echo "$1 is not a permitted servername" + exit;; +esac + +sudo /home/$1/install/install.sh 2>&1 + and allow the master user to execute this file as root (this is a limitation of the automatic install script, which must be root). In /etc/sudoers, include a line: + master ALL = NOPASSWD: /usr/local/bin/rebuild-server.sh + + + \ No newline at end of file