bgarrels / spock

Automatically exported from code.google.com/p/spock
0 stars 0 forks source link

It would be nice if spock supports Cobertura Code Coverage plugin #119

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Describe the new feature you have in mind.
It would be nice if spock supports Cobertura Code Coverage plugin

Which particular problem would this feature solve for you?
As many of the continuous integration servers (like hudson)and build 
tools (like maven) supports cobertura code coverage. it would be nice 
to have a integrated test report in a nicely presented manner.

Please provide any additional information below. You can also assign
labels.

Original issue reported on code.google.com by Mr.Amut...@gmail.com on 12 Aug 2010 at 1:43

GoogleCodeExporter commented 9 years ago
Spock fully relies on JUnit 4 for test execution and reporting. Hence you 
should get the exact same reports as for JUnit 4 tests written in Groovy. Have 
you been able to generate such reports?

Original comment by pnied...@gmail.com on 12 Aug 2010 at 2:09

GoogleCodeExporter commented 9 years ago
Ok.. that sounds good we can able to produce report with JUnit.  But i have 
already using testNG based test cases in my project havily. so in my maven POM 
i have configured it..is there any way i can run spock with testNG (mean to say 
without relying on Junit)

Original comment by evany...@gmail.com on 14 Aug 2010 at 8:43

GoogleCodeExporter commented 9 years ago
Spock is based on JUnit. We once looked into TestNG as well, but it didn't seem 
to be extensible enough.

Original comment by pnied...@gmail.com on 14 Aug 2010 at 12:58

GoogleCodeExporter commented 9 years ago
since maven does't allow parallel running of test cases written in TestNG and 
JUnit (look here: 
http://stackoverflow.com/questions/1232853/how-to-execute-junit-and-testng-tests
-in-same-project-using-maven-surefire-plugin) what about the integration (in 
maven) of spock with projects which is has been configured with testNG. is it 
the only way is to knock it off testNG and replace Junit for all non spock test 
case, in order to bring spock integration.???

Original comment by evany...@gmail.com on 14 Aug 2010 at 1:17

GoogleCodeExporter commented 9 years ago
Seems it's easily possible to run JUnit and TestNg tests together (scroll down 
to the end of the page): 
http://confluence.highsource.org/display/~lexi/How+to+run+both+JUnit+and+TestNG+
with+maven-surefire-plugin

Original comment by pnied...@gmail.com on 14 Aug 2010 at 1:26

GoogleCodeExporter commented 9 years ago

Original comment by pnied...@gmail.com on 21 Aug 2010 at 3:51

GoogleCodeExporter commented 9 years ago
Are there updates onto using cobertura with spock? Still have no luck with it.

Original comment by radei...@gmail.com on 18 Nov 2010 at 10:41

GoogleCodeExporter commented 9 years ago
Can you be more specific about your problems? Can you provide a self-contained 
build where Cobertura works with JUnit but not with Spock?

Original comment by pnied...@gmail.com on 18 Nov 2010 at 1:36

GoogleCodeExporter commented 9 years ago
I've just created a Maven project based on spock-example and configured it to 
use Cobertura. Works just fine with Spock, no matter if production code is 
written in Java or Groovy. Also works fine with Spock's Maven plugin (but 
doesn't require it of course). I've attached the project - unzip, run "mvn 
site", and open target/site/cobertura/index.hml.

Original comment by pnied...@gmail.com on 18 Nov 2010 at 8:51

Attachments:

GoogleCodeExporter commented 9 years ago
I managed to get it work using the following surefire-plugin configuration :

<plugin>
                <!-- Spock framework uses JUnit, so we must run both TestNG and JUnit tests -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.7.1</version>
                <executions>
                    <execution>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <testNGArtifactName>none:none</testNGArtifactName>
                        </configuration>
                    </execution>
                    <execution>
                        <id>test-testng</id>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <junitArtifactName>none:none</junitArtifactName>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

see http://www.jroller.com/melix/entry/getting_testng_spock_and_cobertura

Cheers,

Original comment by cedric.c...@gmail.com on 28 Dec 2010 at 12:29