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

@Keyword
	public static boolean showAlert(String title, String message){
		int returnValue = 0;
		JFrame frame = new JFrame(title)
		frame.setAlwaysOnTop(true)
		frame.requestFocus()
		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.

@Keyword
	public static File showFileChooser(){
		JFrame frame = new JFrame("title")
		frame.setAlwaysOnTop(true)
		frame.requestFocus()
		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!

@kenzie.rigole

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.

Thanks!

@Keyword
	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)
		frame.setAlwaysOnTop(true)
		frame.requestFocus()
		return JOptionPane.showConfirmDialog(frame, message, title, JOptionPane.YES_NO_OPTION);
	}

references