09-13-2017 08:41 AM - edited 09-13-2017 08:44 AM
After my previous thread with SoapUI requirements I've moved on to trying to add them to the project programmatically. There is only one method available in Class WsdlProjectRequirements for adding a requirement. It accepts a String for the ID and a Test Case object (com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase testCase).
However, I'm not sure what it is actually wanting as whenever I try to send in a Test Case object (I'm using Pro so this is obviously a Test Case Pro object) I get an exception, see attached.
How can I send it a WsdlTestCase when I'm using SoapUI Pro? Or is there another way to go about this besides importing a file of requirements?
09-15-2017 02:28 AM - edited 09-15-2017 02:31 AM
According to Class WsdlProjectRequirements a requirement should be added to WsdlProjectRequirements (not to WsdlProject). To get it, you need to use context.getTestCase().getTestSuite().getProject().getRequirements().
So, to add the requirement to a testCase, you can use the following script:
def project = context.getTestCase().getTestSuite().getProject(); def testCase = context.getTestCase() def requirements = project.getRequirements() requirements.addRequirement("ID", testCase)