Continue Android tests after an exception

2019-06-22 15:40发布

When running my test suite in Android Studio, occasionally there will be an exception thrown from somewhere in my code (not in the test) which will cause the current test to fail (good because the test has found a bug) and the rest of the tests to stop running (not so good). I'd like the tests to continue running so that the entire suite finishes. Is this possible?

2条回答
Explosion°爆炸
2楼-- · 2019-06-22 15:57

it is not possible by concept of INTERPRETER and COMPILER. Android uses jvm(java virtual machine) and JIT (just in time) compiler. so at the time of bug it will not able to compile further so execution will stop from the point of bug.

查看更多
男人必须洒脱
3楼-- · 2019-06-22 16:00

As explained by Mayur, it is not possible to do this.
A solution is to split up your testing into separate projects. It provides 2 benefits:

  • You can run tests in parallel (faster execution, especially on multi-core platforms)
  • You can catch multiple errors at once

Downsides:

  • Requires some project restructuring
  • Doesn't allow you to catch ALL errors at once
查看更多
登录 后发表回答