When I go and add a new event handler - lets say for an event OnLogError, I only see few scripts and no keyword test. Any reason?
I can definitely add a new one but I would rather use an existing one
Solved! Go to Solution.
You can run a KWT as an event handler. However, keep in mind, that there are certain objects and parameters that need to be passed in. So, if the KWT doesn't have the proper parameters, it's filtered out.
Hi @pravin_k99
I believe what @tristaanogre is referring to which parameters your keyword test is configured with. Just like you can configure a function to have parameters, you can configure a Keywordtest to have parameters.
If you let TC generate the event as a script, you will see the function is defined as such:
function GeneralEvents_OnLogError(Sender, LogParams)
If you create a new KWT, say OnLogErrorKWT and add the same two parameters :
The KWT will be selectable:
Thanks @tristaanogre, I learned something new
AFAIK You can't run a KWT as an event. You have no choice but to run a script, but there's nothing stopping you from calling a Keword Test - KeywordTests.EventHandlerKeywordTest.Run() from within the script. If the keywordtest you called however causes the event to fire e.g. Logging a message, you are stuck in a loop. I would try and keep the work done in an event to the bare minimum - rather handle those possible issues in your scripts/KWTs first and avoid KWTs being called from within events.
You can run a KWT as an event handler. However, keep in mind, that there are certain objects and parameters that need to be passed in. So, if the KWT doesn't have the proper parameters, it's filtered out.
@tristaanogre wrote:
So, if the KWT doesn't have the proper parameters, it's filtered out.
Ah, makes sense
What is the filtering criteria please? What do we mean by Proper Parameters?
Hi @pravin_k99
I believe what @tristaanogre is referring to which parameters your keyword test is configured with. Just like you can configure a function to have parameters, you can configure a Keywordtest to have parameters.
If you let TC generate the event as a script, you will see the function is defined as such:
function GeneralEvents_OnLogError(Sender, LogParams)
If you create a new KWT, say OnLogErrorKWT and add the same two parameters :
The KWT will be selectable:
Thanks @tristaanogre, I learned something new
Subject | Author | Latest Post |
---|---|---|