We are building a new experience for our SmartBear Community.
This site is now read-only. You can still browse and search as usual. Learn More
This site is now read-only. You can still browse and search as usual. Learn More
I also agree, learning to navigate the Java API docs is a little daunting, but it's worth the effort. When I was starting out I made extensive use of the getClass() method to help me use the API docs.
For example you wanted to get the test case name and number of test steps. Start out by logging the class of the testRunner:
// Example Groovy run from "Groovy Script" test step log.info(testRunner.getClass())
This will log the Class of the testRunner - WsdlTestCaseRunner - that you can then look up in the API Docs:
There under the method summary you'll see a method getTestCase() Which returns the object WsdlTestCase:
You'll see (inherited from AbstractWsdlModelItem) there is a method getName() Thus to get the test case name:
// Example Groovy run from "Groovy Script" test step log.info(testRunner.getTestCase().getName())
Staying with the WsdlTestCase object, you will also see it has the method, getTestStepList() Which returns a standard Groovy List of test steps, thus the following code will get the number of test steps for a given test case:
// Example Groovy run from "Groovy Script" test step log.info(testRunner.getTestCase().getTestStepList().size())
To start with, for me, it was a lot of trial and error, but you soon start to learn the structure of the objects and start to be able to anticipate things. You can always log the class of any object to help you out.
Also the code completion also helps a lot, but remember, the code completion doesn't always show all of the available methods.
I could not find exactly details from API java document. so I have posted this query. No need to compile all of them. It would be helpful for me if you share exact link.
Project type is REST or SOAP UI type.
Link : https://www.soapui.org/apidocs/overview-summary.html
Title is updated. Where can i find above details exactly ? (API docs / Forum ) ?
Hi raja2
if you cant understand API docs (and I can't so I know exactly how you feel) I would google each of the points you are trying to find - you are looking for the groovy for about 6 different things?
yeah I would just use google for each option - e.g. 'groovy script to find out project name soapui'
That's how I would find out this stuff - this should retrieve stuff from a number of blogs, forums and sites (stackoverflow) -and I'd go from there - some of the topics you should be able to find straight away - others might take a bit of reading/searching - but it looking at your list I'm pretty sure you should be able to find it all without too much hassle!
cheers,
rich
I also agree, learning to navigate the Java API docs is a little daunting, but it's worth the effort. When I was starting out I made extensive use of the getClass() method to help me use the API docs.
For example you wanted to get the test case name and number of test steps. Start out by logging the class of the testRunner:
// Example Groovy run from "Groovy Script" test step log.info(testRunner.getClass())
This will log the Class of the testRunner - WsdlTestCaseRunner - that you can then look up in the API Docs:
There under the method summary you'll see a method getTestCase() Which returns the object WsdlTestCase:
You'll see (inherited from AbstractWsdlModelItem) there is a method getName() Thus to get the test case name:
// Example Groovy run from "Groovy Script" test step log.info(testRunner.getTestCase().getName())
Staying with the WsdlTestCase object, you will also see it has the method, getTestStepList() Which returns a standard Groovy List of test steps, thus the following code will get the number of test steps for a given test case:
// Example Groovy run from "Groovy Script" test step log.info(testRunner.getTestCase().getTestStepList().size())
To start with, for me, it was a lot of trial and error, but you soon start to learn the structure of the objects and start to be able to anticipate things. You can always log the class of any object to help you out.
Also the code completion also helps a lot, but remember, the code completion doesn't always show all of the available methods.