@kazurayam
Can we use the Highlight custom Keyword in TestListner
class NewTestListener {
/**
* Executes before every test case starts.
* @param testCaseContext related information of the executed test case.
*/
@BeforeTestCase
def sampleBeforeTestCase(TestCaseContext testCaseContext) {
CustomKeywords.'com.kazurayam.ksbackyard.HighlightElement.pandemic'()
}
}
Yes.
But I would prefer using the HighlightElement
class as a plain Groovy object without wrapping it with CustomKeyword
.
import com.kazurayam.ksbackyard.HighlightElement
import com.kms.katalon.core.annotation.BeforeTestCase
import com.kms.katalon.core.context.TestCaseContext
class TL0 {
@BeforeTestCase
def sampleBeforeTestCase(TestCaseContext testCaseContext) {
// modify WebUI.* keywords which take TestObject as arg0
// so that they call Highlight.on() automatically
new HighlightElement().pandemic(['verifyElementPresent'])
}
}
The CustomeKeyword
is something required for the “Manual mode” of Test Case editor authoring time only. It is not necessary runtime. You will never edit a Test Listener in the “Manual mode” of Test Case editor. Therefore, I think, you should not write CustomKeywords
in a Test Listener.
1 Like
Katalon Studio v9.1.0 has been released. This version includes a change that all Groovy classes under the “Keywords” folder is exclusively available for Enterprise users. See
This means, Groovy classes under the “Keywords” folder is no longer available for Free version users. See another topic also.
Nearly 4 year ago in this topic, I wrote:
That’s a thing of the past. As of v9.1.0, a Free version user can not create/use any Groovy class under the Keywords folder. Therefore she/he can make no patches to Katalon Studio runtime. She/he has to wait for Katalon Team to hear her/him, change the original source and release a new version. I hope that Katalon Team to be responsive enough to the voices of free version users.
1 Like
I have updated my project and published v0.7.0
The changes include:
- Customizing the style of highlight:
- Specify more keywords to highlight by extending the list of keyword names, like
['verifyElementPresent', 'waitForElementPresent']
- Improved the README document
By the way, KS v10.0 brought the Custom Keywords feature back to the Free version. So the highlighting capability has been restored.
2 Likes