i have 2 library projects,1 main project which is using both the library projects, and a test project. I am using maven to build my app.it is working fine.I have added the modules like
<modules>
<module>lib1</module>
<module>lib2</module>
<module>main app</module>
<module>AutomatedUnitTestFrameWork</module>
</modules>
i am using robotium for testing my app.When i run mvn install command it is showing the status as success.But testcases are not running and i am not getting any test result.Do i need to add junit depedency also or surefire plugin?please guide me..
Yes you need to add surefire plugin to detect the test cases in your java file. So you need to add its dependency.
Related
gradle-ndk-gtest-sample
Android NDK with
README.NDK
I have been trying to configure my Android NDK project for use with Google Test. I started with native-activity sample as the base project and began following the guides above. I inserted the code from the first link into my root build.gradle. I am really not having any success. It looks like i was able to generate the test library:
./libs/googleTest/1.7.0/lib/osx/libgtest.a
./libs/googleTest/1.7.0/lib/linux/libgtest.a
./app/.externalNativeBuild/cmake/debug/x86_64/libnative_app_glue.a
./app/.externalNativeBuild/cmake/debug/x86_64/libFOO.a
./app/.externalNativeBuild/cmake/debug/x86_64/libgtest.a
./app/.externalNativeBuild/cmake/debug/arm64-v8a/libnative_app_glue.a
./app/.externalNativeBuild/cmake/debug/arm64-v8a/libFOO.a
./app/.externalNativeBuild/cmake/debug/arm64-v8a/libgtest.a
But I don't know where to go from here. How do I actually run the tests and see if they passed?
Try something like https://github.com/DanAlbert/GTestJNI. It's an alternative test runner for JUnit and GTest that exposes GTests as if they were JUnit, so you can just run your normal androidTests and they'll run your GTests for you.
Some day I want to get this either added to the NDK or at least made trivial to add to a project as a git submodule or something, but for now you can merge the pieces of that into your project.
I have been working on a module, whenever it is build using "gradlew assemble"it will generate an aar file in build/output folder. I have created few tests extending the InstrumentationTestCase in android app module, I want to run those tests whenever I build the library using gradle command.If compilation of tests "pass" the build(aar) should happen else it should fail. Could any one please help me on this?
Running gradlew clean connectedCheck should run through all of your tests on all connected devices and will also build out your aar file. That's the easiest way.
Currently I am working on creating test cases for my Android project which used Another Android project as Android Library project. In my Android project I didn't do any business logic I have done all logics in my Android Library project,So I just extends my activity into Android library Project Activity. I have written separate Test classes for each Activity in Android Library.If I run each test class It will pass in test.How can I test the whole Android Library Project? and also Android application project?. If I accessed any Android Library project's test class(AndroidLibraryProject/src/androidTest/java/packageName/testCase.java) in my Android Application Project it showed does not exist error message while run the class.How can I test whole project both Android application project and Library project
When you run unit-test on project (module ":app") which use another projects as library, it automatically run test on module project/library project.
So write tests for both, try letting tests for library projects at
AndroidApplicationProject/src/androidTest/java/packageName/
(not AndroidLibraryProject/src/androidTest/java/packageName/)
I want to make in Android Studio my test module to be dependent of application module, but can not achieve this, have mistake
Error:Dependency AndroidApp:app:unspecified on project TestsRobotium resolves to an APK archive which is not supported as a compilation dependency. File: D:\android\MEWE\AndroidApp\app\build\apk\MeWe.apk
In my test.gradle I added provided project(':app') in dependency tag (it is done by Android studio automatically)
How would I resolve this? I need dependency on src, res folders of my main app and need to know R file
This is now possible using com.android.test plugin. Works fine for Java and resources stuff.
An example by Google can be found here.
Basically you create a separate module for testing and define which module and flavor should be tested. I've just checked it and it has some issues with working with the IDE, but runs fine with gradle command line.
I do not understand. How can I add and use Espresso in my project?
Espresso url: https://code.google.com/p/android-test-kit/
How to connect this library to my project? I would like to have an example in Eclipse.
To use Espresso for Android you have to create test project which will test your main application under test. This link contains Espresso setup instruction for Eclipse and Android Studio. And also some basic steps you have to do (with test project but not with the main app) before running your tests: adding GoogleInstrumentationTestRunner into AndroidManifest.xml file and changing Run Configurations. After you finish - take a look on examples from here.
I found Espresso jar file https://code.google.com/p/android-test-kit/source/browse/#git%2Fbin%2Fespresso-dependencies . I added jar file to my project and it's very easily =).