You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by sebb <se...@gmail.com> on 2019/11/02 10:11:00 UTC

How to run a single test in gradle?

It's not clear how to run a single test in gradle.

That was easy in Ant:

junit                  Run individual JUnit test
(-Dtest.case=org.apache.jorphan.test.AllTests) (-Dtest.format=plain)
(-Dtest.showoutput=true)

It's also easy in Maven:

maven test -Dtest=AllTests

According to online docs I should be able to run:

gradlew test --tests DnsManagerTest

but that does not work.

Re: How to run a single test in gradle?

Posted by Vladimir Sitnikov <si...@gmail.com>.
>ant batchtest -Dbatchtest.name=Bug60607 -Dbatchtest.jmx=Bug60607.jmx

Ok. I stand corrected.

Vladimir

Re: How to run a single test in gradle?

Posted by sebb <se...@gmail.com>.
On Sat, 2 Nov 2019 at 14:11, Vladimir Sitnikov
<si...@gmail.com> wrote:
>
> >The point is that this used to be easy with Ant,
>
> What is the point of discussing "this used to be easy with Ant"?
>
> I would kindly remind you that DnsManagerTest used to be a part of
> "batch_scripts" (it was Bug60607.jmx),

For this particular test, that may be so, but that does not affect the issue.

> and individual batch-test execution was NEVER possible with Ant.

Yes, it was possible:

ant batchtest -Dbatchtest.name=Bug60607 -Dbatchtest.jmx=Bug60607.jmx

> Now Gradle enables individual test execution for both class-based and
> batch-based tests.
>
> >It should be easy...
>
> Please feel free to figure out your way.
> The documentation is there. Gradle is here.

Well I must be stupid then, because I cannot find how to do it.

Maybe someone else on the JMeter team can point the way?


> Vladimir

Re: How to run a single test in gradle?

Posted by Vladimir Sitnikov <si...@gmail.com>.
>The point is that this used to be easy with Ant,

What is the point of discussing "this used to be easy with Ant"?

I would kindly remind you that DnsManagerTest used to be a part of
"batch_scripts" (it was Bug60607.jmx),
and individual batch-test execution was NEVER possible with Ant.
Now Gradle enables individual test execution for both class-based and
batch-based tests.

>It should be easy...

Please feel free to figure out your way.
The documentation is there. Gradle is here.

Vladimir

Re: How to run a single test in gradle?

Posted by sebb <se...@gmail.com>.
On Sat, 2 Nov 2019 at 11:02, Vladimir Sitnikov
<si...@gmail.com> wrote:
>
> >Google search.
>
> Which specific page do you look into?

Just found:
https://docs.gradle.org/current/userguide/java_testing.html#test_filtering

> Frankly speaking, your question is a good one for stackoverflow.com, and
> there's nothing JMeter-specific in it

The point is that this used to be easy with Ant, and was documented in
the build.xml file.

So why is it so difficult in Gradle?

I have tried:

gradle test --tests 'org.apache.jmeter.protocol.http.control.DnsManagerTest'
and
gradle test --tests '*DnsManagerTest'

Both fail with a series of errors:

--- cut here ---
FAILURE: Build failed with an exception.

* Where:
Settings file '/Users/sebb/git/jmeter/buildSrc/settings.gradle.kts' line: 20

* What went wrong:
Script compilation errors:

  Line 20:     plugins {
               ^ Unresolved reference. None of the following
candidates is applicable because of receiver type mismatch:
                   public inline operator fun <T : Any, C :
NamedDomainObjectContainer<TypeVariable(T)>>
TypeVariable(C).invoke(configuration:
NamedDomainObjectContainerScope<TypeVariable(T)>.() -> Unit):
TypeVariable(C) defined in org.gradle.kotlin.dsl
--- cut here ---

So I tried ./gradlew:

./gradlew test --tests 'org.apache.jmeter.protocol.http.control.DnsManagerTest'

and I get a different error:

--- cut here ---
> Configure project :
Building JMeter 5.2-SNAPSHOT

> Task :src:jorphan:test FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':src:jorphan:test'.
> No tests found for given includes: [org.apache.jmeter.protocol.http.control.DnsManagerTest](--tests filter)
--- cut here ---

So how can one use Gradle command-line to run a single test?
It should be easy...

Sebb.

Re: How to run a single test in gradle?

Posted by Vladimir Sitnikov <si...@gmail.com>.
>Google search.

Which specific page do you look into?
Frankly speaking, your question is a good one for stackoverflow.com, and
there's nothing JMeter-specific in it

Vladimir

Re: How to run a single test in gradle?

Posted by sebb <se...@gmail.com>.
On Sat, 2 Nov 2019 at 10:37, Vladimir Sitnikov
<si...@gmail.com> wrote:
>
> >According to online docs I should be able to run:
> >gradlew test --tests DnsManagerTest
>
> What is the documentation you are looking into?

Google search.

But if that is not correct, what is the correct answer?

> Vladimir

Re: How to run a single test in gradle?

Posted by Vladimir Sitnikov <si...@gmail.com>.
>According to online docs I should be able to run:
>gradlew test --tests DnsManagerTest

What is the documentation you are looking into?

Vladimir