How to create an Object of a Class in Katalon

Hi ,

I have a Class A with custom keywords defined within the class. When I try to create and object of this class in another Class B , it gives and error. Though I did this in previous version of KS, not sure how to implement this in current version. I have imported the package and all necessary classes

Error is Groovy:unexpected token: ClassA = new ClassA() @ line 13, column 2.

public ClassA {

@Keyword
public void read ()
{
}

@Keyword
public void delete(){
}

}

public class ClassB{

ClassA test = new ClassA() // Not working and it throws
}

Sometimes, you can stare at code for hours and not see what’s staring you in the face. If it was a rattlesnake you’d be long dead :crazy_face:

Ready?

public class ClassA { …

Don’t beat yourself up… we’ve all been there. :slight_smile:

1 Like