Extending classes in Script Library
Hello,
There is a way to extend class from other file in script library?
For example I have 2 files: class1.groovy and class2.groovy. And inside class2.groovy I want to write class2 which will extend class1 from class1.groovy file.
It is possible?
Please check if this post answers your question - http://community.smartbear.com/t5/SoapUI-NG/How-to-use-method-in-separate-groovy-script-within-test-case/m-p/107719#M25006
Thanks,
Samy
You can do every thing in groovy that you do in Java.
I know you may use these classes in ReadyAPI-<version>/bin/script directory
For eg:
Person.groovy
class Person { def firstname def lastname def age }
Student.groovy
import Person class Student extends Person { def class def department }
You may have both in scripts directory or you can use them in groovy step as well.
Say, below is your groovy script test step which shows how to use above created classes.
import Student import Person def person = new Person(firstname: 'John', lastname: 'Miller') def student = new Student(firstname: 'Philips', lastname: 'Mark', class: 'B.S', department: 'Mathematics')