Sitemap
Mobile App Development Publication

Sharing iOS, Android and relevant Mobile App Development Technology and Learning

Member-only story

All about TestRule — A Steroid Before/After

--

We usually have @Before and @After in our test for setup and teardown functions needed for the test. So what is testRule?

It’s so commonly used

We have have seen it and used it, if one has use Espresso test before, and one very common way of using it is

But what is it? It looks magical.

The definition of TestRule

If you dive into the TestRule interface code, you’ll see it as below

A TestRule is an alteration in how a test method, or set of test methods, is run and reported.  A TestRule may add additional checks that cause a test that would otherwise fail to pass, or it may perform necessary setup or cleanup for tests, or it may observe test execution to report it elsewhere. TestRules can do everything that could be done previously with methods annotated with @Before, @After, @BeforeClass, or @AfterClass, but they are more powerful, and more easily shared between projects and classes.

--

--

Mobile App Development Publication
Mobile App Development Publication

Published in Mobile App Development Publication

Sharing iOS, Android and relevant Mobile App Development Technology and Learning

Elye - A One Eye Dev By His Grace
Elye - A One Eye Dev By His Grace

Written by Elye - A One Eye Dev By His Grace

Sharing Software, Life and Faith Journey. Follow me on Twitter/X to access to my article free

No responses yet