GithubHelp home page GithubHelp logo

android-test-demo's People

Contributors

aumarbello avatar chiuki avatar codeteo avatar vogella avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-test-demo's Issues

Dagger does not generate class for TestComponent

I'm trying to run your project in Android studio bug I'm finding a problem. Dagger does not seem to generate the Dagger class for the TestComponent defined in ActivityLauncher. I found the same issue in my own code and I'd like to know if there is anything else I'm supposed to do. ActivityLauncher line 34 shows an error where DaggerActivityLauncher_TestComponent is not found.

DemoApplication app
        = (DemoApplication) fetchInstrumentation().getTargetContext().getApplicationContext();
    TestComponent component = DaggerActivityLauncher_TestComponent.builder()
        .mockClockModule(new MockClockModule())
        .build();
    app.setComponent(component);

Thanks!

Custom AndroidJUnitRunner is not being called when tests are executed via Android Studio

First of all, thank you very much for the wonderful repo. This really helped me write Espresso for our existing app

My issue is around running the test - executing via the gradle wrapper runs the test correctly - but running it via studio executes the ff.

adb shell am instrument -w -r -e debug false -e class nz.co.blah.ui.MainActivityTest nz.co.blah.test/android.support.test.runner.AndroidJUnitRunner

Which is wrong because it should be executing my custom AndroidJUnitRunner. Do you happen to know how to edit this? I've made the instrumentation test gradle aware but it doesn't seem to call the appropriate runner.

Syntax error after import

If I import your project into Android Studio DaggerMainActivityTest_TestComponent cannot be resolved.

TestComponent component = DaggerMainActivityTest_TestComponent.builder()
.mockClockModule(new MockClockModule())
.build();

Is it okay to expose the components?

The DemoApplication exposes a setComponent method to the outside world. I understand you need to do that in order to make your tests set the test component to provide mocks, but anyone can call that method and break your app.

I think that DemoApplication and MainActivity should get their components somehow by not exposing their internals to the outside world, as that would violate the hiding principle.

Or am I missing something else?

Anyway, thanks for your demo! :)

Component duplication per test

Not sure this is really an issue, but I found it to be interesting.

It seems that when executing the tests, DemoApplication's onCreate() method is called before setComponent(), so both the normal component and the test components are initialised before every test. (The if component == null check in onCreate() will always be true).

Is this a problem? Or we don't really care, just so long as it's called before an Activity's onCreate()?

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.