STS 2.6 - running unit tests in a Grails project

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

STS 2.6 - running unit tests in a Grails project

Roshan Dawrani
Hi,

I wanted to report a minor thing that could be seen as a bug.

I have unit tests a.b.FooTests and a.b.FooSpec in my Grails project and I right click on FooTests.groovy and run test-app command and STS comes up with "test-app -unit a.b.Foo" as the command, which ends up executing tests of both a.b.FooTests and a.b.FooSpec, which is not what I intended.

Does it have to truncate "Tests" from the end and form the command to run?

--
Roshan
Blog: http://roshandawrani.wordpress.com/
Twitter: @roshandawrani
Skype: roshandawrani

Reply | Threaded
Open this post in threaded view
|

Re: STS 2.6 - running unit tests in a Grails project

Kris De Volder
Hi Roshwan,

This is really an STS related question. Luckily my coleagues spotted
it here and pointed me to it :-)
In the future please ask questions about STS functionality in the STS forum.

Anyway... on to your question.

That's actually an interesting question. I think I implemented it this
way for a good reason. I think I tried it without stripping the "Test"
from the end and it didn't work.

Now... I just tried this again and it does work. My only explanation
is that perhaps the behavior for "test-app" has changed a little since
I tested it (with an earlier version of Grails at the time).

It seems that in Grails 1.3.6 having "Tests" at the end is ok.

But when I do the same command in Grails 1.2.1 then it seems to run
the tests, but looking at the test report... "0" tests got executed by
the command. So it actually did not really work.

So... somewhere between Grails 1.3.6 and Grails 1.2.1 the behavior has
changed a bit.

I'm a bit ambivalent about what to do now. On the one hand I agree
that it is more logical with more recent version of Grails behavior to
not strip of the "Tests" bit, but then it wouldn't work for users
using older versions of Grails.

It seems to me, that it isn't so bad that, for you, it ran some extra
tests (it did still run the tests you wanted), compared to not running
any tests at all for users with older version of Grails.

Kris

On Tue, Apr 26, 2011 at 7:23 AM, Roshan Dawrani <[hidden email]> wrote:

> Hi,
> I wanted to report a minor thing that could be seen as a bug.
> I have unit tests a.b.FooTests and a.b.FooSpec in my Grails project and I
> right click on FooTests.groovy and run test-app command and STS comes up
> with "test-app -unit a.b.Foo" as the command, which ends up executing tests
> of both a.b.FooTests and a.b.FooSpec, which is not what I intended.
> Does it have to truncate "Tests" from the end and form the command to run?
> --
> Roshan
> Blog: http://roshandawrani.wordpress.com/
> Twitter: @roshandawrani
> Skype: roshandawrani
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: STS 2.6 - running unit tests in a Grails project

Roshan Dawrani
Hi Krwis,

Thanks for responding.

I guess, if you must choose between running no tests for older Grails versions and running extra tests for newer versions, then extra tests is the lesser evil of the two.

In my case I would have liked to avoid it though, because compared to unit tests, integration / functional tests have much longer execution times for us, so we'd rather avoid the extra ones.

We can always run such tests from the command line though.

Cheers.

On Tue, Apr 26, 2011 at 10:51 PM, Kris De Volder <[hidden email]> wrote:
Hi Roshwan,

This is really an STS related question. Luckily my coleagues spotted
it here and pointed me to it :-)
In the future please ask questions about STS functionality in the STS forum.

Anyway... on to your question.

That's actually an interesting question. I think I implemented it this
way for a good reason. I think I tried it without stripping the "Test"
from the end and it didn't work.

Now... I just tried this again and it does work. My only explanation
is that perhaps the behavior for "test-app" has changed a little since
I tested it (with an earlier version of Grails at the time).

It seems that in Grails 1.3.6 having "Tests" at the end is ok.

But when I do the same command in Grails 1.2.1 then it seems to run
the tests, but looking at the test report... "0" tests got executed by
the command. So it actually did not really work.

So... somewhere between Grails 1.3.6 and Grails 1.2.1 the behavior has
changed a bit.

I'm a bit ambivalent about what to do now. On the one hand I agree
that it is more logical with more recent version of Grails behavior to
not strip of the "Tests" bit, but then it wouldn't work for users
using older versions of Grails.

It seems to me, that it isn't so bad that, for you, it ran some extra
tests (it did still run the tests you wanted), compared to not running
any tests at all for users with older version of Grails.

Kris

On Tue, Apr 26, 2011 at 7:23 AM, Roshan Dawrani <[hidden email]> wrote:
> Hi,
> I wanted to report a minor thing that could be seen as a bug.
> I have unit tests a.b.FooTests and a.b.FooSpec in my Grails project and I
> right click on FooTests.groovy and run test-app command and STS comes up
> with "test-app -unit a.b.Foo" as the command, which ends up executing tests
> of both a.b.FooTests and a.b.FooSpec, which is not what I intended.
> Does it have to truncate "Tests" from the end and form the command to run?
> --
> Roshan
> Blog: http://roshandawrani.wordpress.com/
> Twitter: @roshandawrani
> Skype: roshandawrani
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




