How to evaluate a String which one like a classname.methodname in SoapUI with Groovy?
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2019
08:21 AM
05-23-2019
08:21 AM
How to evaluate a String which one like a classname.methodname in SoapUI with Groovy?
I have groovy code as below:
def randomInt = RandomUtil.getRandomInt(1,200);
log.info randomInt
def chars = (("1".."9") + ("A".."Z") + ("a".."z")).join()
def randomString = RandomUtil.getRandomString(chars, randomInt) //works well with this code
log.info randomString
evaluate("log.info new Date()")
evaluate('RandomUtil.getRandomString(chars, randomInt)') //got error with this code
I want to evaluate a String which one like a classname.methodname in SoapUI with Groovy, just like above, but got error here, how to handle this and make it works well as I expect?
Solved! Go to Solution.
3 REPLIES 3
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2019
05:42 AM
05-27-2019
05:42 AM
@HimanshuTayal, @nmrao, @groovyguy, could you please share your thoughts regarding this error?
---------
Tanya Yatskovskaya
SmartBear Community and Education Manager
Tanya Yatskovskaya
SmartBear Community and Education Manager
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2019
07:02 AM
05-27-2019
07:02 AM
Already get the solution here:
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2019
07:05 AM
05-27-2019
07:05 AM
solved it use full package path include evaluate String:
evaluate("com.test.apitest.util.RandomUtil.getRandomString(chars, randomInt)")
