Groovy Read Properties

Source: Internet
Author: User

Last night to help the old colleague solved a soapui code problem, a long time useless soapui, a lot of things are forgotten, today first summarize the groovy read properties

First spit trough under soapui of Apidocs, I can hardly see what things, official website tips have so little use, but for a long time did not update, a lot of things can not find. And it's almost impossible to debug groovy code in SOAPUI.

Apidocs:http://www.soapui.org/apidocs/index.html?com/eviware/soapui/model/testsuite/testruncontext.html

Not much nonsense to say, first get the current testsuite:

def ts =  TestRunner.testCase.testSuite

Get the Properties file path:

def filename =  "C:\\testsuiteproperties\\currenttestingenvironment\\endpoints.properties"
Log.info "Loading properties from" + filename

Import properties using Java Packages:

Newnew java.io.FileInputStream (filename);

Use Emumeration to read the properties value and set it to the properties of Testsuite:

Enumeration E = Props.keys ();  while (E.hasmoreelements ()) {    = e.nextelement ();     = Props.get (key);    Ts.setpropertyvalue (Key, Val);    " Set Property "+ key +" to "+ Val;}

This is the initialization process for a properties parameter.

Groovy Read Properties

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.