Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add new parameter testType to test phase #4

Open
wants to merge 2 commits into from

1 participant

@jpbriend

I added a parameter to the test phase : testType.

Possible values are :

  • unit
  • integration
  • all (default)
Jean-Philipp... added some commits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 15, 2011
  1. Add .idea to .gitignore

    Jean-Philippe Briend authored
  2. Add testType parameter (all, unit or integration) parameter to test p…

    Jean-Philippe Briend authored
    …hase
This page is out of date. Refresh to see the latest.
View
3  .gitignore
@@ -2,4 +2,5 @@ grails-maven-plugin.iml
grails-maven-plugin.ipr
grails-maven-plugin.iws
META-INF
-target
+target
+.idea
View
26 src/main/java/org/grails/maven/plugin/MvnTestMojo.java
@@ -58,6 +58,15 @@
*/
private boolean testFailureIgnore;
+ /**
+ * Choose which type of tests to launch (passes --unit or --integration to Grails command).
+ * Default is all : Unit tests + Integration tests.
+ * Other values are 'unit' and 'integration'.
+ *
+ * @parameter default-value="all" expression="${grails.test.type}"
+ */
+ private String testType;
+
public void execute() throws MojoExecutionException, MojoFailureException {
if (skip) {
return;
@@ -81,8 +90,23 @@ public void execute() throws MojoExecutionException, MojoFailureException {
}
}
+ if (testType == null || "".equals(testType)) {
+ testType = "all";
+ }
+
try {
- runGrails("TestApp", "--unit --integration", true);
+ // Unit tests only
+ if ("unit".equalsIgnoreCase(testType)) {
+ runGrails("TestApp", "--unit", true);
+ }
+ // Integration tests only
+ else if ("integration".equalsIgnoreCase(testType)) {
+ runGrails("TestApp", "--integration", true);
+ }
+ // All tests
+ else {
+ runGrails("TestApp", "--unit --integration", true);
+ }
} catch (MojoExecutionException me) {
if (!testFailureIgnore) {
throw me;
Something went wrong with that request. Please try again.