Test with Custom Keyword runs faster
As you see in the above section, the Test Suite T2
in the case Y1 took over 25 minutes whereas the same T2
in the case Y2 took only 6 minutes. Why such a difference? It depends on if the “Log executed test steps” option is Enabled or Disabled. If you have an Enterprise license, you can disable the option and enjoy a faster test run. But if you don’t, you can not disable it. Is there any other way to make you test run faster in the Free version? .
Yes, there is a way. You can rewrite your Test Case script so that you make a combination of a Custom Keyword and a short Test Case that just calls the Custom Keyword. Your Test Case will delegate the Custom Keyword to perform concrete test processing.
Let me tell you what I examined.
I made a Custom Keyword class Keywords/my/Util.groovvy
:
package my
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.annotation.Keyword
public class Util {
@Keyword
static void printID10times(String id) {
for (int i in 0..10) {
WebUI.comment("ID=${id}")
}
}
}
Please note that the Keyword printID10times()
does just the same as what the Test Case printID_manytimes
does in the TS2
.
I made a new Test Case Test Cases/printID_manytimes_usingKeyword
. This just invokes the Custom Keyword passing parameter values.
CustomKeywords.'my.Util.printID10times'(ID)
I made a new Test Suite TS3
which calls the Test Case printID_manytimes_usingKeyword
for 1000 times while passing data from a CSV file.
The following table shows the measurement result. Please find the case Y4 result.
case | Suite | Step Execution Log | Log Viewer | Mode | duration | duration graph |
---|---|---|---|---|---|---|
Y1 | TS2 | Enabled | Attached | Tree | 25 min 17 secs | |
Y2 | TS2 | Disabled | Attached | Tree | 6 min 11 secs | #########+#########+#########+####### |
Y3 | TS2 | Disabled | Closed | - | 0 min 43 secs | #### |
Y4 | TS3 | Enabled | Attached | Tree | 9 min 30 secs | #########+#########+#########+#########+#########+####### |
In the case Y4, TS3
ran in 9 minutes. It is not as fast as the case Y2 ( TS2
in 6 minutes), but is much better than the case Y1 ( TS2
in 25 minutes).
Why the case Y4 ran faster than the case Y1?
It is because that Katalon Studio does not log executed test steps within a Custom Keyword . If you look at the Log view with “All” level selected while you ran TS3
, you will see no verbose Start action :
and End action :
logs appearing. This makes the case Y4
light-weighted.
The Test Suite TS3
will run the same both in the Enterprise version and the Free version.