Forum Discussion

tcuser3's avatar
tcuser3
Occasional Contributor
5 years ago
Solved

Detach event from test complete

Hi all,

My case:

1. I have several keyword tests in my project

2. I also have OnLogError General Event attached 

 

The problem

In one of the keyword test I have to turn it off.

Is it possible to do it?

 

Thanks tcuser3 ...


  • tcuser3 wrote:

    Hi and thank you for a quick reply.

     

    One more thing - is there a way to do it FROM testitem and not by adding code to the event itself ?

     

    Thanks tcuser3 ...

     


    Short answer, no... because it's an event.  As soon as an error is logged and the event triggers, the event handler takes over.  You would have to make sure that, from your actual keyword test or script code you don't actually call anything that generates an error in the test log.  This includes propery checkpoints and other processes that write errors to the test log.

4 Replies

  • anupamchampati's avatar
    anupamchampati
    Frequent Contributor

    Yes you can do that. Just go into OnLogError general event and write the condition in it.

     

    if (Project.TestItems.Current.Name == 'Keyword Test Name to Skip'
    { // Do nothing
    null;
    }
    else
    {
    // For remaining cases
    }

    • tcuser3's avatar
      tcuser3
      Occasional Contributor

      Hi and thank you for a quick reply.

       

      One more thing - is there a way to do it FROM testitem and not by adding code to the event itself ?

       

      Thanks tcuser3 ...

       

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        tcuser3 wrote:

        Hi and thank you for a quick reply.

         

        One more thing - is there a way to do it FROM testitem and not by adding code to the event itself ?

         

        Thanks tcuser3 ...

         


        Short answer, no... because it's an event.  As soon as an error is logged and the event triggers, the event handler takes over.  You would have to make sure that, from your actual keyword test or script code you don't actually call anything that generates an error in the test log.  This includes propery checkpoints and other processes that write errors to the test log.