Forum Discussion

白夜有点黑's avatar
白夜有点黑
Contributor
6 years ago
Solved

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?
  • 白夜有点黑's avatar
    白夜有点黑
    6 years ago

    solved it use full package path include evaluate String: 

     

    evaluate("com.test.apitest.util.RandomUtil.getRandomString(chars, randomInt)")

3 Replies