cancel
Showing results for 
Search instead for 
Did you mean: 

Why cant I see all my tests in event handler?

SOLVED
Highlighted
Contributor

Why cant I see all my tests in event handler?

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

2 ACCEPTED SOLUTIONS

Accepted Solutions
Community Hero

Re: Why cant I see all my tests in event handler?

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.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Community Leader

Re: Why cant I see all my tests in event handler?

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 :


KWT parameters.JPG

 

The KWT will be selectable:

 

Selectable KWT.JPG

 

Thanks @tristaanogre, I learned something new Smiley Very Happy


-------------------------------------------------
Standard syntax disclaimers apply
Regards,
5 REPLIES 5
Community Leader

Re: Why cant I see all my tests in event handler?

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.  


-------------------------------------------------
Standard syntax disclaimers apply
Regards,
Community Hero

Re: Why cant I see all my tests in event handler?

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.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Community Leader

Re: Why cant I see all my tests in event handler?


@tristaanogre wrote:

So, if the KWT doesn't have the proper parameters, it's filtered out.


Ah, makes sense


-------------------------------------------------
Standard syntax disclaimers apply
Regards,
Contributor

Re: Why cant I see all my tests in event handler?

What is the filtering criteria please? What do we mean by Proper Parameters?

Community Leader

Re: Why cant I see all my tests in event handler?

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 :


KWT parameters.JPG

 

The KWT will be selectable:

 

Selectable KWT.JPG

 

Thanks @tristaanogre, I learned something new Smiley Very Happy


-------------------------------------------------
Standard syntax disclaimers apply
Regards,
New Here?
Join us and watch the welcome video:
Watch the New Interview
APITestingMistake#2