Forum Discussion

Intermountain_H_4's avatar
Intermountain_H_4
Occasional Contributor
15 years ago

Cleanup Script on CLOSE PROJECT

Greetings,

At the project level, I have a "Load Script" (on the 'overview' tab) that creates some global properties. These properties prompt for and store login credentials. I would like to clear these values with a tear down script when i close the project, rather then after a testsuite executes. Is this possible, and if so - how?

tl;dr - need a tear down script when the PROJECT is closed.
  • Hi!

    couldn't you use the project onSave script for this? (Called before the project is saved which allows you to clear out any data you don't want stored)

    regards!

    /Ole
    eviware.com
  • Intermountain_H_4's avatar
    Intermountain_H_4
    Occasional Contributor
    Will the project onSave script be executed if the script isn't saved on exit?

    On our team, we share scripts, so the files are generally marked "read only" and we have "auto save" disabled. Thoughts?
  • Hi!

    This script is executed every time the project is saved, which it is automatically when you close it. If you close the project without saving then this shouldn't be an issue anyway because the values you want to remove aren't saved either!?

    regards,

    /Ole
    eviware.com
  • Intermountain_H_4's avatar
    Intermountain_H_4
    Occasional Contributor
    This script is executed every time the project is saved, which it is automatically when you close it. If you close the project without saving then this shouldn't be an issue anyway because the values you want to remove aren't saved either!?


    Unfortunately, this isn't true. Values are being written to global properties, which is not part of the script. So, if you close the script without saving, the values are retained in global properties.

    Alternatively, is there an option to clear out specific global properties when closing soapUI ? (basically, making temporary global properties).
  • Hi,

    ah ok.. so you would basically need global onStartup and onExit scripts?

    regards,

    /Ole
    eviware.com
  • Intermountain_H_4's avatar
    Intermountain_H_4
    Occasional Contributor
    ah ok.. so you would basically need global onStartup and onExit scripts?


    Exactly! That would be fantastic.
  • Hi!

    ok.. this isn't currently available.. I'll add it to the backlog to get it scheduled into an upcoming release.

    What you can do now is create a custom WorkspaceListener (via the extensions API described at http://www.soapui.org/Developers-Corner ... oapui.html) that listens for onProjectClosed events and handles these accordingly.

    Would that be an option?

    regards!

    /Ole
    eviware.com