groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alberto <alberto....@gmail.com>
Subject Re: Can't run JUnit tests with gmaven-plus and Groovy
Date Mon, 21 Dec 2020 11:43:05 GMT
I managed to figure it out!
The problem was twofold, first "def" doesn't seem to work. I needed "void".
Also, the version of the surefire plugin had to be updated to 3.0.0-M5.

After these changes, the tests are executed properly.

:-)

Cheers,
Alberto

Il giorno lun 21 dic 2020 alle ore 12:00 Alberto <alberto.ing@gmail.com> ha
scritto:

> Hi all,
>
> I'm setting up a Groovy project with JUnit tests, and when building with
> Maven I see the test class being found, but 0 tests reported.
>
> I tried several things, including creating a mirror project in Java to try
> to figure out the error. In Java the test case is run.
>
> In the pom file I'm using the goals addSources, addTestSources, compile,
> compileTests.
> The test file is very simple right now:
> ----
> package alin.tests;
>
> import org.junit.jupiter.api.Test;
> import static org.junit.jupiter.api.Assertions.assertEquals;
>
> class MainTest
> {
>
>     @Test
>     def onePlusOne() {
>         assertEquals(1 + 1, 3);
>     }
>
> }
> ----
>
> When building I see:
> [INFO] Running alin.tests.MainTest
> [INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:
> 0.38 s - in alin.tests.MainTest
> [INFO]
> [INFO] Results:
> [INFO]
> [INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
>
> I put the full code in https://github.com/AlbertSSj/maven-tests. I'm out
> of ideas.
>
> Thank you in advance,
> Alberto
>
> --
> Alberto Ingenito
>


-- 
Alberto Ingenito

Mime
View raw message