Contributions
Re: Groovy Script Library - Problem creating class from working script
Thanks, Chris. I could not get past the errors with your solutions but they did inspire me to rethink my approach and to simplify. I end up with: class DOB { String db (){ def start = Date.parse('yyyy-MM-dd', '2015-01-01') def end = Date.parse('yyyy-MM-dd', '2017-12-31') def random = new Random() def DOB = (start + random.nextInt(end - start + 1)).format('yyyy-MM-dd') return DOB } } Thanks, again.2 years agoPlace ReadyAPI QuestionsReadyAPI Questions723Views0likes0CommentsGroovy Script Library - Problem creating class from working script
I am making a class in a Groovy Script Library. The original script which works fine: random = new Random() Date randomDate(Range<Date> range) { def res = range.from + random.nextInt(range.to - range.from + 1) } def start = Date.parse('yyyy-MM-dd', '2015-01-01') def end = Date.parse('yyyy-MM-dd', '2017-12-31') log.info randomDate(start..end).format('yyyy-MM-dd') The class: class DOB { String dob (){ random = new Random() Date randomDate(Range<Date> range) { def res = range.from + random.nextInt(range.to - range.from + 1) } def start = Date.parse('yyyy-MM-dd', '2015-01-01') def end = Date.parse('yyyy-MM-dd', '2017-12-31') log.info randomDate(start..end).format('yyyy-MM-dd') } } When I import the class in a Groovy script, I get the following error. Mon May 16 13:46:49 CDT 2022: ERROR: BUG! exception in phase 'semantic analysis' in source unit 'Script26.groovy' The lookup for DOB caused a failed compilation. There should not have been any compilation from this call. From the Error Log: C:\Program Files\SmartBear\bin\DOB.groovy: 6: Method definition not expected here @ line 6, column 3. Date randomDate(Range<Date> range) { Is this due some variation in how SmartBear supports Groovy in the script library files?772Views0likes3CommentsLoad Test Data Source Iterator Is not updating correctly in ReadyAPI 3.3.1
I have a LoadUI test with a single SoapUI scenario. The SoapUI test has an Excel data source with the Load Testing options configured to use the data source as shared during LoadUI runs. When I run the LoadUI test with multiple VUs, one record from the data source will be used by more than one VU. It looks like the data source iterator is not incrementing correctly. When the LoadUI load profile is configured to Fixed, all VUs will use the same record from the data source.Solved4 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.9KViews0likes3Comments