For one of my tests, I have defined a helper class called DiscountData
defined as such:
`
class DiscountData {
private String name, type, operator, value;
public DiscountData() {
}
public DiscountData(name, type, operator, value) {
this.name = name;
this.type = type;
this.operator = operator;
this.value = value;
}
public String getName() {
return this.name;
}
public String getType() {
return this.type;
}
public String getOperator() {
return this.operator;
}
public String getValue() {
return this.value;
}
// setters
}
`
The use case of this class is as follows: right before any data-entry steps, I construct an instance of it with a row of data from the Test Data. I then use the object to fill in the fields.
This worked, up until I started adding test steps from the UI. When that happened, and I went back to Script mode, my class definition was gone and attempt to run the test case gave me this error:
`
Test Cases/AddValidDiscountsByType has ERROR(s) because (of) org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
file:/C:/Users/mwarren/Katalon%20Studio/TestProject/Scripts/AddValidDiscountsByType/Script1529682315911.groovy: 65: unable to resolve class DiscountData
@ line 65, column 18.
DiscountData testData = new DiscountData(data.getValue(‘Name’, index), discountType, data.getValue(‘Operator’, index),
`
How do I solve this?