Forum Discussion

Liberty_Informa's avatar
Liberty_Informa
Regular Contributor
12 years ago

Life span of the custom property

Hi

What is a life span of the custom property?

We read request data from the external source to populate custom properties which is in tern are used in the test cases.

I have observed that even though removal of external source file, restarting the soapUI, reloading the project does not reset custom property value. Is this something intentional behaviour?

With the existing behaviour, even though external source is corrupted or removed by someone, still test cases run successfully.

9 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    when the project is saved the values of the properties are saved also - by default soapUI automatically saves all projects on exit so by default your property values will be persisted between runs in the GUI. If you want to clear your custom properties before your project is saved you can add an onSave script at the project level to do that.

    Hope this helps!

    regards,

    /Ole
    SmartBear Software
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    sure - so if you want to reset all project, testSuite and testCase properties you could do

    for( t in project.testSuiteList )
    {
    for( c in t.testCaseList )
    clearProperties( c )

    clearProperties( t )
    }

    clearProperties( project )

    void clearProperties( modelItem )
    {
    for( n in modelItem.propertyNames )
    modelItem.setPropertyValue( n, "" )
    }

    Hope this helps!

    /Ole
    SmartBear Software
  • Liberty_Informa's avatar
    Liberty_Informa
    Regular Contributor
    Hi

    Thanks for the script. It works perfect.

    To use this script on Save Project isn't digesting me. It clears off all custom properties just on saving the project.

    How about calling this code initially in the project load script? This script will clear off all custom properties and same script will further populate all custom properties afresh, in the same script.
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi!

    sure - that would work - running it in the save script would prevent you from saving potentially "private" values to the project file - but you could also enable encryption of the project to avoid any related problems.

    regards,

    /Ole
    SmartBear Software
  • Clearing the project properties ALSO clears the current environment properties. I doubt this is what anyone wants.
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi!

    You are right, this is because the environment specific variables becomes bound to the project custom variables when choosing an environment.
    Every change of the project properties will change the active environment properties as well, such as clearing the property values.

    So would not consider this to be a bug, but maybe a design flaw. Do you want us to report an improvement for this?

    --
    Regards

    Erik
    SmartBear Sweden
  • Yes. There should be a way to clear the project without clearing the active environment. I guess you could create a dummy environment with all blank values and set it as active before clearing project properties.

    Is there a way to clear all temp data (request responses, property assignments etc)? I would like to clear all that stuff before I commit a composite project to a repo.
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    Unfortunately there is not - please add a corresponding feature request to the corresponding forum board!

    Thanks!

    /Ole
    SmartBear Software