Hi Raghav! Awesome tutorials I need some guidance on classes and objects I am learning Groovy language for SOAPUI and writing code in SOAPUI But I am facing this error please help Here is my code class Student { String Name; int Mark1; int Mark2; def printTotal(){ log.info "$name has total marks :"+(Mark1+Mark2) }
public static void main(args) { // TODO Auto-generated method stub Student st = new Student () st.Name = "Ali" st.Mark1 = 30 st.Mark2 = 50 st.printTotal() }
} Error Message groovy.lang.missingPropertyException no such property : log for class Student
Hi Ayub, you will need to add a constructor and pass log variable. class Example { def log def context def testRunner // Class constructor with same case as Class name def Example(logIn,contextIn,testRunnerIn) { this.log = logIn this.context = contextIn this.testRunner = testRunnerIn } } We need to instance of the class; add the following to the end of the Script, outside the class definition. This will place the instance in the project's context. context.setProperty( "example", new Example( log, context, testRunner) ) log.info "Library Context:"+context community.smartbear.com/t5/SoapUI-Pro/How-to-write-a-reusable-script-Library/td-p/29499
Hi Raghav Pal. How can I use this for integrating Jenkins pipeline with stages as classes? A video on that will be greatly useful.
Hi Phila, I will check and plan a video on that.
too large fort size ad small space for write program so complete program not visible
I will check on this Pratap,
Thank you Sir, this tutorial was amazing
Most welcome Harry
Awesome Raghav! Please start katalon advance course been waiting! Thanks mahesh
Yes, Mahesh, I too am waiting to get some focussed time. But will do it definitely
Hi Raghav!
Awesome tutorials
I need some guidance on classes and objects
I am learning Groovy language for SOAPUI and writing code in SOAPUI
But I am facing this error
please help
Here is my code
class Student {
String Name;
int Mark1;
int Mark2;
def printTotal(){
log.info "$name has total marks :"+(Mark1+Mark2)
}
public static void main(args) {
// TODO Auto-generated method stub
Student st = new Student ()
st.Name = "Ali"
st.Mark1 = 30
st.Mark2 = 50
st.printTotal()
}
}
Error Message
groovy.lang.missingPropertyException no such property : log for class Student
Hi Ayub, you will need to add a constructor and pass log variable.
class Example {
def log
def context
def testRunner
// Class constructor with same case as Class name
def Example(logIn,contextIn,testRunnerIn) {
this.log = logIn
this.context = contextIn
this.testRunner = testRunnerIn
}
}
We need to instance of the class; add the following to the end of the Script, outside the class definition. This will place the instance in the project's context.
context.setProperty( "example", new Example( log, context, testRunner) )
log.info "Library Context:"+context
community.smartbear.com/t5/SoapUI-Pro/How-to-write-a-reusable-script-Library/td-p/29499
@@RaghavPal thanks a lot Raghav
Hi Raghav
How i can get a soap or rest api from a website ?