Giter Club home page Giter Club logo

Comments (12)

JakeWharton avatar JakeWharton commented on July 28, 2024

How would you envision it looking? Wouldn't the code coverage be almost exactly the same for all devices?

from spoon.

djusv avatar djusv commented on July 28, 2024

You're correct if all tests are a successful the coverage will be the same, but I'm interested in what if everything went OK how much did i cover with my tests?

Maybe something like graphs showing off in percentages which methods from which classes have been hit or not?

inspiration

from spoon.

ducrohet avatar ducrohet commented on July 28, 2024

Couldn't code coverage be different if there are tests that are specific to different form factors (phone vs. tablet)?

from spoon.

RichardGuion avatar RichardGuion commented on July 28, 2024

In our case the code coverage would be different for phone vs tablet.

from spoon.

RichardGuion avatar RichardGuion commented on July 28, 2024

Does using the Spoon test runner mean that we cannot use a code coverage tool? From other examples I've seen, it seems if you want to get code coverage from Instrumentation tests running on an Android device, you have to use com.jayway.maven.plugins.android.generation2 to run the tests and the pull the coverage files and generate then report.

from spoon.

JakeWharton avatar JakeWharton commented on July 28, 2024

Spoon doesn't do anything differently than any other instrumentation test runner. We simply end up invoking am instrument on the device through 'ddmlib'.

I'm happy to pull whatever reports are generated into the output folder for later analysis by other tools. That seems very useful at the least.

from spoon.

RichardGuion avatar RichardGuion commented on July 28, 2024

I see what you are saying about invoking that command. My question was more directed to the the Spoon plugin for Maven.

I was able to get code coverage working with android-maven-plugin (see below). I specified arguments for coverage, createReport, and coverageFile -- these all get passed as parameters to am instrument. You would be planning on adding similar paramters to spoon-maven-plugin to accomplish the same thing? Basically turn on coverage through am, tell it where to put the ec file, then pull it off and stick it somewhere on my hard drive when it is done.

                <plugin>
                    <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                    <artifactId>android-maven-plugin</artifactId>
                    <configuration>
                        <test>
                            <!-- Run test with flag "-w coverage true" this is need for generate coverage.ec file, result file-->
                            <coverage>true</coverage>
                            <createReport>true</createReport>
                            <coverageFile>/mnt/sdcard/tmp/com.mycompany/files/coverage.ec</coverageFile>
                        </test>
                    </configuration>
                    <extensions>true</extensions>
                    <!-- need for pull coverage.ec file and move to tested project-->
                    <executions>
                        <execution>
                            <id>pull-coverage</id>
                            <phase>post-integration-test</phase>
                            <goals>
                                <goal>pull</goal>
                            </goals>
                            <configuration>
                                <pullSource>/data/data/com.mycompany/files/coverage.ec</pullSource>
                                <pullDestination>${project.basedir}/target/emma/coverage.ec</pullDestination>
                            </configuration>
                        </execution>
                    </executions>

from spoon.

JakeWharton avatar JakeWharton commented on July 28, 2024

Yeah I think we can definitely support that. Like I said I'm not sure an actual code coverage display itself belongs in the Spoon output but we definitely should be supporting the generation of the files for external tools.

from spoon.

JakeWharton avatar JakeWharton commented on July 28, 2024

I have this working on a branch. The current problem is that the file generated on the device has stupid permissions so you can't just pull it off. There's tricks around this, but I was too lazy to do them now. I'll hopefully circle back in the next week or two and get this finalized.

from spoon.

RichardGuion avatar RichardGuion commented on July 28, 2024

I ran into that problem with emma regarding the permissions on the device and not being able to pull it off the folder with restricted access. I solved it by changing the location where the .ec file is generated:

                    <configuration>
                        <test>
                            <!-- Run test with flag "-w coverage true" this is need for generate coverage.ec file, result file-->
                            <coverage>true</coverage>
                            <createReport>true</createReport>
                            <coverageFile>/mnt/sdcard/tmp/com.mycompany/files/coverage.ec</coverageFile>
                        </test>
                    </configuration>

and then later in the execution, the pull source matches this location to get the ec file, which works because this folder isn't restricted:

                        <execution>
                            <id>pull-coverage</id>
                            <phase>post-integration-test</phase>
                            <goals>
                                <goal>pull</goal>
                            </goals>
                            <configuration>
                                <pullSource>/mnt/sdcard/tmp/com.mycompany/files/coverage.ec</pullSource>
                                <pullDestination>${project.basedir}/target/emma/coverage.ec</pullDestination>
                            </configuration>
                        </execution>

from spoon.

JakeWharton avatar JakeWharton commented on July 28, 2024

Not all of our devices have an SD card and I don't want to require it. It's not that hard to work around, just unfortunate.

from spoon.

JDFind avatar JDFind commented on July 28, 2024

This seems fixed way back in 44c52c9.
Is this issue still necessary?

from spoon.

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.