Is It Possible To Customize Test Step Log?

Hi gyus,
I use Page Object Model for testing in Katalon Studio, instead of just using built-in keywords.
I have classes for each page and inside of them I have static properties for components on the page. Each component class then have methods on it.

So let’s say, I have page classes, like HomePage or NotificationsPage for example. And let’s say I am showing some Graphs to user on home Page. so I would have:

public class HomePage {
public static GraphsComponent Graphs = new GraphsComponent()
}

public class GraphsComponent {
@Keyword
public void doSomeAction() {

}
}

I can call it from test this way:
HomePage.Graphs.doSomeAction()

But what is logged for this Test Step (inside Log Viewer and also in html report) is just:
Graphs.doSomeAction
instead of
HomePage.Graphs.doSomeAction

So it is not logging the name of the Page in which the component is, but I would really want to log it with that page class as well.

Can you guys pleeease help me with this? :pray: :pray: :pray: I really need it to make it work this way.

@kazurayam
@community_admin

Thanks sooo much for any help, I will greatly appreciate :slight_smile:

I was thinking about making workaround for at least html report. I could create script outside of Katalon Studio that modifies that HTML to suite my needs, and then I wanted to just call it from AfterTestSuite method in TestListener, but I realized now, that AfterTestSuite method of course runs before reports are created.

So probably, only solution would be to just call this script for modifying html report from outside of Katalon Studio manually, after the TestSuite finishes. But this would still not affect what I see inside Log Viewer and also this solution is kind of cumbersome. I would rather modify somehow this logging of Test Steps. Is it possible?

If it’s not possible to do it elegantly, is it at least possible to do it somehow through meta programming?
Like you @kazurayam showed in some of your hacks :smiley:

No. I don’t think it is possible.

My understanding

You see

Start action : graphs.doSomeAction()

in the Log Viewer as follows.

I understand you want to change this message to

Start action : HomePage.graphs.doSomeAction()

I suppose I understand what you want to do correctly.

My approach

Let me find out which class of Katalon Studio, which method is emitting the “Start action : graphs.doSomeAction()” message. If I can find the class name and method name, I would be able to dynamically modify the method implementation so that it emits a message “Start action : HomePage.graphs.doSomeAction()”.

My research

I looked at the source code of com.kms.katalon.core.* shared here.

I found that a String constant "Start action" is declared in the /Include/scripts/groovy/com/kms/katalon/core/constants/StringConstants.java file. To find it I used the following shell command:

find . -type f -exec grep  -nH --null -e "Start action" \{\} +
./Include/scripts/groovy/com/kms/katalon/core/constants/StringConstants.java19:    public static final String LOG_START_KEYWORD = "Start action";

Next, I tried to find out a statement which is using the

StringConstants.LOG_START_KEYWORD

(directly or indirectly) to emit the message into the Log Viewer. But I could not find the portion in the open-sourced repository.

I believe that the Katalon Studio’s source code that does emitting the "Start action : graphs.doSomeAction()" is not open-sourced, not published to us. Therefore I can not see what’s going on inside the Katalon Studio; I can do nothing about it.

@peter.hevesi

You should, if you would like, make a change request to Katalon Team through official ticket system at

because Katalon Dev team is not committed to read the posts in this User Forum.

Ah, well ok, nevermind, I will do that modifying script, and I will have the way I want at least in HTML.
Thank you anyway for a reply :slight_smile:

@peter.hevesi

If I am going to develop Web UI tests using Page Object Model, I would not use Katalon Studio. I would rather develop tests with GEB + WebDriver + Spock + JUnit + Groovy + Gradle. An example is here.

In my humble opinion, KS is primarily designed for the best sake of non-programmers. But you want Page Object Model — then you must be a programming expert. Why you bother in Katalon Studio?

