when i am running my tests, following error is showing
No such manifest file: build\intermediates\bundles\debug\AndroidManifest.xml
java.lang.ClassCastException: android.app.Application cannot be cast to gyg.android.reviews.ReviewApplication
Following are Gradle dependencies
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 am starting 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 will be highly appreciated !
The problem seems to be with an Android Studio project which contains multiple modules. There are two solutions:
Run the Robolectric tests from the command line:
gradlew :app:testDebugUnitTest
Run the Robolectric tests from Android Studio:
Open the Edit Run Configurations dialog. Under Defaults > Android JUnit, set the Working Directory to the folder which contains the module you are testing. You will probably also need to set this option for each existing run configuration. If you have tests in multiple modules, you will need to set the Working Directory for each run configuration to the appropriate module.
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