- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我是 Maven 新手,我正在尝试使用下面的 POM 进行测试运行。 mvn -compile 命令没有显示任何错误,但 mvn -test 命令抛出错误。请参阅下文了解更多详细信息。
POM:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>Test</groupId>
<artifactId>Test</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Test</name>
<url>http://maven.apache.org</url>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<!-- put your configurations here -->
</configuration>
</plugin>
</plugins>
</pluginManagement>
<resources>
<resource>
<directory>src/test/java/Test</directory>
</resource>
</resources>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
</dependency>
</dependencies>
</project>
MVN命令
mvn 编译输出:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Test 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Test ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ Test ---
[INFO] Nothing to compile - all classes are up to date
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.953 s
[INFO] Finished at: 2016-09-15T10:51:07-07:00
[INFO] Final Memory: 11M/245M
[INFO] ------------------------------------------------------------------------
mvn test -e 输出
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Test 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Test ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ Test ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ Test ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/gowtham/Desktop/Projects/Test/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:testCompile (default-testCompile) @ Test ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ Test ---
[INFO] Surefire report directory: /Users/gowtham/Desktop/Projects/Test/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running Test.AppTest
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.009 sec <<< FAILURE!
warning(junit.framework.TestSuite$1) Time elapsed: 0.005 sec <<< FAILURE!
junit.framework.AssertionFailedError: No tests found in Test.AppTest
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.TestSuite$1.runTest(TestSuite.java:263)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
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.junit.JUnitTestSet.execute(JUnitTestSet.java:95)
at org.apache.maven.surefire.junit.JUnit3Provider.executeTestSet(JUnit3Provider.java:121)
at org.apache.maven.surefire.junit.JUnit3Provider.invoke(JUnit3Provider.java:98)
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.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Results :
Failed tests: warning(junit.framework.TestSuite$1): No tests found in Test.AppTest
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.432 s
[INFO] Finished at: 2016-09-15T10:53:38-07:00
[INFO] Final Memory: 12M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project Test: There are test failures.
[ERROR]
[ERROR] Please refer to /Users/gowtham/Desktop/Projects/Test/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project Test: There are test failures.
Please refer to /Users/gowtham/Desktop/Projects/Test/target/surefire-reports for the individual test results.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
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.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures.
Please refer to /Users/gowtham/Desktop/Projects/Test/target/surefire-reports for the individual test results.
at org.apache.maven.plugin.surefire.SurefireHelper.reportExecution(SurefireHelper.java:83)
at org.apache.maven.plugin.surefire.SurefirePlugin.writeSummary(SurefirePlugin.java:176)
at org.apache.maven.plugin.surefire.SurefirePlugin.handleSummary(SurefirePlugin.java:150)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:650)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:586)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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
这是java代码:
package Test;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.junit.Test;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.remote.MobilePlatform;
import junit.framework.TestCase;
/**
* Unit test for simple App
*/
public class AppTest extends TestCase
{
@Test
public void Test() throws MalformedURLException
{
DesiredCapabilities cap=new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.ANDROID);
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Android device");
cap.setCapability(MobileCapabilityType.BROWSER_NAME, "Chrome");
AndroidDriver driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"),cap);
driver.manage().timeouts().implicitlyWait(25, TimeUnit.SECONDS);
driver.get("http://www.google.com");
}
您能帮忙解决这个问题吗?
最佳答案
没有找到测试,您的项目中至少需要有一个测试方法:
@Test
public void doTest() {};
关于java - 无法执行目标 org.apache.maven.plugins :maven-surefire-plugin:2. 12.4:测试(默认测试),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39517499/
最近我将 surefire 插件从 2.15 迁移到 3.0.0-M5,即使所有测试用例都通过了,我仍然看到下面的错误。我在生成的报告中没有看到任何内容,只是一个空文件。 Google 和 stack
我无法获得 maven-surefire-report-plugin 生成 surefire-report.html 当我运行时: mvn clean deploy site mvn clean si
我的 pom.xml 中没有 surefire 插件条目。但是当我使用命令运行时,我得到了 surefure 插件错误: mvn test -Dtest=TEstClass 错误: [ERROR]
我有一个简单的 JPMS 模块。当我使用 maven-surefire-plugin 2.20.1 时一切正常 - 我的测试已执行: org.apache.m
运行 Spring Boot 2.0.2.RELEASE 应用程序的 maven (3.5.2) 构建(由具有 Web 依赖项的 Web 初始化程序生成)无法执行 maven-surefire-p
我试图通过嵌入式jetty服务器和apache wink REST客户端在我的scim Restful服务器实现上运行集成测试,但未能运行测试。这是我的 EmbeddedServerBase 类 pa
所以我遇到了问题,我正在按照教程 Working with Custom Content types in Alfresco 进行操作但当我尝试安装该程序时遇到 Maven 问题。它告诉我 Maven
在我的项目中,测试位于两个目录中的 maven 包“java-tests-framework”(整个项目的子包)中: /src/main/java /src/test/java 我想使用 Surefi
所以我遇到了问题,我正在按照教程 Working with Custom Content types in Alfresco 进行操作但当我尝试安装该程序时遇到 Maven 问题。它告诉我 Maven
您好,我在一个项目中有一个模块,我正在尝试从模块目录运行该模块: mvn 集成测试-PmyProps 在pom中 admin ...
当我在 Surefire 中运行测试时,有什么区别 suitesAndClasses 和 classes 第一个示例似乎并行运行我的测试类,而第二个示例则不然。 最佳答案 请在下面找到一个简单的示例来
我怀疑这很简单,当我直接从 eclipse 执行 JUnit 测试时,surefire 报告没有生成,甚至文件夹 (target/surefire/surefire-report) 也没有生成,但是当
我已经使用 Maven 配置了 Surefire 报告 我没有收到任何错误,但我也没有得到测试执行的结果当作为 Maven 测试运行时。我已附上屏幕截图。我也有正确的 Maven 项目结构 作为 Ma
我想重新运行一个我知道会失败的测试,因为我正在尝试测试 Surefire 参数以重新运行失败的测试。我尝试用这两个命令运行 Maven,它们都没有按预期工作 -Dsurefire.rerunFaili
看起来surefire 和failsafe 插件按顺序执行测试类,而在类中定义的测试以不确定的顺序执行。 为了发现依赖于顺序的测试(我们认为是糟糕的测试),我们希望强制每次运行的顺序不同。理想情况下,
有没有办法让万无一失的干运行? 会列出哪些测试的东西 会 运行,而不运行它们。 目标是知道在特定配置下哪些测试(将)在 JBoss AS7 测试套件中运行。 最佳答案 Janinko 在 https:
在我的项目中,我有几个模块。当我使用 surefire maven 插件生成报告时,它会分别为每个模块创建报告。我想合并这些报告。有没有办法合并这个单独的报告。 Surefire 插件中的任何配置?
我如何在 maven 的默认生命周期中生成 surefire 报告。我们在 teamcity 中设置了工作,目标为 mvn clean install -Pprod 此作业运行所有 junits,我想
我正在运行 Maven 3.1.0 Surefire plugin 已经与 --quiet选项,但是它仍然将单元测试的结果打印到命令行,即使它们都通过了。 有没有办法让它只打印失败? 如果一切正常,我
我排除了插件中除我的测试套件之外的所有测试: org.apache.maven.plugins maven-surefire-plugin 2.11
我是一名优秀的程序员,十分优秀!