Hi,

I have two groovy(geb) junit tests and both of them run successfully in
eclipse. 

However, when I use gradle to run the test in command line, I get failure
message with one of them:
"junit.framework.AssertionFailedError: Class ParameterizedTest has no public
constructor TestCase(String name) or TestCase()"

I googled about this error message and there are some discussion before:
http://gradle.1045684.n5.nabble.com/Junit-tests-fail-junit-framework-AssertionFailedError-has-no-public-constructor-td3202811.html
http://gradle.1045684.n5.nabble.com/Junit-tests-fail-junit-framework-AssertionFailedError-has-no-public-constructor-td3202811.html
 
I don't have junit3 in my classpath, so that could not solve my problem. 

Since both of these two test can be run with no-prob in eclipse, and only
the parameterized test failure with gradle on command line, maybe something
wrong with junit4 parameterized test ?


Success Class:

@RunWith(JUnit4)
        class SimpleTest extends GebTest{
        
                String getBaseUrl() {
                        "http://www.xxx.com/svSE/";
                }
        
                WebDriver createDriver() {
                        new FirefoxDriver()
                }
        
                @Test
                void testSomethinghjdgasgjjk() {
                        go "welcome.htm"
                        assert $("title").text() == ""
                        
                }
        
                @After
                public void tearDown() {
                        getBrowser().driver.close()
                }
}


Failured Class:

@RunWith(Parameterized)
class ParameterizedTest extends GebTest{
        String    baseUrl;
        String    language;
        String    title;

        public ParameterizedTest (String baseUrl, String language, String 
title) {
                this.baseUrl   = baseUrl
                this.language  = language
                this.title     = title
        }
        
        String getBaseUrl() {
                return baseUrl
        }

        WebDriver createDriver() {
                return new FirefoxDriver()
        }

  @Parameters
  public static Collection<Object[]> parameters() {
        def rowsOfTestParameters =
        [
          ["http://www.google.fr/";   ,"en","Google Images"  ] as Object[],
          ["http://www.google.co.uk/","fi","Google-kuvat";   ] as Object[],
        ]
        def parameters = []
          rowsOfTestParameters.each { rowOfTestParameters ->
                 def rowOfDTestParameters = []+ rowOfTestParameters.flatten()
                 parameters.add(rowOfDTestParameters as Object[])
        }
        return parameters
  }


  @Test
  void testGoogleImageLink() {
        go "imghp?hl=" + language + "&tab=wi"
        assert $("title").text() == title
  }

  @After
  public void tearDown() {
          getBrowser().getDriver().close()
  }
}


Many thanks in advance. 

/wazh

--
View this message in context: 
http://gradle.1045684.n5.nabble.com/test-run-success-in-eclipse-but-fail-with-gradle-in-command-line-tp4271042p4271042.html
Sent from the gradle-user mailing list archive at Nabble.com.

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

    http://xircles.codehaus.org/manage_email


Reply via email to