Android Unit Testing Robolectric: 3.3.2 - There is no such manifest file: build \ intermediates \ manifestests \ full \ debug \ src \ main \ AndroidManifest.xml

when i run my tests the following error shows

No such manifest file: build\intermediates\bundles\debug\AndroidManifest.xml

java.lang.ClassCastException: android.app.Application cannot be cast to gyg.android.reviews.ReviewApplication

Below are the dependencies of Gradle

compile group: 'org.mockito', name: 'mockito-all', version: '2.0.2-beta'
testCompile "org.robolectric:robolectric:3.3.2"
testCompile 'org.mockito:mockito-core:1.10.19'
testCompile 'junit:junit:4.12'

This is how I start my test class.

@RunWith(RobolectricTestRunner.class)
@Config(constants = BuildConfig.class)
public class ReviewListPresenterTest {

I am using Roboelectric 3.3.2 with Android Studio 2.3.2. Quick help would be much appreciated!

+6
source share
1 answer

The problem seems to be related to the Android Studio project, which contains several modules. There are two solutions:

  • Run Robolectric tests from the command line:

    gradlew :app:testDebugUnitTest
    
  • Run Robolectric tests from Android Studio:

    " ". " " > "Android JUnit" , , . , , . , .

+5

Source: https://habr.com/ru/post/1017255/


All Articles