Does execution time affect the result of created data?

Hi everyone, I’m using automation to create docs, I’ve executed it and the result is pass everytime, however when I go to the search screen, I couldn’t find the latest created doc.
I’ve tried to created doc manually and this problem doesn’t occur. The question is why this happened ? My assumption is that probably the execution time is too fast so the server haven’t receive the request, if so, how can I solve this problem ?
Thanks !

1 Like

I don’t understand what you extected to see, and what you actually saw.

Screenshot, please.

This is the start screen (Create Category), I have to fill in the requeired textbox (red label text) and click submit (blue buttoon in the footer)
After create this Category, I have to go to the search screen to submit the created category in order for the new category to display on the tree in the picture above


This is my script and result, it says pass everytime but when I check the search screen, it didn’t appear the latest category
The script and result:

The Search screen after create new category:

I also show the execution down below

*Note: I have no problem create category manually, here is proof but I don’t know the reason why, I have other script that with the same flow works normally (Create Doc → Search Latest Doc → Approve Doc)

Thank you for the screenshots. This helps us a lot.

But, sorry, I still do not understand what you are unhappy about.

Please describe your issue more specifically.

Which data you expected to see on which screenshot at which location?

It might be perfectly obvious to you yourself, but it is not easy for other guys to guess right.

Okay, so the flow of the execution is this:

Create New Category → Move to the Search Category Screen (Find the latest created Category using the Text that has been input in the red labeled textbox in the 1st screenshot) → Approve the Category

I’m done with the script for the Create New Category function, and it runs smoothly, no problem occurs. The problem happened when I go to the Search Category screen, I cant find the latest Category Created with the name (Format = Dai + Random Number), I’ve tried to sort from latest → oldest but nothing showed there.

Here is the demo of a different function but has the same workflow as above and this script runs absolutely well, meets no error with finding latest created doc on the Search screen

This seems to be a problem of the server-side application that works behind the scene.
Do you think it is a problem of Katlaon-side? Why?

One thing I can suggest is to add “verify” statements to your script at points. I also take screen shots when I am developing the scripts as well and then may just leave them in for sensitive areas.

"object is a dropdown object"
WebUI.verifyElementVisible(findTestObject('Dropdown phan trang'))

WebUI.selectOptionByLabel(findTestObject('Dropdown phan trang'), '...', false)
WebUI.verifyOptionSelectedByLabel(findTestObject('Dropdown phan trang'), '...', false, 10)

WebUI.waitForPageLoad(10)

"if this is a radio button, or checkbox"
WebUI.verifyElementClickable(findTestObject('...'))
WebUI.click(findTestObject('...'))
WebUI.verifyElementChecked(findTestObject('...'), 10)

WebUI.takeFullPageScreenshot('pathway to screenshot folder' + 'pictureName.png')

What the “verify” statement can do is tell you if there are issues with what you expect to happen, has indeed happened. And the picture can verify that too. Just a suggestion.

Edit: It also looks like you are running your script just by the Test Case, rather than through a Test Suite. Running your Test Cases using a Test Suite will give you access to the various reports that KS generates, which might be useful for when something does not go correctly.

Edit2: It depends on what you are trying to do with your scripts, but for the drop-down, you can also check all the items in the drop-down are present using verifyOptionPresentByLabel, and maybe the number of options in the drop-down too, using getNumberOfTotalOption.

WebUI.verifyOptionPresentByLabel(findTestObject('myPage/select_ProvinceState'), 'SK', false, 10)
WebUI.verifyOptionPresentByLabel(findTestObject('myPage/select_ProvinceState'), 'YT', false, 10)
WebUI.verifyOptionPresentByLabel(findTestObject('myPage/select_ProvinceState'), '', false, 10)

"number of provinces and territories in Canada; add one for blank"
numItems =  WebUI.getNumberOfTotalOption(findTestObject('myPage/select_ProvinceState'))
WebUI.verifyEqual(numItems, 14)
1 Like

I agree with @grylion54.

Using WebUI.verifyElementPresent(testobject, timeout) and other “verify” statements, you can express what you exect to see. When the statements fail with diagnostics, it will tell you what you actually got. If you copy&paste the diagnostic message emitted by the “verify” keywords into the post here, then the diagnostic will best describe your problem to others.

Unfortunately the Katalon Studio’s built-in Web Recording tool does not insert any verification statements automatically. It is not very intelligent. You are supposed to insert appropriate verification statements into the generated test scripts for yourself to make the tests better and useful.

1 Like

Thanks everyone, the tips are really helpful but it doesn’t resolve this problem. However I’m started thinking that this is a server-side problem, not Katalon. I’m closing this topic and investigate on the mentioned problem for now.