Actually, I think the best thing to do tests in isn’t Selenium anymore, but Playwright.
So I would just use Playwright in Visual Studio, but I already started doing tests here, because my boss wanted me to record tests, so I invested a lot of effort to do it here, I have our entire website automated here in Katalon Studio already using Page Object Model, so we can now easily create a lot of tests. My boss don’t want me to switch to Playwright, because he thinks it’s not mature enough yet and because it will take time to transfer it to Playwright, but we need to run these tests right now. And also because he still wants me make somehow this Katalon Studio work with recording. But to be honest, I abolutely don’t think it’s possible and a good idea:

  1. It don’t work realiably in many many situations, where I had to create workaround (for example, authentication didn’t work, setting Date to DateInput didn’t work reliably across all browsers, working with many tabs inside one browser instance totally didn’t work until I coded workaround myself. File Upload is not working good…

  2. Our developers use dynamic IDs, or sometimes they don’t use anything at all, and i have to write Xpath selectors based on some parent object.

  3. We have many lists of items on our website, and Katalon recording just absolutely can’t handle it. It doesn’t understand, what one item of a list is, and what identifier can I use to work with that item. It just creates some very ugly xpath selector in these situations , which would break on slightest change on a website. I absolutely don’t think Katalon recording can work with list of data items.

  4. There are many situations in testing, where there are “Bigger Actions” that consist of many “Small actions”. Let’s say you want user to buy an item in a store, and then check if it is in cart and then do the order. Now you want to do it for 5 users, then you will have 5 times longer test script, instead of calling 5 times a method that do it. There is one principle in programming called DRY (Don’t Repeat Yourself). Because when you want to do some change, do it in a single place, don’t change it in many many different locations. So that’s why Page Object Model is much better.

  5. On our websites, we have components, which are used on more than one page. So I am doing something like Page And Component Object Model and I can reuse that exact component on different pages, without a need to have Test Objects for that component duplicated.

  6. Tests that these recording tools produce are ugly, hard to read and understand and hard to maintain.

Yet, my boss still think I should try to somehow make this recording work, but I just think it’s absolutely not possible, and I think this whole Recording of Tests is just a HUGE BULLSHIT, that don’t work, and is even impossible to work with any website, that is a little bit more complicated and works with a lot of dynamic data. It can only be used on simple static websites.

That’s why I am here in Katalon, because it was the cheapest solution by far in comparison to other products that can do this bullshit web recording my boss wants me to do. Like Ranorex Studio or Test Complete for example.
So I am stuck here in Katalon Studio, but I would totally prefer to switch to Playwright, which I have absolutely no doubt, that it is the best framework to do automated tests in. By doing Page Object Model with C# in Visual Studio :smiley:

I am actually mad at all these tools, which are marketing this “Record all your tests without any coding skills required"… Well, what a HUUUUGE BULLSHIT :smiley: :smiley:

Here are 3 articles I found, which also describes the same opinion about recording tests, as I have :smiley: :

https://alisterbscott.com/2016/06/01/test-automation-why-record-and-replay-fails/

@peter.hevesi

You enumerated 6 issues.

  1. Katalon Studio does not work reliably in many situations: authentication, etc.
  2. KS does not cope with pages that uses dynamic IDs.
  3. KS’ Recorder can not handle lists of items.
  4. KS breaks the DRY principle
  5. KS does not work in sync with the component model of server-side app
  6. KS produces ugly test scripts

And you mentioned you think that Playwright is better than KS on top of Selenum.

I am interested how Playwright solves the aforementioned 6 issues better than KS. Could you share your experiences?

Well it isn’t that Playwright solves these issues, but using Page (And Component) Object Model solves them instead of using Recorder. I mentioned Playwright, because it is the future of automated tests for web. Selenium is not reliable, it is not supporting very well, because as I said, there are many situations that just don’t work. If you look at Selenium IDE, it’s kinda like Notepad in comparison to Word. It can’t work with data for example. It is so simple I think best description of it, is that it’s like Notapad :smiley: But Selenium is something like 15 years old, don’t you think it should have better official IDE? Selenium is dying, I am pretty confident. Because it’s just don’ work reliably …

Playwright now also have recording feature, but I don’t recommend anybody to use it at all for any Enterprise Application. If a person can’t code, I don’t think he can create good quality tests for Enterprise Application. I don’t think that Playwright is even promoting to use this recorder, because it’s all about CODING tests, which is very correct approach.

And what about advantages of Playwright in comparison to Selenium? I found a good article that lists them:

But in my perception, it has much better internals, it doesn’t use WebDriver, but is rather much more tightly coupled with Browsers. It is faster, it has better selectors and is much more reliable. And there is Microsoft behind it. And to be honest, the number 1 company in the world for making programming frameworks and programming ecosystems and stuff like this is without no doubt: Microsoft. It’s fantastic .NET 6, it’s just soo awesome nobody else can compete with it. Visual Studio 2022, it’s just very good. And to complete the list, C# is the best programming language by far. So it’s like a huge con, that Microsoft is behind it. But it is also open sourced.

But to say some cons too, Playwright is very young, about year and few months old I think, so it is not very mature yet, I assume it still have many bugs. But once it mature more, it will be sooo best. And another con, it still doesn’t have a complete Testing IDE like Katalon Studio is, but you can use it in Visual Studio and connect some Testing Framework like NUnit to it.

I haven’t tested it that much, but I am somehow pretty confident, that it’s so awesome from what I know about it. And Microsoft behind it, it just totally gives me that confidence :rofl:

A also wrote a post here in Katalon Forum, that Katalon Devs should consider to start supporting Playwright as well:

And one last thing to say about Playwright: It can be used with many different languages, like C#, Java (that’s why it could be easily brought to Katalon Studio), Javascript and Python as well I think.
But I totally think it should be used with C#.

But to solve all these aforementioned issues, it’s not just Playwright vs Selenium. It’s also Coding test vs. Recording them.

What do you think about it?

OK, fair enough. Thank you for clarification.

And to clarify it even more, it’s not just about Microsoft being behind it, there is kinda Google behind it too. Because Google created this Framework called Puppeteer, but that framework is only for Google Chrome. So Microsoft steal some guys from this Puppeteer project and created Playwright based on the Puppetteer, but for all browsers, not just Google Chrome.

I thought that the point is that your boss thinks Katalon is good enough to test your Application Under Test, but you disagree with his view; therefore you have managed to introduce Page Object Model in Katalon Studio.

:crossed_fingers:

Now we can go back the your original requirement: you want to see a message Start action : HomePage.graphs.doSomeAction() in the Log Viewer in the Katalon GUI. I am sure it requires Katalon’s code change to achieve your requirement. You had better make an official ticket for it if you would like.
… I guess, it is likely that Katalon can meet your immediate requirement if you could persuade them.

Well, I will code it myself :smiley: I am already creating script, that is modifying HTML Reports, which is actually all I need. I will use your custom report, to include Global Variables in it, and will put those Page names in it, it’s not that hard. I don’t think Katalon developers would prioritize this task, because as you said, Katalon Studio is not about Page Object Model. And I would have to wait for it I don’t know how long. So I will rather do it myself, and I will have it today probably :smiley:
I won’t see it in Log Viewer, but actually it doesn’t matter, I like those HTML Reports :slight_smile:

But once again, thanks so much for your help :slight_smile:

OK. Will you agree closing this topic?

Yeah, you can :slight_smile: