How can I create a test method?

Good morning,

In my test suite, I have a lot of repetitive test cases in which only few parameter changes. But each test needs to be run independently.

In plain Selenium, I would address this problem with OOP, using custom test and page classes and methods. But here in Katalon, I feel puzzled because I feel I can’t do it.

How can I, for instance, create an “Authentication” method (with several actions in it), and use it in different test cases? Where should it be placed and how could I call it in my test cases?

This is very important to me to know that, because if the authentication method changes, I don’t want to change every single test case.

Thank you for you answer.

I doesn’t suite my needs. Because I won’t use everytime the same login and password… “Authentication” is just an example, it could also be something longer, for instance “Buy product” (then, in parameter, have the name of the product and its price for example). So, it’s not possible to create custom methods and use it all along the project?

Thank you.

I think, you can try to create a custom keyword for you purpose.
It worked for me… I created a custom method with parameters, which I called from different places of my code.

Hi there,

Sorry for giving you wrong solution. In Katalon Studio, there is a cool feature called ‘Custom Keyword’. You can define a custom keyword called ‘Authentication’ and use it in your test script like a test method.

Please refer to the link I’ve posted there to understand more about how to use and create custom keyword in test case.

Thanks

Hi there,

Because 'authentication’ is a common action, so you can create it as a single test case. Then in other test cases, you just need to call it using ‘Call Test Case’ keyword.

If ‘authentication’ needs to change, then you just need to edit ‘authentication’ test case.

Thanks