0

I am automating an android hybrid application using appium. This application is a news app and displays ads randomly. So when the ad pops up my script gets failed with element not found exception. To overcome this issue I have added try catch block.when the NoSuchElement exception occurs a logic is written in the catch block to close the ad and then the test is continued.

But i found it is not feasible to add try catch block in all test methods. there are 100 plus test methods, which in turn increase my code size and not a professional approach.

I request experts help for a better solution.

Kiran Antony
  • 190
  • 1
  • 15

4 Answers4

0

I think you should integrate some crash reporting tools:

  • Crashlytics
  • Sentry
  • and there are many others in the market.

Having either of the tools integrated will help you in getting all the crashed logged over dashboard.

Paresh Mayani
  • 127,700
  • 71
  • 241
  • 295
0

Try Catch block will effect your app performance. Try handling it by yourself with checking either is null or not. If you need reporting and stats for your crash then you should go for Splunk Mint which gives you detail of your crash.

Nooruddin Lakhani
  • 7,507
  • 2
  • 19
  • 39
0

I think you can use Thread.UncaughtExceptionHandler which can caught exception and we can give appropriate message

For further you can check android document

https://developer.android.com/reference/java/lang/Thread.UncaughtExceptionHandler

Usage of it you can get from below

Need to handle uncaught exception and send log file

0

I am running a new thread which keep monitor the app activity in the device and the activity is "ad activity" then i kill that activity immediately this resolves my long time test execution problem.

Thanks everyone for you time and help

Kiran Antony
  • 190
  • 1
  • 15