--
Roshan
Blog: http://roshandawrani.wordpress.com/
Twitter: @roshandawrani
Skype: roshandawrani

Reply | Threaded
Open this post in threaded view
|

Re: STS 2.6 - running unit tests in a Grails project

Kris De Volder
Interesting. Doesn't adding the "-unit" bit to the command already
restrict to unit tests?

Anyway, I have put in an extra check and now only strip of the "Tests"
bit only for versions of Grails < 1.3.6.
It does seem better that way for people with recent Grails versions,
which hopefully is the majority of people :-)

Kris

On Tue, Apr 26, 2011 at 7:26 PM, Roshan Dawrani <[hidden email]> wrote:

> Hi Krwis,
> Thanks for responding.
> I guess, if you must choose between running no tests for older Grails
> versions and running extra tests for newer versions, then extra tests is the
> lesser evil of the two.
> In my case I would have liked to avoid it though, because compared to unit
> tests, integration / functional tests have much longer execution times for
> us, so we'd rather avoid the extra ones.
> We can always run such tests from the command line though.
> Cheers.
> On Tue, Apr 26, 2011 at 10:51 PM, Kris De Volder <[hidden email]>
> wrote:
>>
>> Hi Roshwan,
>>
>> This is really an STS related question. Luckily my coleagues spotted
>> it here and pointed me to it :-)
>> In the future please ask questions about STS functionality in the STS
>> forum.
>>
>> Anyway... on to your question.
>>
>> That's actually an interesting question. I think I implemented it this
>> way for a good reason. I think I tried it without stripping the "Test"
>> from the end and it didn't work.
>>
>> Now... I just tried this again and it does work. My only explanation
>> is that perhaps the behavior for "test-app" has changed a little since
>> I tested it (with an earlier version of Grails at the time).
>>
>> It seems that in Grails 1.3.6 having "Tests" at the end is ok.
>>
>> But when I do the same command in Grails 1.2.1 then it seems to run
>> the tests, but looking at the test report... "0" tests got executed by
>> the command. So it actually did not really work.
>>
>> So... somewhere between Grails 1.3.6 and Grails 1.2.1 the behavior has
>> changed a bit.
>>
>> I'm a bit ambivalent about what to do now. On the one hand I agree
>> that it is more logical with more recent version of Grails behavior to
>> not strip of the "Tests" bit, but then it wouldn't work for users
>> using older versions of Grails.
>>
>> It seems to me, that it isn't so bad that, for you, it ran some extra
>> tests (it did still run the tests you wanted), compared to not running
>> any tests at all for users with older version of Grails.
>>
>> Kris
>>
>> On Tue, Apr 26, 2011 at 7:23 AM, Roshan Dawrani <[hidden email]>
>> wrote:
>> > Hi,
>> > I wanted to report a minor thing that could be seen as a bug.
>> > I have unit tests a.b.FooTests and a.b.FooSpec in my Grails project and
>> > I
>> > right click on FooTests.groovy and run test-app command and STS comes up
>> > with "test-app -unit a.b.Foo" as the command, which ends up executing
>> > tests
>> > of both a.b.FooTests and a.b.FooSpec, which is not what I intended.
>> > Does it have to truncate "Tests" from the end and form the command to
>> > run?
>> > --
>> > Roshan
>> > Blog: http://roshandawrani.wordpress.com/
>> > Twitter: @roshandawrani
>> > Skype: roshandawrani
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>
>
> --
> Roshan
> Blog: http://roshandawrani.wordpress.com/
> Twitter: @roshandawrani
> Skype: roshandawrani
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: STS 2.6 - running unit tests in a Grails project

Roshan Dawrani
On Wed, Apr 27, 2011 at 10:11 PM, Kris De Volder <[hidden email]> wrote:
Interesting. Doesn't adding the "-unit" bit to the command already
restrict to unit tests?

Does STS allow only executing unit tests by right clicking on unit test script?

I assumed that if I tried it with an integration test, it will then add "-integration" and even those will have the same issue then?

 
Anyway, I have put in an extra check and now only strip of the "Tests"
bit only for versions of Grails < 1.3.6.
It does seem better that way for people with recent Grails versions,
which hopefully is the majority of people :-)

Thanks. Running only one testcase when user has tried to run only one makes sense anyway. Good that you managed to keep it sensible for both older and newer Grails versions. :-)

--
Roshan
Blog: http://roshandawrani.wordpress.com/
Twitter: @roshandawrani
Skype: roshandawrani