In Android developers I've seen that testPreconditions() method is supposed to be launch before all tests. But in my app test, it's acting like a normal test. It does not run before all tests. Is there something wrong ?
Here is the description about testPreconditions() from android developer : "A preconditions test checks the initial application conditions prior to executing other tests. It's similar to setUp(), but with less overhead, since it only runs once."
Actually, testPreconditions() is just another unit test. Here is a quote from "Android Application Testing Guide", a book by Diego Torres Milano:
"The testPreconditions method This method is used to check for some initial conditions to run our tests correctly. Despite its name, it is not guaranteed that this test is run before other tests. However, it is a good practice to collect all of the precondition tests under this custom name."
Milano, Diego Torres (2011-06-23). Android Application Testing Guide (p. 76). Packt Publishing. Kindle Edition.
According to Android SDK samples:
The name 'test preconditions' is a convention to signal that if this test doesn't pass, the test case was not set up properly and it might explain any and all failures in other tests. This is not guaranteed to run before other tests, as junit uses reflection to find the tests.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With