Uploaded image for project: 'Spring Tool Suite'
  1. Spring Tool Suite
  2. STS-1202

[Grails] - Running individual test triggers all test phases

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 2.5.0.M3
    • Fix Version/s: 2.5.0.RC1
    • Component/s: GRAILS
    • Labels:
      None
    • Environment:
      grails 1.3.4
      STS 2.5.0.CI-R5648-B65, build: 201008310801

      Description

      When a single unit test is selected and run with right click -> Run As -> Grails Command (test-app) all test phases are triggered, including integration test phase, and if functional-test plugin is installed, functional test phase too. This makes running a single unit test very slow.

      I guess this can be resolved by detecting a test directory in which test is positioned and by using an appropriate switch, unit or integration. If these switches are used from Grails command popup only single test phase is executed.

        Activity

        Hide
        kdvolder Kris De Volder added a comment -

        About the source classpath entry. Yes, I was wrong. The problem is that I think there was an inconsistency in how I decide whether this is in a "test" source folder. It should now be ok... I think. But I haven't tested it with a project that has "functional" tests in it.

        Show
        kdvolder Kris De Volder added a comment - About the source classpath entry. Yes, I was wrong. The problem is that I think there was an inconsistency in how I decide whether this is in a "test" source folder. It should now be ok... I think. But I haven't tested it with a project that has "functional" tests in it.
        Hide
        dmurat Damir Murat added a comment -

        Great, tnx for fixes. I will try and report back. This is least I can do.

        Show
        dmurat Damir Murat added a comment - Great, tnx for fixes. I will try and report back. This is least I can do.
        Hide
        dmurat Damir Murat added a comment -

        Great job, everything works correctly, and as expected. There are no exceptions either.

        However, I think there is one more improvement that can be done. Currently running all tests from a single package is not supported. When run from the context menu of a single package, all tests of that kind from all packages are run. For example, for unit tests, "test-app -unit" command is executed.

        Grails support running tests from a single package

        grails test-app -unit mypackage.*

        and from a package and all its subpackages

        grails test-app -unit mypackage.**

        I don't think that option with subpackages should be included since I don't see how STS can't deduce whether a user wants to run tests from a single package, or from subpackages. But, supporting running tests from a single package will be very nice.

        Please note, if above commands are run from STS grails command popup, they cause exception and are not executed (STS-1208). Don't know whether your code depends on this, but I thought you should know. From OS command prompt, everything works as described in Grails documentation.

        Show
        dmurat Damir Murat added a comment - Great job, everything works correctly, and as expected. There are no exceptions either. However, I think there is one more improvement that can be done. Currently running all tests from a single package is not supported. When run from the context menu of a single package, all tests of that kind from all packages are run. For example, for unit tests, "test-app -unit" command is executed. Grails support running tests from a single package grails test-app -unit mypackage.* and from a package and all its subpackages grails test-app -unit mypackage.** I don't think that option with subpackages should be included since I don't see how STS can't deduce whether a user wants to run tests from a single package, or from subpackages. But, supporting running tests from a single package will be very nice. Please note, if above commands are run from STS grails command popup, they cause exception and are not executed ( STS-1208 ). Don't know whether your code depends on this, but I thought you should know. From OS command prompt, everything works as described in Grails documentation.
        Hide
        kdvolder Kris De Volder added a comment -

        Seems like a logical extension and not too hard to implement. I'll have a go at that.

        Show
        kdvolder Kris De Volder added a comment - Seems like a logical extension and not too hard to implement. I'll have a go at that.
        Hide
        kdvolder Kris De Volder added a comment -

        I've committed a fix to support the selection of individual packages.

        It should allow for selection of packages either in a test folder or another
        source folder. If in a test folder an option like "-unit" or "-integration".
        will be added.

        E.g:

        test-app -unit mypackage.*

        If in a regular source folder it will just run

        test-app mypackage.*

        Show
        kdvolder Kris De Volder added a comment - I've committed a fix to support the selection of individual packages. It should allow for selection of packages either in a test folder or another source folder. If in a test folder an option like "-unit" or "-integration". will be added. E.g: test-app -unit mypackage.* If in a regular source folder it will just run test-app mypackage.*

          People

          • Assignee:
            Unassigned
            Reporter:
            dmurat Damir Murat
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: