Forum OpenACS Q&A: Response to How to get an instance url from a package key?

Strictly speaking, a testcase shouldn't/cannot rely on a package actually already having been mounted. It's probably also not ideal to be running tests on a live package either. If a package testcase requires that the package be mounted, then I think its the testcase's responsibility to perform the package mount/unmount.

This is obviously not ideal, as its going to slow down the execution time of all the tests that need to so it. Particularly in the current situation where a testcase should clear all its own data up. One can imagine a set of say, 20 testcases for a package, each testcase having to do its own mount/unmount. Nasty.....

My suggestion would be that a testcase could belong to a "init_class", where an init_class indicates that a chunk of code should be run before and after a complete set of testcases is run. This essentially allows testcases to share initialisation/cleardown code. This slightly breaks the notion of a testcase clearing up its own data, but should enforce that everything does get cleared up by the aa-test package after running a set of testcases.