robospock / RoboSpock

A testing framework which brings powers of Spock and Groovy to Android app testing
http://robospock.org
MIT License
249 stars 44 forks source link

Support (or document) Maven-based Android applications #11

Closed clemp6r closed 9 years ago

clemp6r commented 10 years ago

You made sample applications for Ant and Gradle based applications. Please support (or document) usage of RoboSpock with Maven-based Android apps.

wojtekerbetowski commented 10 years ago

That's gonna be hard, as none of us is a fan of Maven. Maybe you could help us with that?

clemp6r commented 10 years ago

Sorry, I can't. I thought it would be nice - I don't absolutely need it. FYI I use Maven on my project not because I'm a fan (and I'm not), but because the Android Gradle plugin has still some limitations.

Opalo commented 10 years ago

What limitations do You mean exactly?

2014-02-04 Clément Plantier notifications@github.com:

Sorry, I can't. I thought it would be nice - I don't absolutely need it. FYI I use Maven on my project not because I'm a fan (and I'm not), but because the Android Gradle plugin has still some limitations.

Reply to this email directly or view it on GitHubhttps://github.com/Polidea/RoboSpock/issues/11#issuecomment-34059838 .

Pozdrawiam, Maciek Opa³a

clemp6r commented 10 years ago

At the time I tried using Gradle, I was not able to get coverage report with Gradle+Robolectric.

pjakubczyk commented 10 years ago

I have just found this gralde plugin: http://www.gradle.org/docs/current/userguide/jacoco_plugin.html

I would need to dig in and check if combos with gradle + robospock.

On Tue, Feb 4, 2014 at 2:51 PM, Clément Plantier notifications@github.comwrote:

At the time I tried using Gradle, I was not able to get coverage report with Gradle+Robolectric.

Reply to this email directly or view it on GitHubhttps://github.com/Polidea/RoboSpock/issues/11#issuecomment-34060522 .

clemp6r commented 10 years ago

The problem with this plugin is that it depends on the "java" gradle plugin. With Android we don't use it but a specific "android" plugin.

pjakubczyk commented 10 years ago

There a trick to have another gradle buildscript for separate java-based tasks.

Try to make next to your build.gradle another file ex. 'coverage.gradle' and there place apply: java, point src dirs etc. Then just run gradle -b coverage.gradle. I can post you more accurate example showing how to integrate checkstyle in Android project.

On Tue, Feb 4, 2014 at 3:00 PM, Clément Plantier notifications@github.comwrote:

The problem with this plugin is that it depends on the "java" gradle plugin. With Android we don't use it but a specific "android" plugin.

2014-02-04 Przemys³aw Jakubczyk notifications@github.com:

I have just found this gralde plugin: http://www.gradle.org/docs/current/userguide/jacoco_plugin.html

I would need to dig in and check if combos with gradle + robospock.

On Tue, Feb 4, 2014 at 2:51 PM, Clément Plantier notifications@github.comwrote:

At the time I tried using Gradle, I was not able to get coverage report with Gradle+Robolectric.

Reply to this email directly or view it on GitHub< https://github.com/Polidea/RoboSpock/issues/11#issuecomment-34060522> .

Reply to this email directly or view it on GitHub< https://github.com/Polidea/RoboSpock/issues/11#issuecomment-34060917> .

Reply to this email directly or view it on GitHubhttps://github.com/Polidea/RoboSpock/issues/11#issuecomment-34061223 .

clemp6r commented 10 years ago

Thanks for the help. I'll try again soon and post a working sample if I succeed. Please try to do the same if you have some time. In fact I don't need checkstyle-specific integration, but a full SonarQube analysis using the sonar-runner plugin, with code coverage for robolectric tests.

pjakubczyk commented 10 years ago

Hi again,

check this snippet

repositories { mavenCentral() }

apply plugin: 'checkstyle' apply plugin: 'pmd' apply plugin: 'java'

pmd { sourceSets { main.java.srcDirs = ['src/main/java/'] }

ruleSetFiles = files("config/pmd/pmd-rules.xml")

ignoreFailures true

}

checkstyle { sourceSets { main.java.srcDirs = ['src/main/java'] }

ignoreFailures true
showViolations false

}

gradle.projectsEvaluated { compileJava.enabled false }

place this into analysis.gradle file and then run with ./gradlew -b analysis.gradle check

since it works for checkstyle and pmd there huge possibility that your tool too :)

On Tue, Feb 4, 2014 at 3:09 PM, Clément Plantier notifications@github.comwrote:

Thanks for the help. I'll try again soon and post a working sample if I succeed. Please try to do the same if you have some time. In fact I don't need checkstyle-specific integration, but a full SonarQube analysis using the sonar-runner plugin, with code coverage for robolectric tests.

Reply to this email directly or view it on GitHubhttps://github.com/Polidea/RoboSpock/issues/11#issuecomment-34061977 .

clemp6r commented 10 years ago

So, no Maven support is planned?

wojtekerbetowski commented 10 years ago

Not at the moment, but if you need it - maybe you could contribute?

pjakubczyk commented 9 years ago

Sorry I don't plan to support Maven projects. Google moved to gradle so I suggest to do the same.