Better use of katalon studio


#1

There has been always a trouble with me. how can I just write one sentence script then all the test steps working? such as:hignlight and capture screenshots. if write it once at each step,i believe it’s very terrible.
My English is poor. If i say something wrong, please don’t mind.
thanks. @ kazurayam :grinning:


#2

At first, you should read the following post, and learn how to make a good question.

You need to show what you have done. Show your code, screenshots, log messages.

You need to clarify what you want to do. Share the URL of your target web app if possible. And, say, what you want to do with it?


#3

about yesterday topic,I already know the magic highlighting method, which is to distinguish between colors. So I copied his code, I want to use only in every step to add the custom keyword, I wonder if there is a way that all the test steps can be highlighted during playback. Pictured here.
form 2 step, if I want to every steps can highlight display,i must use the custom keywords before the obejct,but it only works for one line.


Is there has a better way to complete it ?


#4

from not form ,sorry,i mke a mistake


#5

You can edit your post by clicking the button edit displayed at bottom-right corner of your post


#6

Here is a working example of a Test Case which uses the HighlightElement keyword.

Study this example to find difference from you one.


#7

and the same as screenshots. i want to leave a screenshot at each step.how can i do without after each step . wirte 9 step once,all steps work!


#8

You need to develop a Custom Keyword yourself.


#9

i know,but how to use it ?and custom keywords is also same as webui keywords, becase they are both use"add"
then only one step work, and only one object correspondence.


#10

Study the source code of my com.kazurayam.ksbackyard.HighlightElement class. This class performs a magic you want.

Especially the following portion is the magic spell.

    @Keyword
	public static void pandemic() {
		WebUiBuiltInKeywords.metaClass.'static'.invokeMethod = { String name, args ->
			if (name in influencedKeywords) {
				TestObject to = (TestObject)args[0]
				HighlightElement.on(to)
			}
			def result
			try {
				result = delegate.metaClass.getMetaMethod(name, args).invoke(delegate, args)
			} catch(Exception e) {
				System.out.println("Handling exception for method $name")
			}
			return result
		}
	}

To understand this magic, you would want to learn runtime Metaprogramming of Groovy Language. Read the following document:

If you want to take screenshots of each individual Test Objects, as well as highlighting them, you would want to modify the implementation of HighlightElement.on(TestObject) method , in which you would call the aShot library to take screenshots of HTML elements.


#11

Your coding skills are very good, and you like to help others. You must be a very nice person in your life.in a word.,thanks a lot ! because i has not more words! the language limits my vocabulary.
welcome to visit China!
Sincerelly