cancel
Showing results for 
Search instead for 
Did you mean: 

How to run code in OnStopTestCase section while executing the test from Keyword/Script test area?

SOLVED
pankhuri
Occasional Contributor

How to run code in OnStopTestCase section while executing the test from Keyword/Script test area?

Hi,

 

I am trying to do some stuff at the end of my text execution, and writing that piece of code in OnStopTestCase event handler.

But I noticed that this section is executed only when I am running my test from TestItems tab of my project.

 

If I want to run my test from keyword tests or script tests, the control doesn't go to OnStopTestCase section.  Do I need to do any setting for this to work? Can someone help?

 

Thanks,

Pankhuri

 

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
brumazz
Staff

Re: How to run code in OnStopTestCase section while executing the test from Keyword/Script test area

The Event Handler should not be going anywhere in future releases of TestComplete.

 

View solution in original post

5 REPLIES 5
AlexKaras
Community Hero

Re: How to run code in OnStopTestCase section while executing the test from Keyword/Script test area

Hi Pankhuri,

 

Described behavior corresponds to the description from the documentation: https://support.smartbear.com/testcomplete/docs/reference/events/onstoptestcase.html#description

 

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
================================
pankhuri
Occasional Contributor

Re: How to run code in OnStopTestCase section while executing the test from Keyword/Script test area

Thank you Alex for replying. 

So, for testing this event handler, do I always have to run my test from TestItems section?

For OnStopTest handler, we have a similar description but I am able to execute the code for this handler even if I run the test from Keyword/Script section.

 

Not sure if I am making sense, I am just wondering why it works for OnStopTest and not for OnStopTestCase.

 

Thanks,

Pankhuri

AlexKaras
Community Hero

Re: How to run code in OnStopTestCase section while executing the test from Keyword/Script test area

Hi,

 

why it works for OnStopTest and not for OnStopTestCase.

Because not every test is test case.

Test is, actually, any code that has been executed either as a Test Item or just as a function.

Test case is the code that either is marked as test case in the Execution Plan tree or is surrounded by the aqTestCase.Start/Stop calls.

Read documentation for OnStopTest and OnStopTestCase for details to understand the difference between them.

 

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
================================
pankhuri
Occasional Contributor

Re: How to run code in OnStopTestCase section while executing the test from Keyword/Script test area

Hey Alex,

 

Thank you for clarifying. Though I have one more question- is OnStopTest handler getting deprecated sometime soon? I just want to be more careful before using OnStopTest handler.

 

Thanks,

Pankhuri

brumazz
Staff

Re: How to run code in OnStopTestCase section while executing the test from Keyword/Script test area

The Event Handler should not be going anywhere in future releases of TestComplete.

 

View solution in original post

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