Delete Project Level Properties With Specific Name After Execution
Hi,
Bit embaressed I can't fix this myself :(
I have some project level properties I create after running a setup testsuite to grab some GUIDS out of the database for later use in the project and I'd like to delete these project level properties after each execution run.
I have a number of project level properties and I only want to delete ones containing a certain string in the property name, so I was thinking add a script to the project teardown.
I almost found exactly what I needed via this link
In the linked page HimanshuTayal 's code reads as follows (which gets added to the testCase teardown script):
def targetTestCase = testRunner.testCase; def propList = targetTestCase.getPropertyNames() propList.each{ if(it.contains("ScheduleID")){ targetTestCase.removeProperty(it); } else{ //Do nothing } }
HOWEVER - the above is to delete testcase level properties rather than project level properties - so I altered it to the following (added it to the Project teardown script) thinking this would work
def targetTestCase = testRunner.testCase.testSuite.project; def propList = targetTestCase.getPropertyNames() propList.each{ if(it.contains("ScheduleID")){ targetTestCase.removeProperty(it); } else{ //Do nothing } }
But I got the following error response
Tue Jun 18 10:57:20 BST 2019: ERROR: com.eviware.soapui.support.scripting.ScriptException: Error in TearDown Script of Eehatevs
Can anyone see what I'm doing wrong? well - I'm sure everyone can see what I'm doing wrong - but I cant. :)
I checked around and to navigate to the project level - (in the testRunner line) and that appears how to drill to the project level? (e.g. testRunner.testCase.testSuite.project)??
Cheers!
richie
Hi,
This is probably the best way.
One thing to know and remember: all files that are part of TestComplete project (except script units to certain extent) are not mergeable and must be marked as binaries in source control system.
Hi,
> did you see shareNameMappingScripts.jpg ?
Yes, I saw it.
Not sure if I got the question, but nevertheless:
-- Script code from other project(s) can be reused by utilizing the 'Add Existing' functionality;
-- Only one NameMapping/Aliases file can exist in the project, thus you will have to physically merge NameMapping files from other project(s) into the project where you'd like to use 'combined' NameMapping.