Skip to content
  • Michael Comella's avatar
    For #9605: replace unit test runners with FenixRobolectricTestRunner. · 6e0d851d
    Michael Comella authored
    This is how we can apply the new test runner to remove duplication.
    
    This commit was generated programmatically with the following commands:
    ```
      // Replace test runners with new one.
      find app/src/test -type f -exec gsed -i "s/@RunWith(RobolectricTestRunner::class)/@RunWith(FenixRobolectricTestRunner::class)/" {} +
      find app/src/test -type f -exec gsed -i "s/@RunWith(AndroidJUnit4::class)/@RunWith(FenixRobolectricTestRunner::class)/" {} +
    
      // Replace imports of old test runners with new one
      find app/src/test -type f -exec gsed -i "s/org.robolectric.RobolectricTestRunner/org.mozilla.fenix.helpers.FenixRobolectricTestRunner/" {} +
      find app/src/test -type f -exec gsed -i "s/androidx.test.ext.junit.runners.AndroidJUnit4/org.mozilla.fenix.helpers.FenixRobolectricTestRunner/" {} +
    
      // Remove unused imports
      find app/src/test -type f -exec gsed -i "/@Config(application = TestApplication::class)/d" {} +
      find app/src/test -type f -exec gsed -i "/import org.mozilla.fenix.TestApplication/d" {} +
      find app/src/test -type f -exec gsed -i "/import org.robolectric.annotation.Config/d" {} +
    ```
    
    Where gsed is the GNU version of sed installed via homebrew. After
    running these commands, I need to manually clean up the following files:
    - FenixRobolectricTestRunner
    - LocaleManagerExtensionTest
    6e0d851d