Display Text at End of Test Suite

I am building two test suites for an end user to run. Between the first and second test suite, the user needs to do some manual steps on the webpages. (They were steps I could not automate for a variety of reasons.) The end users may vary and I doubt they will be super technically savvy.

Is there a way to create a test case that would display the instructions for the manual steps at the end of the first test suite? To act as a failsafe, I’d like to have the instructions display in Katalon at the end. As a sort of, “REMINDER - Between the test suites you need to do XY&Z.”

The end user will be trained to check the Log Viewer to see if the steps passed. Perhaps, I could create a method that prints the information in the Console and call that last?

Does anyone have advice on how they’d approach this?

In the TestListener @endTestSuite-annoted method,
You can use WebUI.comment(String message) to display any messages you like.

I have ever done something similar.

I wanted to prompt to testes and require “Y/n” reply from them.

As you are already aware, Katalon Studio does not provide any means for user’s Test Case script to display GUI component (widget, modal dialong, …).

Therefore I wrote a Groovy script that displays a modal dialog using Java Swing API

It worked, but had 2 problems.

  1. The Swing dialog goes behind other windows (e.g, Katalon Stuio GUI itself) when I clicked other window. The dialog can not stay on the top of windows and stay visible. I easily missed the dialog — it is very problematic.
  2. The Swing dialog sometimes disappeared. I could not analyse what’s going on.

I could not solve these problems. I am not positive about this approach.

I think we need Katalon Studio to provide some keyword or something that enables users Test Case to open a GUI dialog. Katalon Studio should control the dialog to stay on the top of Katalon Studio GUI window.

i have a custom keyword i have been using for a while, and it might be what you need, you should be able to adjust it to display different things, but the setAlwaysOnTop will put it on top of any other windows that might be present, including the Katalon Studio GUI

	public static boolean showAlert(String title, String message){
		int returnValue = 0;
		JFrame frame = new JFrame(title)
		returnValue = JOptionPane.showConfirmDialog(frame, message,title, JOptionPane.YES_NO_OPTION);
		assert returnValue==JOptionPane.YES_OPTION;
		return returnValue==JOptionPane.YES_OPTION;
1 Like

Thank you for your info.

Vaguely I remember, I wrote a code that shows a JFileChooser. I wanted a user to choose one file in a specific directory, and click GO button to continue the test processing. The rest of the test will run driven by the data loaded from the interactively chosen file.

Unfortunately JFileChoose did not have “setAlwaysOnTop(boolean)” method.

	public static File showFileChooser(){
		JFrame frame = new JFrame("title")
		File file=new File("filepath")
		JFileChooser j=new JFileChooser(file, FileSystemView.getFileSystemView())
		int clickedButton=j.showOpenDialog(frame)
		if (clickedButton== JFileChooser.APPROVE_OPTION)
            return j.getSelectedFile();

using JFrame should also provide a solution to any situation the original poster might need

i have edited this example to return the actual file(rather than the button that was clicked), since it has been referenced in another post, and for the cases where others try to search on FileChooser and land on this post
in order to learn more about the options available with JFileChooser, i recommend reading https://docs.oracle.com/javase/7/docs/api/javax/swing/JFileChooser.html

1 Like

Could I use this somehow? Or should I be using WebComment?

How would I edit this to display a series of instructions? What’s the best way to store the instructions so they are called in this message… create a global variable?

Thank you for your help!


Thank you.

I tried your code and confirmed that the dialog stays visible over the other windows.

This is great. How would I edit the font size? The text is quite small.


	public static int showConfirmDialog(String title, String message) {
		int returnValue = 0;
		Font font = new Font(Font.SANS_SERIF, Font.PLAIN, 58);
		UIManager.put("OptionPane.messageFont", font);
		UIManager.put("OptionPane.buttonFont", font);
		JFrame frame = new JFrame(title)
		return JOptionPane.showConfirmDialog(frame, message, title, JOptionPane.YES_NO_OPTION);


I’m getting two errors – in the keyword the Sans_Serif and Plain are underlined. When trying to auto import via CTRL SHIFT + O, nothing appears.

And when I attempt to run the keyword as a test case, I get this error:
The import com.sun.org.apache.xpath.internal.operations.String collides with another import statement

01-19-2022 11:31:00 AM reusableComponents.ShowAlert.showConfirmDialog("Test", "Testing message function")

Elapsed time: 0.053s

Test Cases/DEV/STR/Workflow 1 End Instructions FAILED.
com.kms.katalon.core.exception.StepErrorException: org.codehaus.groovy.runtime.metaclass.MissingMethodExceptionNoStack: No signature of method: reusableComponents.ShowAlert.showConfirmDialog() is applicable for argument types: (java.lang.String, java.lang.String) values: [Test, Testing message function]
Possible solutions: showConfirmDialog(com.sun.org.apache.xpath.internal.operations.String, com.sun.org.apache.xpath.internal.operations.String)
	at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.throwError(CustomKeywordDelegatingMetaClass.java:96)
	at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:68)
	at Workflow 1 End Instructions.run(Workflow 1 End Instructions:20)
	at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
	at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
	at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:442)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:433)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:412)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:404)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:281)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:138)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:129)
	at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
	at TempTestCase1642620657707.run(TempTestCase1642620657707.groovy:25)
