cancel
Showing results for 
Search instead for 
Did you mean: 

Searching for a way to run a groovy script when closing a project

Highlighted
Contributor

Searching for a way to run a groovy script when closing a project

Hi,

 

I am looking for a way to cleanup run testcase get properties only once, preferrably when closing a project. I know now how to cleanup those properties. Purpose is to be able to use Git combined with run testcases.

Does anybody has suggestions? I did look at events but I have not found an event when closing or maybe saving a project.

8 REPLIES 8
Community Hero

Re: Searching for a way to run a groovy script when closing a project

@asseldonk01,
You mean to clean up custom properties of a test case on closing of the project (or saving the project)?
Clean up means remove the values alone? or property names as well?


Regards,
Rao.
Contributor

Re: Searching for a way to run a groovy script when closing a project

Hi rao, i as mentioned i have a groovy script to empty the values of the get properties of a run test case. I would like to be able to do this automatically. Preferably when closing the project. How can i do that automatically.
Community Hero

Re: Searching for a way to run a groovy script when closing a project

@asseldonk01,
Sorry, did not get what you mean by - "get properties of a run test case".

Could you please show a screen shot along with the script you have for the review?
How many such cases there for you to be clean up?
Where the current script placed? Is it in a common place or in a specific test case ?

As you know there is no out-of-the-box functionality, need to understand the use case. So answering above info will help.







Regards,
Rao.
Community Hero

Re: Searching for a way to run a groovy script when closing a project

Hi,

 

ReadyApi provides the concepts of Setup and Tear down scripts. The Setup script runs before a certain phase (either Project, Test Suite or Test Case) while the Tearn down script runs after a certain phase.

 

That being said, if you want to run a script after the project is run, you can click on the project in the Navigator, click on Tear down script and add your code there.

 

2019-02-10_18h05_42.png

 

Later edit: it was only after I posted that I saw you wanted this to happen when closing a project and not after the project was ran. I don't really have a solution for this.



If my answer helped please click on the 'Accept as Solution' button.
Contributor

Re: Searching for a way to run a groovy script when closing a project

Hi Rao and Lucian,

 

Thanks for your remarks. First i learned that describing something in a post is not that easy. You believe that it is clear but that is certainly not always the case. 

I was looking for a way to call a groovy script when closing a project. I will now have a more closer look at teardown scripts and maybe again events. 

Thanks!

Community Hero

Re: Searching for a way to run a groovy script when closing a project

More information will reduce the time for the better answers, and number of iterations as well.

When there is script already, why let the others to imagine ?

Depends on the context, the same script may work from certain place and the same may not work from other place.
For example, if script is provided at Script Assertion level, many not work in a groovy script test step. A script of groovy script test step is placed in test suite tear down, may or many not work depending the context variables being used.

That's the reason why asking for the information.
And there is no use of providing some random info to try without full knowledge of understanding of the problem.


Regards,
Rao.
Community Hero

Re: Searching for a way to run a groovy script when closing a project

People don't have answers ready, always. Have to understand the problem, spending their valuable time to find out solutions, that helps both seeker and those reply to learn new thins form others problems.


Regards,
Rao.
Community Hero

Re: Searching for a way to run a groovy script when closing a project

One more thing is if the problem is one for one test case, then it would be simple to execute the script. However, the same may not helpful / feasible if it has to done for more number of cases. That is what all makes changes if there is good context to the problem.


Regards,
Rao.
New Here?
Join us and watch the welcome video:
Watch the new Interview
Top Kudoed Authors