Strange behaviour with groovy script
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2017
09:02 AM
07-31-2017
09:02 AM
Strange behaviour with groovy script
def countries = ['IND':'India', 'USA':'United States of America', 'PAK':'Pakistan', 'AUS':'Australia' ] //Printing map log.info "Before : $countries" String countryIamLookingFor boolean foundCountry countryIamLookingFor = 'SIG' foundCountry = countries.containsKey(countryIamLookingFor) log.info "Found Country $countryIamLookingFor : $foundCountry" String countryName = countries.get(countryIamLookingFor) if(foundCountry){ log.info "Country name is $countryName" }else{ log.error "Sorry! Country not found" } //Printing map log.info "Before : $countries" countries.put('NZ','Newzealand') log.info "After : $countries"
When I run this script, "Newzealand is getting printed at "
log.info "Before : $countries"
5 REPLIES 5
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2017
10:02 AM
07-31-2017
10:02 AM
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2017
05:57 PM
07-31-2017
05:57 PM
This script seems to work with a minor delay before modifying countries.
log.info "Before : $countries" Thread.sleep(100) countries.put('NZ','Newzealand') log.info "After : $countries"
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2017
06:46 PM
07-31-2017
06:46 PM
I am using SoapUI 5.3.0 version. Anyways it works perfectly with 'grooyConsole'.In real-time the delay might cause performance issues 🙂 .Any other suggestions ??
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2017
07:28 PM
07-31-2017
07:28 PM
It may be a defect or limitation of groovy script in Soap UI.
In my environment I can use a very small delay like 10 ms but you could raise the issue with SmartBear support.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2017
09:06 PM
