Tapestry 5.2.4&硒测试

时间:2011-02-07 10:38:38

标签: selenium tapestry

今天早上我的硒测试是一些问题。

我创建了一个Selenium测试类:

public class IEPatchSeleniumTest extends SeleniumTestCase{ 

        @Test 
        public void testTypingXSSCode() { 
                open("/Index"); 
        } 
}

我配置了我的testng.xml:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> 
<suite name="Kawwa Tests" verbose="1"> 
        <test name="Integration Tests" enabled="true"> 
                <parameter name="tapestry.web-app-folder" value="src/test/app0"/> 
                <packages> 
                        <package name="net.mm.tapestry.security.integration" /> 
                </packages> 
        </test> 
</suite> 

我的Maven-surefire-plugin声明如下:

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-surefire-plugin</artifactId> 
    <version>2.4.3</version> 
    <configuration> 
      <suiteXmlFiles> 
        <suiteXmlFile>src/test/conf/testng.xml</suiteXmlFile> 
      </suiteXmlFiles> 
      <argLine>-Xmx500m -XX:MaxPermSize=256m</argLine> 
    </configuration> 
</plugin>

但是当我运行我的测试套件时,我遇到了2个错误:

<test-method status="FAIL" signature="testStartup(org.testng.ITestContext, org.testng.xml.XmlTest)" name="testStartup" is-config="true" duration-ms="0" depends-on-groups="beforeStartup" started-at="2011-02-04T13:46:02Z" finished-at="2011-02-04T13:46:02Z"> 
  <exception class="org.testng.TestNGException"> 
    <message> 
      <![CDATA[ 
Method testStartup requires 2 parameters but 0 were supplied in the @Configuration annotation.]]> 
    </message> 
    <full-stacktrace> 
      <![CDATA[org.testng.TestNGException: 
        Method testStartup requires 2 parameters but 0 were supplied in the @Configuration annotation. 
        at org.testng.internal.Parameters.checkParameterTypes(Parameters.java:147) 
        at org.testng.internal.Parameters.createParameters(Parameters.java:96) 
        at org.testng.internal.Parameters.createParameters(Parameters.java:289) 
        at org.testng.internal.Parameters.createConfigurationParameters(Parameters.java:70) 
        at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:135) 
        at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:82) 
        at org.testng.TestRunner.beforeRun(TestRunner.java:501) 
        at org.testng.TestRunner.run(TestRunner.java:469) 
        at org.testng.SuiteRunner.runTest(SuiteRunner.java:324) 
        at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:319) 
        at org.testng.SuiteRunner.privateRun(SuiteRunner.java:292) 
        at org.testng.SuiteRunner.run(SuiteRunner.java:198) 
        at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:821) 
        at org.testng.TestNG.runSuitesLocally(TestNG.java:788) 
        at org.testng.TestNG.run(TestNG.java:708) 
        at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:74) 
        at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:92) 
        at org.apache.maven.surefire.Surefire.run(Surefire.java:177) 
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
        at java.lang.reflect.Method.invoke(Method.java:597) 
        at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345) 
        at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009) 
]]> 
    </full-stacktrace> 
  </exception> 
</test-method> 



<test-method status="FAIL" signature="indicateTestMethodName(java.lang.reflect.Method)" name="indicateTestMethodName" is-config="true" duration-ms="0" started-at="2011-02-04T13:46:02Z" finished-at="2011-02-04T13:46:02Z"> 
  <params> 

      <value> 
        <![CDATA[public void net.mm.tapestry.security.integration.IEPatchSeleniumTest.testTypingXSSCode()]]> 
      </value> 

  </params> 
  <exception class="java.lang.NullPointerException"> 
  <full-stacktrace> 
    <![CDATA[java.lang.NullPointerException 
        at org.apache.tapestry5.test.SeleniumTestCase.indicateTestMethodName(SeleniumTestCase.java:292) 
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
        at java.lang.reflect.Method.invoke(Method.java:597) 
        at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580) 
        at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:398) 
        at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:145) 
        at org.testng.internal.Invoker.invokeMethod(Invoker.java:427) 
        at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:617) 
        at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:885) 
        at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126) 
        at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:110) 
        at org.testng.TestRunner.runWorkers(TestRunner.java:712) 
        at org.testng.TestRunner.privateRun(TestRunner.java:582) 
        at org.testng.TestRunner.run(TestRunner.java:477) 
        at org.testng.SuiteRunner.runTest(SuiteRunner.java:324) 
        at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:319) 
        at org.testng.SuiteRunner.privateRun(SuiteRunner.java:292) 
        at org.testng.SuiteRunner.run(SuiteRunner.java:198) 
        at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:821) 
        at org.testng.TestNG.runSuitesLocally(TestNG.java:788) 
        at org.testng.TestNG.run(TestNG.java:708) 
        at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:74) 
        at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:92) 
        at org.apache.maven.surefire.Surefire.run(Surefire.java:177) 
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
        at java.lang.reflect.Method.invoke(Method.java:597) 
        at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345) 
        at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009) 
]]> 
            </full-stacktrace> 
          </exception> 
        </test-method>

之前有人遇到过这些问题吗?您选择了哪种解决方案?

非常感谢。

1 个答案:

答案 0 :(得分:1)

检查pom.xml中正在设置的TestNG版本。 :)