On Sat, Mar 19, 2022 at 5:06 PM Tibor Digana <tibordig...@apache.org> wrote:

> My advice is not to listen to everyone but rather understand how things
> work.
> Open this link in your browser
> https://repo1.maven.org/maven2/org/junit/platform/
> It is groupId of some JUnit5 artifacts.
> Do you see junit-platform-suite-api?
> Scroll up and you will see junit-platform-suite. What's that? It's the impl
> of the api.
> So, now you know what you miss in the dependencies.
>
> This way just discover the entire hierarchy in
> https://repo1.maven.org/maven2/org/junit/ and the POMs and their
> dependencies and transitive dependencies.
> Then you would understand most of the typical troubles.
> No magic, the trick is to read the content of the repo and the content of
> POMs.
>
> I always have to do this when I am helping the users. All the time.
> The job starts with this if it is a simple problem. Always the same, all
> the time.
>

Ok, I appreciate that. However, perhaps I didn't emphasize the correct
thing in my last response. Fixing the compile error was simple to do.  The
last problem I have is the problem with running a component test suite from
the command line. This is actually the first problem I was made aware of
when I first started examining this entire functional area.


> T
>
>
>
>
> On Sat, Mar 19, 2022 at 10:57 PM KARR, DAVID <dk0...@att.com> wrote:
>
> > This is progress.  I at least now see both Junit 5 and Junit 4 tests
> > running successfully.
> >
> > I have a couple of related questions, one of which is likely entirely
> > Junit-related, but which you might have run into, and the other is more
> on
> > Surefire.
> >
> > We also have some test suites, which is where we base our "component" and
> > "integration" tests, neither of which run as unit tests.  I'm focusing in
> > the component tests first, but I think whatever we do to fix the
> component
> > tests will be the same for the integration tests.
> >
> > With the dependencies you specified, that results in compile errors for
> > missing classes in "org.junit.platform.suite.api.*".  That is in the
> > "junit-platform-suite-api" dependency.  It's simple enough to include
> that
> > dependency, and that resolves that compile error.  I assume that's the
> best
> > resolution for that?
> >
> > Finally, the issue that is actually one of the first trouble spots we
> > noticed, which is being able to execute test suites from the mvn command
> > line.
> >
> > With Junit4, we would execute our component tests with just this:
> >
> >     mvn -Dtest=ComponentTestSuite test
> >
> > With these new frameworks, this fails with "No tests were executed". I've
> > tried numerous variations of this.
> >
> > The minimal class I have is this:
> >
> >         import org.junit.platform.suite.api.SelectClasses;
> >         import org.junit.platform.suite.api.Suite;
> >
> >         @Suite
> >         @SelectClasses(NoteResourceCT.class)
> >         public class ComponentTestSuite {
> >         }
> >
> > I have heard some mentions of "Tags" in Junit5 and "groups" in Surefire.
> > I have experimented with those, but I still haven't gotten anything to
> work.
> >
> > > -----Original Message-----
> > > From: Tibor Digana <tibordig...@apache.org>
> > > Sent: Saturday, March 19, 2022 1:55 PM
> > > To: Maven Users List <users@maven.apache.org>
> > > Subject: Re: Can't get Surefire to run any JUnit 5 tests
> > >
> > > No problem, pls see the project again, there is an update.
> > > T
> > >
> > > On Sat, Mar 19, 2022 at 9:32 PM KARR, DAVID <dk0...@att.com> wrote:
> > >
> > > > One thing that I see I neglected to mention in this post, but which I
> > > > did mention in the SO posting I linked to, is that I have both Junit5
> > > > and
> > > > Junit4 tests in scope.  I believe that is at least one element that
> > > > makes this more complicated.
> > > >
> > > > > -----Original Message-----
> > > > > From: Tibor Digana <tibordig...@apache.org>
> > > > > Sent: Saturday, March 19, 2022 1:27 PM
> > > > > To: Maven Users List <users@maven.apache.org>
> > > > > Subject: Re: Can't get Surefire to run any JUnit 5 tests
> > > > >
> > > > > I have created a project which proves that it works with Surefire
> > > > > 3.0.0- M5, JUnit Jupiter 5.8.2 and Mockito Extension. Please do not
> > > > > use JUnit4 and Vintage in this case. It is not necessary to use a
> > > > > dependency inside of the plugin. Use a dependency in the project
> > > POM. Follow it on Github:
> > > > >
> https://urldefense.com/v3/__https://github.com/Tibor17/junit5-mockit
> > > > > o-
> > > > >
> examples__;!!BhdT!lvmbYgzuQOyWUX5ZylkdmfaU3sXf2apqjJSFSSrxKI8axKgcOo
> > > > > SucV
> > > > > scEb7A3q4WNmPmuxJZAl1LWz6LutPn$
> > > > >
> > > > > [INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @
> > > > > why-is- surefire-not-executing-my-junit5-tests --- [INFO] [INFO]
> > > > > ---------------
> > > > > ----------------------------------------
> > > > > [INFO]  T E S T S
> > > > > [INFO] -------------------------------------------------------
> > > > > [INFO] Running pkg.BDSHelperTest
> > > > > [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time
> > > elapsed:
> > > > > 0.396 s - in pkg.BDSHelperTest
> > > > > [INFO]
> > > > > [INFO] Results:
> > > > > [INFO]
> > > > > [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [INFO]
> > > > > [INFO]
> > > > >
> --------------------------------------------------------------------
> > > > > ----
> > > > > [INFO] BUILD SUCCESS
> > > > > [INFO]
> > > > >
> --------------------------------------------------------------------
> > > > > ----
> > > > > [INFO] Total time:  6.417 s
> > > > > [INFO] Finished at: 2022-03-19T21:15:10+01:00 [INFO]
> > > > >
> --------------------------------------------------------------------
> > > > > ----
> > > > >
> > > > >
> > > > > The XML test report:
> > > > > <testcase name="test" classname="pkg.BDSHelperTest" time="0.454"/>
> > > > >
> > > > >
> > > > > Cheers
> > > > > Tibor
> > > > >
> > > > >
> > > > > On Sat, Mar 19, 2022 at 6:53 AM David Karr
> > > > > <davidmichaelk...@gmail.com>
> > > > > wrote:
> > > > >
> > > > > > I, along with two other people on my team, have spent days and
> > > > > > days now trying to figure out why we cannot get Surefire to
> > > > > > execute JUnit 5
> > > > > tests.
> > > > > > We've all been working independently, so we don't all take the
> > > > > > same path, but it didn't really matter, as all three of us are
> > > > > > pretty much stuck at the same point.  We can execute JUnit 5
> tests
> > > > > > in Eclipse, but Surefire just refuses to have anything to do with
> > > JUnit 5 tests.
> > > > > > We've all read numerous threads and posts on how to do it, and it
> > > > > > just
> > > > > does not work.
> > > > > >
> > > > > > Most recently, I posted this question with some details of what I
> > > > > > had done so far:
> > > > > >
> > > > > >
> https://urldefense.com/v3/__https://stackoverflow.com/questions/71
> > > > > > 5310
> > > > > >
> 01/why-is-surefire-not-executing-my-junit5-tests__;!!BhdT!lvmbYgzu
> > > > > > QOyW
> > > > > >
> UX5ZylkdmfaU3sXf2apqjJSFSSrxKI8axKgcOoSucVscEb7A3q4WNmPmuxJZAl1LW5
> > > > > > tYnJ
> > > > > > oJ$
> > > > > > .
> > > > > >
> > > > > > I have no idea whether the problems lie in JUnit 5, or in
> > > > > > Surefire, or some combination.  I wish I could get some debug
> > > > > > output that told me
> > > > > SOMETHING.
> > > > > > It just does not run JUnit 5 tests.
> > > > > >
> > > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> > For additional commands, e-mail: users-h...@maven.apache.org
> >
>

Reply via email to