Forum Discussion

max1965's avatar
max1965
Contributor
13 years ago

delete project properties

In my soap project I have the following properties:

panic_udb
versioneCx
versioneSh
versioneSn
cseq
callid
cseq_0802100000
callid_0802100000
nonce_0802100000
nc_0802100000
cseq_0802100001
callid_0802100001
nonce_0802100001
nc_0802100001
cseq_0802100002
callid_0802100002
nonce_0802100002
nc_0802100002
cseq_0802100003
callid_0802100003
nonce_0802100003
nc_0802100003
cseq_0802100004
callid_0802100004
nonce_0802100004
nc_0802100004
contactUri_0802100000
contactUri_0802100001
contactUri_0802100002
contactUri_0802100003
contactUri_0802100004
cseq_022100000
callid_022100000
cseq_022100001
callid_022100001

with the script:

def propertyNames = testRunner.testCase.testSuite.project.getPropertyNames()
for(name in propertyNames){
project.removeProperty(name);
}

I will delete all the properties; there is the way to delete only the following properties:

cseq_*
callid_*
contactUri_*
nc_*
nonce_*

Thanks.

2 Replies

  • Hi,

    Yes is possible you need to check if the name starts with a specific string like this:

    def propertyNames = testRunner.testCase.testSuite.project.getPropertyNames()
    for(name in propertyNames){
    if ( (name.toString().startsWith("cseq_") || (name.toString().startsWith("callid_"))
    project.removeProperty(name);
    }