我是 maven 和 junit 的新手,所以请多多包涵:-)
我创建了一个示例 maven 项目,其中包含 src/test/java 中的一个简单测试,如下所示
public class AssertUnitTest {
@Test
public void massageTest(){
Assert.assertEquals("abc", "abd");
}
}
当我从 Eclipse 运行测试时,测试失败说预期是 abc 但找到 abd。当我使用终端运行相同的内容时,它说 BUILD FAILURE
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.assertpackage.AssertUnitTest
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.055 sec <<< FAILURE!
Results :
Failed tests:
messageTest(com.assertpackage.AssertUnitTest): expected:<ab[c]> but was:<ab[d]>
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.712s
[INFO] Finished at: Fri Sep 13 11:36:12 GMT+05:30 2013
[INFO] Final Memory: 9M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire- plugin:2.7.2:test (default-test) on project AssertProject: There are test failures.
[ERROR]
[ERROR] Please refer to /Users/support/Documents/Omniture_Selenium_Project/AssertProject /target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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
这个错误是什么以及如何解决它并使 BUILD SUCCESS