Forum Discussion

Lee_M's avatar
Lee_M
Community Hero
4 years ago

Custom event

Can I assign a custom event ?

 

I have an input process that spans a couple of screens, I have written a test case for every step (so that we run any steps needed)

 

Now the developer has added a confirmation box at every step

 

I can add a test for this at the end of every script but is there another way ?

 

ie.

 

script: if script = "Steps_*" then run "check_confirmation"

 

I realize that I can just add a function call at the end 10 scripts, but say it was 1000 + different step scattered over my Project or ProjectSuit

 

 

5 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    Without knowing any details about tested application, this is my personal opinion:

    a) It is not a big deal to add one function call in ten places. Also this might be a good reason to refactor existing code. For example, replace the click over the 'Next' button with the call to, say, proceedNext() function. In this function perform click on the button and check if confirmation window appears. Handle it if it appears;

    b) Depending on the type of tested application and notification window: you may consider OnUnexpectedWindow event that will trigger for desktop application if test code tries to interact (click, activate, set focus) with UI element that is blocked by some other window. If this is your case you may just handle this confirmation window within event handler's code.

     

    • Lee_M's avatar
      Lee_M
      Community Hero

      Hi,

       

      I am suggesting that there are too many scripts to augment and am looking for a wildcard event trigger

       

      ie.

      test runs successfully

       

      browser now wants an update but am unable to due to security policy

       

      I am looking for a wildcard or regex triggered event

      if script = (login.*|.*navigate_to.*) then 

                  dismiss update popup

      or if event = update popup

                  dismiss update popup

       

      not as generic as "OnStartTest"

    • Lee_M's avatar
      Lee_M
      Community Hero

      This would only happen once, I am looking for is to trigger on any script

       

       

      ie

       

      Project

        -Script

           -step1

           -step2_bc

           -step3

           -step4_bc

       

       

      I would like any event to trigger on every bc script

       

      e.g.

        on "*bc*" test if (input = 3)

       

      • Marsha_R's avatar
        Marsha_R
        Champion Level 3

        AlexKaras Isn't there a way to wrap the main script in an event handler and have it happen for each of the child scripts?