cancel
Showing results for 
Search instead for 
Did you mean: 

Try Catch Finally don't work

SOLVED
Occasional Contributor

Try Catch Finally don't work

Hi guys,

 

I need one help friends.

 

In one test case occurs one error, I need to jump for the next test. I'm using try catch an finally, but this functions don't work.

 

Look my script test:

 

function emissaoGarantiaLicitantePublicaSucesso(){
  try{
  LoginGGTests.testAbreGG();
  cadastroDeSolicitacaoGarantiaLicitantePublicaSucesso();
  LogoutGGTests.erro;
  listaCadastroSolicitacoesComiteCreditoFavoravel();
  listaCadastroPropostaSeguroGarantiaFiancaLocat();
  autorizaAssinaturaTestSucesso();
  LogoutGGTests.fecharGG();
  LoginGGTests.testAbreGG();
  telaConsultaDocumentoSucesso();
  LogoutGGTests.fecharGG();
}
catch(e){
  Log.Error(e);
}
finally{
  LogoutGGTests.fecharGG();
}
}

 

Look my properties:

 

image.png

 

 

My version is 12.60

2 ACCEPTED SOLUTIONS

Accepted Solutions
Community Hero

Re: Try Catch Finally don't work

What kind of error are you expecting to trap that is not?

One thing to keep in mind, try/catch/finally only catches script level exceptions.  Object recognition errors and other TestComplete execution engine errors do not throw a script exception.  In order to trap those, you should implement specific code to check for object existance and then throw the error with a "throw" call.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available

View solution in original post

Occasional Contributor

Re: Try Catch Finally don't work

Hi Friends,

 

I used some things for to solve this problem.

 

1- I my windows tests I get see two new columns, for help us in this case Stop on error and Stop on exception. Was needed to click with rigth button of mouse for to look this columns.

2- In finally block, was needed change for TestedApps.NameApp.Terminate();

3- And any errors are need to treat in TestComplete. If one error to block application, will be necessary to treat this error.

 

Thanks Tanya and Trista for your help!

View solution in original post

5 REPLIES 5
Community Hero

Re: Try Catch Finally don't work

What kind of error are you expecting to trap that is not?

One thing to keep in mind, try/catch/finally only catches script level exceptions.  Object recognition errors and other TestComplete execution engine errors do not throw a script exception.  In order to trap those, you should implement specific code to check for object existance and then throw the error with a "throw" call.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available

View solution in original post

Highlighted
Community Manager

Re: Try Catch Finally don't work

Hi @edirley,

 

Did you find the solution? Please share it with us - it may help other members in the future.

 

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
Occasional Contributor

Re: Try Catch Finally don't work

Hi Friends,

 

I used some things for to solve this problem.

 

1- I my windows tests I get see two new columns, for help us in this case Stop on error and Stop on exception. Was needed to click with rigth button of mouse for to look this columns.

2- In finally block, was needed change for TestedApps.NameApp.Terminate();

3- And any errors are need to treat in TestComplete. If one error to block application, will be necessary to treat this error.

 

Thanks Tanya and Trista for your help!

View solution in original post

Community Manager

Re: Try Catch Finally don't work

Great to hear that the issue has been resolved Smiley Happy

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
Occasional Contributor

Re: Try Catch Finally don't work

Thanks Tanya for your help.

 

 

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