创建测试自动化框架maven + testng + selenium + appium。 运行testng' maven test'或者' mvn test -Dgroups = SignUp' 显示错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project TestPageObject: Exception in provider: NullPointerExcepti
on -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project TestPageObject: Exception in provider
的pom.xml:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<systemProperties>
<property>
<name>reporter.debug</name>
<value>false</value>
</property>
</systemProperties>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
<!--<testdroidDevice>${value}</testdroidDevice>-->
<forkMode>never</forkMode>
<groups>
SignUp,
</groups>
</configuration>
</plugin>
</plugins>
</build>
testng.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Custom suite" verbose="1">
<test name="MeWe-PO" >
<classes>
<class name="com.appium.test.AppTest"/>
</classes>
<groups>
<define name="all">
<include name="SignUp"/>
<include name="Login"/>
</define>
<run>
<include name="all"/>
</run>
</groups>
</test>
</suite>
使用注释@BeforeGroups或@BeforeSuite
Debug和stacktrace:
[DEBUG] Output directory: E:\MeWe\Projects\MeWePO\target\test-classes
[DEBUG] CompilerReuseStrategy: reuseCreated
[DEBUG] useIncrementalCompilation enabled
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.19.1:test (default-test) @ TestPageObject ---
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=0, ConflictMarker.markTime=1, ConflictMarker.nodeCount=114, ConflictIdSorter.graphTime=0, ConflictIdSorter.t
opsortTime=0, ConflictIdSorter.conflictIdCount=34, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=2, ConflictResolver.conflictItemCount=80, DefaultDepen
dencyCollector.collectTime=213, DefaultDependencyCollector.transformTime=3}
[DEBUG] org.apache.maven.plugins:maven-surefire-plugin:jar:2.19.1:
[DEBUG] org.apache.maven:maven-plugin-api:jar:2.2.1:compile
[DEBUG] org.apache.maven.surefire:maven-surefire-common:jar:2.19.1:compile
[DEBUG] org.apache.maven.surefire:surefire-booter:jar:2.19.1:compile
[DEBUG] org.apache.maven:maven-artifact:jar:2.2.1:compile
[DEBUG] org.codehaus.plexus:plexus-utils:jar:1.5.15:compile
[DEBUG] org.apache.maven:maven-plugin-descriptor:jar:2.2.1:compile
[DEBUG] org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
[DEBUG] junit:junit:jar:4.12:compile
[DEBUG] org.hamcrest:hamcrest-core:jar:1.3:compile
[DEBUG] org.apache.maven:maven-project:jar:2.2.1:compile
[DEBUG] org.apache.maven:maven-settings:jar:2.2.1:compile
[DEBUG] org.apache.maven:maven-profile:jar:2.2.1:compile
[DEBUG] org.apache.maven:maven-artifact-manager:jar:2.2.1:compile
[DEBUG] backport-util-concurrent:backport-util-concurrent:jar:3.1:compile
[DEBUG] org.apache.maven:maven-plugin-registry:jar:2.2.1:compile
[DEBUG] org.codehaus.plexus:plexus-interpolation:jar:1.11:compile
[DEBUG] org.apache.maven:maven-model:jar:2.2.1:compile
[DEBUG] org.apache.maven:maven-core:jar:2.2.1:compile
[DEBUG] org.apache.maven:maven-plugin-parameter-documenter:jar:2.2.1:compile
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:281)
at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:121)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:202)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:155)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:81)
at org.apache.maven.plugin.surefire.InPluginVMSurefireStarter.runSuitesInProcess(InPluginVMSurefireStarter.java:82)
... 25 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException