Custom Keyword vs Method

B L said:

Is there a way to create a public static method that you can call in any test case? I figured keyword was the only way to do this. I don’t see the package structure for creating test cases.

Create a package, my_package.

Add a new class to the package, my_class:

package my_package

public class my_class {
  ...
}

Add a new static method my_method to my_class:

public class my_class {

  static void my_method(/* params here */) {
    // do remarkable things
  }
}

In your test cases:

import static my_package.my_class.*

// call my_method
my_method()
4 Likes