cancel
Showing results for 
Search instead for 
Did you mean: 

Custom event

Lee_M
Occasional Contributor

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

 

 

Tags (1)
5 REPLIES 5
Marsha_R
Community Hero

Re: Custom event

See if this helps

https://support.smartbear.com/testcomplete/docs/testing-with/advanced/handling-events/creating-handl...

 

function GeneralEvents_OnStartTest(Sender)
{
  if (Project.TestItems.Current.Name == "FirstTestItem")
    // Do something
}

Lee_M
Occasional Contributor

Re: Custom event

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
Community Hero

Re: Custom event

@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?  

AlexKaras
Community Hero

Re: Custom event

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.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Lee_M
Occasional Contributor

Re: Custom event

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"

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors