cancel
Showing results for 
Search instead for 
Did you mean: 

Solution Script to Cleanup of Custom property values in the project

SOLVED
Highlighted
Frequent Contributor

Re: Solution Script to Cleanup of Custom property values in the project

@ArthurM 

Hi,

i'm interested to see your solution for cleaning dynamic and static properties.

the link seems not to refer to your solution or i made a mistake.

Can you send again the link please.

nmrao's solution looks good too.

i want to try both solutions.

For now i just have a regular groovy script with a list of properties to clean

 

Thank you

Highlighted
Occasional Contributor

Re: Solution Script to Cleanup of Custom property values in the project

Highlighted
Frequent Contributor

Re: Solution Script to Cleanup of Custom property values in the project

Thank you so much - - > Arthur.
Highlighted
Community Manager

Re: Solution Script to Cleanup of Custom property values in the project

Awesome stuff, thank you @nmrao . A lot of people will benefit from this.


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Highlighted
Frequent Contributor

Re: Solution Script to Cleanup of Custom property values in the project

Hi,

i found nmrao's solution fine.

Arthur's solution is nice too.

For now i prefer to use this simple solution in 'setup script' for example to clear testcase properties:

context.testCase.properties.each {
context.testCase.properties[it.key].value = ''
}

But Arthur's solution looks nice because we can delete all properties ending with a certain suffix.

I need to work on these two solutions to avoid the repetition of my two lines in each testcase for example.

But when we execute several times the same test, we overwrite properties right?

It's not clearing but changes the same properties each time we execute.

Thank you

 

 

 

View solution in original post

Highlighted
Frequent Contributor

Re: Solution Script to Cleanup of Custom property values in the project

please give my kudo to Arthur.

thank you

Highlighted
Community Hero

Re: Solution Script to Cleanup of Custom property values in the project

Reiterating that the solution is provided in the context of pushing the changes to repository for actual changes to the project rather than just property value changes because of test run.

As mentioned in one the replies in the above, user can remove properties altogether or just remove values as per the need.


Regards,
Rao.
Highlighted
New Contributor

Re: Solution Script to Cleanup of Custom property values in the project

int proptyCounts = testRunner.testCase.propertyCount
String [] tcexe_ToRemove = new String[proptyCounts]
for(int i=0;i<proptyCounts;i++)
{
    propertyName = testRunner.testCase.propertyNames[i]
    tcexe_ToRemove [i]=propertyName.toString().trim()
}
for(int j=0;j<tcexe_ToRemove.size();j++)
{
     testRunner.getTestCase().removeProperty(tcexe_ToRemove[j] );
}

Frequent Contributor

Re: Solution Script to Cleanup of Custom property values in the project

Thanks a lot

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors