Code Monkey home page Code Monkey logo

Comments (5)

senkir avatar senkir commented on July 3, 2024

https://github.com/robolectric/robolectric-gradle-plugin is probably the preferred solution at this point, as it's being updated by the robolectric team.

from android-gradle-template.

nenick avatar nenick commented on July 3, 2024

it should be the best solution. it will never be a solution for me until we have a workaround following issues.

  1. with that plugin we have some issues when we combined robolectric and espresso which is tracked here robolectric/robolectric-gradle-plugin#17
  2. it is hard to get robolectric tests running inside android studio, documented at https://github.com/robolectric/deckard-gradle

from android-gradle-template.

jamesgoodwin avatar jamesgoodwin commented on July 3, 2024

My problem with robolectric-gradle-plugin is that it uses androidTest sourceset, preventing a clean separation between unit and functional tests (e.g. Espresso). This is a complete deal-breaker for me as functional tests can be very useful for testing parts of the app that would be overly complex using Robolectric.

My preferred way of using Robolectric is having unit-tests in a separate gradle module using the standard java plugin (allowing functional tests and unit tests to work).

from android-gradle-template.

nenick avatar nenick commented on July 3, 2024

Looks like we need no plugins anymore. With the new experimental unit test feature we can easy use robolectric. See the example https://github.com/nenick/AndroidStudioAndRobolectric or read a step by step guide http://nenick-android.blogspot.de/2015/02/android-studio-110-beta-4-and.html

from android-gradle-template.

nenick avatar nenick commented on July 3, 2024

It is possible to use robolectric without extra plugins but having the possibility to use separated test modules is still essential for me. Another advantage I have all sources anytime in Android Studio instead of switching between unit and android tests.

jcandksolution robolectric plugin is now deprecated and replaced by native unit test support.

So I switched this template back to his original root.

from android-gradle-template.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.