Forum Discussion

Varunawasthi's avatar
Varunawasthi
Occasional Contributor
7 years ago

how to Skip Onstart event for particular Testcase in Test Complete 12

Hi,

 

I have a scenario in which an OnStartEvent I want to Skip it for a particular Test case and then again I need for other Test case

 

So generally How can I avoid/Skip using Onstart event ?

 

Thanks in advance for help.

2 Replies

  • NisHera's avatar
    NisHera
    Valued Contributor

    You can go to project/ Events / general event and click on OnStartTest event and press new button

    It will create a function like 

    function GeneralEvents_OnStartTest(Sender)
    {
      
    }

    could  be saved where ever you like.

     

    I assume you already have that and you do something in this function.

    the trick would be using a if condition....like

     

    if (Project.TestItems.Current.Name == "FirstTestItem")
     {  // Do nothing
       null;
      }
    else
     {
        // Do my usual stuff
      }   
    
    

     

     

     

    • MegO's avatar
      MegO
      Contributor

      I managed this with:

      if (Project.TestItems.Current != null)
       {  
         //on start test stuff
        }
      else
       {
          null;
        }