GithubHelp home page GithubHelp logo

Comments (13)

linfan avatar linfan commented on May 2, 2024

Thanks for raise the issue, I‘ll have a try and check it.

Actually we have a much larger test case pool including all demo cases and issue related cases, which run with JUnit 4 and maven. Sorry cannot open source it because it also contains several internal issue cases with biz related code. Combine JUnit 4 with Gradle has never been tried before, but should have not reason to fail.

from testable-mock.

gospeljohn avatar gospeljohn commented on May 2, 2024

Compate with junit very important after all there are lot of users of junit.

Thanks.

from testable-mock.

linfan avatar linfan commented on May 2, 2024

checkout branch junit4 and try : )
it works as expected (with Gradle 6.7).

from testable-mock.

gospeljohn avatar gospeljohn commented on May 2, 2024

cool, so cute.
But can you explain the function of below:
test {
jvmArgs "-javaagent:${classpath.find { it.name.contains("testable-agent") }.absolutePath}"
useJUnit()
}

How I deploy the testable-mock with Robolectric to test Android project?

Thanks.

from testable-mock.

linfan avatar linfan commented on May 2, 2024

can you explain the function of below
the first line jvmArgs ... will found the full path of testable-agent.jar file from jvm classpath, and set a -javaagent parameter it to jvmArgs property correcting to the jar file found, and this agent jar do all the mock magics. look up -javaagent parameter of jvm for more details.
second line useJUnit() is a standard configuration for Junit 4.

How I deploy the testable-mock with Robolectric to test Android project?
that's a good question, TestableMock and Robolectric are technically match, however I don't have a simple enough demo at my hand. maybe could you found an android demo with recent Robolectric release? I'll show how to fit it.

from testable-mock.

gospeljohn avatar gospeljohn commented on May 2, 2024

Sure, check the attachment which is I write a sample demo using Robolectric, you can try.
Good luck.

from testable-mock.

linfan avatar linfan commented on May 2, 2024

hey... I did not see the attachment

from testable-mock.

gospeljohn avatar gospeljohn commented on May 2, 2024

Sorry, please check the attachment.
testablemock.zip

from testable-mock.

linfan avatar linfan commented on May 2, 2024

Emm, looks like google repository get blocked from my home network, some android dependence not downloadable, and I'm having 2 days off tomorrow and the day after tomorrow.
Will try to get it done next Monday when back to office, sorry man.

from testable-mock.

gospeljohn avatar gospeljohn commented on May 2, 2024

Hello, did you have time to try the attchment demo?

from testable-mock.

linfan avatar linfan commented on May 2, 2024

Sure : )
Checkout the attached zip.

The key point is below configuration inside the app/build.gradle file.

android {
    testOptions {
        unitTests {
            all {
                jvmArgs "-javaagent:${classpath.find { it.name.contains("testable-agent") }.absolutePath}"
            }
        }
    }
}

testablemock-robolectric.zip

from testable-mock.

gospeljohn avatar gospeljohn commented on May 2, 2024

Cool, Thank you very much.

from testable-mock.

linfan avatar linfan commented on May 2, 2024

Happy to help, also thx for your Robolectric demo 😀.

from testable-mock.

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.