Caused by: org.codehaus.groovy.runtime.metaclass.MissingMethodExceptionNoStack: No signature of method: reusableComponents.ShowAlert.showConfirmDialog() is applicable for argument types: (java.lang.String, java.lang.String) values: [Test, Testing message function]
Possible solutions: showConfirmDialog(com.sun.org.apache.xpath.internal.operations.String, com.sun.org.apache.xpath.internal.operations.String)

The message is saying that “reusableComponents.ShowAlert” is not found in the CLASSPATH.

Possibly your test script has a wrong import statement.

The package name “reusableComponents” looks odd to me.
Is it your own custom keyword?
Did you spell it correctly?

You should not expect that Auto import (CTRL SHIFT + O) can always solve your problem appropriately. In my opinion, CTRL SHIFT + O is just a short-cut to let you type less. You should not expect it to find the correct fully qualified name of a class named “Sans_Serif” and “Plain”. I do not see what the fully qualified name of “Sans_Serif” and “Plain” you want. Nobody sees it, I think.

Possibly you copied and pasted the code that includes “Sans_Serif” and “Plain” from some original. Please check your original and find out the correct package name.

Did you copy&paste from my sample code above?

            Font font = new Font(Font.SANS_SERIF, Font.PLAIN, 58);

Please note, SANS_SERIF and Sans_Serif are not equal. The upper case/ lower case matters!

You can find my full code here if it helps:

Hi Theo,

I think we could further enhance this idea.
Could you explain why you build a test suite for end-users? Guessing that you are a test automation expert and building tests for manual - low tech users aka end-users?
Thinking this is also valid for cross-team if you send the test to other team members.

Yep, I built the test cases and test suite for an end-user to launch. They need to know the instructions at the end because there are manual setup before running the next suite.

The test suites are two workflows for an item in our business mgmt system – unfortunately, I couldn’t automate a couple parts of it so a person needs to do manual work between the test suites. The instructions popping up are a great way to ensure the person remembers to perform the steps before moving on rather than relying on them hopefully remembering and checking documentation elsewhere.

Ah, I didn’t realize I needed to update the package information (I’m brand new to this work).

Your code works! Thanks for your help.

Let me tell you my case.

A few year ago, I was given with a large Excel workbook. The .xlsx file contained 40 sheets. Each sheet contained some hundreds of rows (e.g, 500). A single row contained a URL, credentials (name/pw), some descriptions. So the Excel file contained approximately 20,000 URLs. This Excel sheet was created and maintained by somebody in the company for their own purpose. I was not in charge of editting/maintaining the file at all. I had no right to modify the file.

My boss asked me to test the URLs included in the Excel workbook file using some Web UI automation tool. I used KS and applied my VisualTestingInKatalonStudio approach. Soon I found that 20,000 URLs are too many to process as a batch. I expected to take 3 - 5 days to take screenshots of 20,000 web pages and do image comparison. Nobody would like to use it.

It was not necessary to process all of 20,000 URLs at a time. I wanted to generate a smaller size of test data by choosing some portion of rows out of a sheet. How did I choose rows? — it is not an important question here. In fact, I developed many patterns of test data selection out of the given data source. Namely “this weeks data”, “todays’ data”, “Test data for phase 1.2.3”, “Test data for the next week-end work”. Anyway, I developed a set of preprocessors that generate 50 rows out of 20000, 200 outout 20000, etc.

So I designed my test to have 2 segments.

  1. Preprocess the original Excel workbook to generate a set of test data. Read the .xslx file to generate 40 - 100 CSV files in a designated directory.

A test choose a CSV to process and

  1. Run Visual Testing script in katalon studio with the CSV file selected

Therefore I wanted my test to display a JFileChooser dialog to ask the tester to choose which CSV file he/she wants to process.

Having a GUI Dialog made easier for testers to run the test suite. I asked a tester who is going to work on a weekend,

Look at this FileChooser dialog! You want to select THIS file, and let the VisualTesting tool to consume it. It will run 20 minutes. You can have a coffee break then. Once the test run 100% passed, you can go home with relief. If the test failed, well, good-luck!