2017-07-27 67 views
1

我們致力於改進Apache Velocity Engine Source Code中的smth',但我們在構建它時測試時遇到問題。Apache速度引擎1.7.x測試失敗

我們在github上從Apache/Velocity克隆了源代碼。

然後我們試圖構建引擎,但是我們得到了這個錯誤。

Failed tests: testVelTools66(org.apache.velocity.test.issues.VelTools66TestCase): Method object does not match! expected:<public abstract java.lang.String org.apache.velocity.test.issues.VelTools66TestCase$TestInterface.getTestValue()> but was:<public java.lang.String org.apache.velocity.test.issues.VelTools66TestCase$TestObject.getTestValue()> 
    testResourceLoaderInstance(org.apache.velocity.test.ResourceLoaderInstanceTestCase): Processed template did not match expected output 

Tests in error: 
    testClasspathResource(org.apache.velocity.test.ClasspathResourceTestCase): Unable to find resource 'template/test1.vm' 
    testContextSafety(org.apache.velocity.test.ContextSafetyTestCase): Unable to find resource 'context_safety.vm' 
    testHighByteChinese2(org.apache.velocity.test.EncodingTestCase): Unable to find resource 'encodingtest3.vm' 
    testChineseEncoding(org.apache.velocity.test.EncodingTestCase): Unable to find resource 'encodingtest.vm' 
    testHighByteChinese(org.apache.velocity.test.EncodingTestCase): Unable to find resource 'encodingtest2.vm' 
    testRussian(org.apache.velocity.test.EncodingTestCase): Unable to find resource 'encodingtest_KOI8-R.vm' 
    testMultiLoader(org.apache.velocity.test.MultiLoaderTestCase): Unable to find resource 'template/test1.vm' 
    testSharedRepo(org.apache.velocity.test.StringResourceLoaderRepositoryTestCase): Unable to find resource 'foo' 
    testAlternateStaticRepo(org.apache.velocity.test.StringResourceLoaderRepositoryTestCase): Unable to find resource 'foo' 
    Arithmetic(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'arithmetic.vm' 
    Array(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'array.vm' 
    Block(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'block.vm' 
    Comment(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'comment.vm' 
    Equality(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'equality.vm' 
    Escape(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'escape.vm' 
    Foreach-array(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'foreach-array.vm' 
    Foreach-method(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'foreach-method.vm' 
    Foreach-variable(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'foreach-variable.vm' 
    Formal(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'formal.vm' 
    If(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'if.vm' 
    Logical(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'logical.vm' 
    Loop(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'loop.vm' 
    Method(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'method.vm' 
    Quotes(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'quotes.vm' 
    Sample(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'sample.vm' 
    Shorthand(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'shorthand.vm' 
    Test(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'test.vm' 
    Diabolical(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'diabolical.vm' 
    Pedantic(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'pedantic.vm' 
    Subclass(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'subclass.vm' 
    Foreach-map(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'foreach-map.vm' 
    Include(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'include.vm' 
    Escape2(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'escape2.vm' 
    Parse(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'parse.vm' 
    Velocimacro(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'velocimacro.vm' 
    Reference(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'reference.vm' 
    Interpolation(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'interpolation.vm' 
    Vm_test1(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'vm_test1.vm' 
    Map(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'map.vm' 
    Literal(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'literal.vm' 
    Ifstatement(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'ifstatement.vm' 
    Math(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'math.vm' 
    Range(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'range.vm' 
    Get(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'get.vm' 
    Velocimacro2(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'velocimacro2.vm' 
    Foreach-type(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'foreach-type.vm' 
    Foreach-introspect(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'foreach-introspect.vm' 
    Settest(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'settest.vm' 
    Newline(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'newline.vm' 
    Logical2(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'logical2.vm' 
    String(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'string.vm' 
    Stop1(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'stop1.vm' 
    Stop2(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'stop2.vm' 
    Foreach-null-list(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'foreach-null-list.vm' 
    Curly-directive(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'curly-directive.vm' 
    Comment-eof(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'comment-eof.vm' 
    Commas(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'commas.vm' 
    Stop3(org.apache.velocity.test.TemplateTestCase): Unable to find resource 'stop3.vm' 

Tests run: 444, Failures: 2, Errors: 58, Skipped: 0 

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-test) on project velocity: There are test failures. 

Please refer to C:\apache\velocity-engine\target\surefire-reports for the individual test results. 
-> [Help 1] 

To see the full stack trace of the errors, re-run Maven with the -e switch. 
Re-run Maven using the -X switch to enable full debug logging. 

For more information about the errors and possible solutions, please read the following articles: 
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException 

正如我們所想,通常這個消息意味着失敗的測試無法找到模板資源。

注意:這些錯誤發生在我們沒有任何編輯行的情況下。如果你克隆了prev中的1.7.x引擎。網址你會得到同樣的錯誤。

我希望有人有這個問題的解決方案。 謝謝。

回答

0

現在看來,這是因爲TemplateTestBase.java

public static final String TEST_COMPARE_DIR = "@[email protected]"; 
public static final String TEST_RESULT_DIR = "@[email protected]"; 

而且從build.properties

test.dir = $ {} velocity.dir /測試

build.test = $ {建.dir}/test

所以如果你用ant運行測試,您不必更改TEST_COMPARE_DIRTEST_RESULT_DIR,否則可以相應地將這些字符串常量更改爲絕對路徑。

+0

是的,我發現這個問題是圍繞從一開始這件事情,但我想改變這周圍的東西,和第n個」發生 –

+0

如果你有更具體的解決方案,或其他任何東西,我將感激。謝謝。 –