Better use callTestCase function or write all in one file?

for efficiency and running time, is it better to use callTestCase function or write everything in one file?

2 Likes

I believe, in terms of execution speed, no difference between a modularised set of Test Cases linked via callTestCase() and a single flat Test Case that defines several functions.

In terms of code readability and maintenanceability, you should somehow modularise your codes, of course.

For modularization, you have 2 options

  • implement your function as a Test Case, and other Test Case calls it via callTestCase()
  • implement your function as a method of a Groovy class, and a Test Case calls the method (this is also known as “custom Keyword”)

If your function is called repeatedly (say, tens of times per a single run of your test), then a custom Keyword will run far quicker than a Test Case called via callTestCase(). It is because Katalon Studio takes very verbose log for every Test Case executions which will make your test run slow. On the other hand Katalon takes no log for custom Groovy classes. See Log Viewer slows down your tests. How to prevent it? - #12 by kazurayam

5 Likes

Hi @crismon.manalu, We use a combination of both callTestCase() & custom keywords. We use callTestCase() when there’s a lot of detail in the case and the case only gets called a few times during a test session. We use custom keywords for logins and the like which are run several times during a test session. It really depends on your needs, but as Kaz points out, callTestCase() does slow your execution times, but tweaking the Log Viewer can mitigate the execution times.

3 Likes

Oh I see
very clear explanation, thank you very much