Apache速度引擎1.7.x测试失败

时间:2017-07-27 09:48:38

标签: java debugging velocity template-engine templating-engine

我们致力于改善生活质量。在Apache Velocity Engine源代码中,但是在我们构建它时我们的测试存在问题。

我们在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引擎。网址您将收到相同的错误。

我希望有人能解决这个问题。 感谢。

1 个答案:

答案 0 :(得分:0)

似乎是因为TemplateTestBase.java

public static final String TEST_COMPARE_DIR = "@test.dir@";
public static final String TEST_RESULT_DIR = "@build.test@";

来自build.properties

  

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

     

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

因此,如果使用ant运行测试,则不必更改TEST_COMPARE_DIRTEST_RESULT_DIR,否则可以相应地将这些字符串常量更改为绝对路径。

相关问题