Ask a Question

Trying to set test case property for a different project. No errors but it isn't set.

ocherevkova
Occasional Contributor

Trying to set test case property for a different project. No errors but it isn't set.

I run the following script:

 

import com.eviware.soapui.impl.wsdl.WsdlProjectPro
def projPath = testRunner.testCase.testSuite.project.path.split('\\\\')
def path2Auth = (projPath - projPath.getAt(projPath.size()-1) + "KeyVault-readyapi-project").join('\\\\')
def prj = new WsdlProjectPro(path2Auth)
def testSuite = prj.getTestSuiteByName("KeyVault")
def testCase = testSuite.getTestCaseByName("AccessToken")
def creationTime = testCase.getPropertyValue("creationTime")
log.info("creationTime:" + creationTime )
testCase.setPropertyValue("creationTime", "")
log.info("creationTimeAfterChange:" + testCase.getPropertyValue("creationTime") )

 

It works without errors and returns the result that the property is empty. But in fact, it isn't. It still has a value as before changes.

How to resolve it? Why it happens?

 

Regards,

Elena

 

1 REPLY 1
richie
Community Hero

Hey @ocherevkova 

 

I'm a bit confused - can you just clarify please?  The title indicates youre trying to "set a testcase property for a different project" - is that correct?   I'm pretty literal and I just want to make sure I'm on the same page.

 

are you trying to set the testcase property to blank?  is that right?

 

where you state "It works without errors and returns the result that the property is empty. But in fact, it isn't. It still has a value as before changes."  - can you just clarify what this means - perhaps rephrase it for me?  Just to make sure I understand.

 

It looks like you get the creationTime property value, but then you're subsequently setting it to blank - is that what you want - or am I misunderstanding?

 

Also - I'm intrigued - can you explain why you want to set a testcase property in a different project by generating it in the current project?

 

I noticed that you don't include the testRunner object in most of the groovy script either, excepting the first line.

i.e. when you set creationTime to blank --> testCase.setPropertyValue("creationTime", "") - shouldn't this be prefixed by the testRunner object like testRunner.testCase.setPropertyValue("creationTime", "") ??

 

I'm not a groovy whizz like some of the other people on here - but this page is pretty helpful --> https://www.soapui.org/docs/scripting-and-properties/tips-tricks/

 

Cheers,

 

Rich

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
cancel
Showing results for 
Search instead for 
Did you mean: