Manual | Tutorial | Standard Library | Release Notes

Release Notes


During test development you sometimes want to stop all connected clients and reset all dependencies as well as delete global QF-Test variables in order to establish a well defined starting point for the next test execution.

For that purpose QF-Test offers »Run«-»Reset everything« in its main menu. To accommodate their particular needs test developers can additionally implement a ResetListener which allows to

  • keep (certain) clients alive
  • restore global QF-Test variables
  • perform custom operations, for example deleting global Jython variables

To manage ResetListeners the QF-Test runcontext provides the methods addResetListener(), isResetListenerRegistered() and removeResetListener().

The ResetListener interface itself has two methods:

This method is called before dependencies are reset, global QF-Test variables deleted and clients terminated when invoking »Run«-»Reset everything«. Implement this method when you want to prevent certain clients from being terminated.
Returns A java.util.Set<String> object containing the names of all clients that should stay alive.
This method is called when the reset was executed.

The following example shows the implementation and registration of a ResetListener. It restores the global QF-Test variable client and prevents from closing the respective SUT.

from java.util import HashSet
from de.qfs.apps.qftest.extensions.qftest import ResetListener
from de.qfs.apps.qftest.shared.exceptions import UnboundVariableException

class RL(ResetListener):
    def beforeReset(self):
            self.client = rc.lookup("client")
            h = HashSet()
            return h
        except UnboundVariableException:
            self.client = None
    def afterReset(self):
        if self.client != None:
            rc.setGlobal("client", self.client)

global resetListener
resetListener = RL()
Example 47.47:  Example of a ResetListener implementation