Skip to content

holi-java/junit4-freemarker

Repository files navigation

JUnit4 FreeMarker Test Framework

build status

a test framework for freemarker, you can use this project for learning freemarker step by step.

Test Syntax

<@test name="test some feature">
  <#assign foo="bar">
  
  <@assert expected='bar' actual=foo/>
  <@assert expected=foo=='bar'/>
  <@assert expected=foo>bar</@assert>
</@test>

<@test name="matching test will failed with exception" expected="java.lang.Exception">${invalid_expression}</@test>

Get Started

Write a test make it run as ScriptRunner and defined a method annotated with @Scanner annotation return an instance of ScriptScanner.

@RunWith(ScriptRunner.class)
public class FreeMarkerRunnerExample {

  public static @Scanner ScriptScanner scanner() {
    return new FileSystemScriptScanner(file("src/test/resources"),
        allOf(not(startsWith("_")), endsWith(".ftl")));
  }
}

Test Result

test result

About

a junit test framework for freemarker

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published