1

Nous travaillons à améliorer le code source d'Apache Velocity Engine, mais nous avons un problème avec ses tests lorsque nous le construisons.Apache velocity engine 1.7.x teste l'échec

Nous avons cloné le code source de Apache/Velocity sur github.

Ensuite, nous avons essayé de construire le moteur, mais nous avons eu cette erreur.

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 

Comme nous le pensons, Généralement ce message signifie que les tests ayant échoué n'ont pas pu trouver de ressources de modèles.

Remarque: ces erreurs se produisent sans aucune ligne de modification de notre part. si vous avez cloné le moteur 1.7.x qui est dans le prev. URL, vous obtiendrez la même erreur.

J'espère que quelqu'un a la solution de ce problème. Merci.

Répondre

0

Il semble que ce soit à cause de TemplateTestBase.java

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

Et de build.properties

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

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

Donc, si vous exécutez des tests avec ant, vous n'avez pas besoin de changer les TEST_COMPARE_DIR et TEST_RESULT_DIR, sinon vous pouvez changer ces constantes de chaîne au chemin absolu en conséquence.

+0

Oui, j'ai trouvé que le problème est autour de cette chose depuis le début, mais j'ai essayé de changer beaucoup de choses autour de cela, et n 'arrive –

+0

Si vous avez une solution plus spécifique, ou toute autre chose je vais apprécier. Merci. –