fhoeben / hsac-fitnesse-fixtures

An environment to define and run integration tests. It contains Fitnesse fixture (base) classes and a baseline FitNesse installation.
Apache License 2.0
109 stars 99 forks source link

how to change template location #179

Closed keetron closed 6 years ago

keetron commented 6 years ago

I keep getting the message template not found. How do I set the template location anyway or find out where I should put a template when using freemarker fixture?

fhoeben commented 6 years ago

At runtime the templates must be in wiki/fixtures/templates.

The best way to get them there is:

At the moment this location is not configurable. The example page (FreemarkerFixture.wiki) does 'try' to document the runtime location, but reading it now I believe it is wrong (as it mentions a 'template' directory and not 'templates').

The templates are loaded from the 'template' directory on the class path (e.g. /fixtures/template in a standalone installation).

keetron commented 6 years ago

I will figure something out, like putting the template where they are exxpected which is in basePackagePath: "/templates/ according to Environments.java line 77 ;-)

https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/cb7bceb9820fe187a240009896059318f0ced251/src/main/java/nl/hsac/fitnesse/fixture/Environment.java#L77

But hell, you know your code!

fhoeben commented 6 years ago

What do you think of the latest documentation in FreemarkerFixture.wiki

keetron commented 6 years ago

It helped me find the location that the fixture is actually looking for after building. As you know, I use HSAC outside of FitNesse and putting the ftl in the main/resources/templates folder enables me to run the JUnit based tests because the maven build can find them there and will move them to target/classes/templates.

I will add a comment to the docs, I feel it is a bit verbose.

tcnh commented 6 years ago

I use HSAC outside of FitNesse

Did you find a nice way to avoid having to depend on fitnesse? (i.e. is there some hidden slim-only artifact somewhere?)

keetron commented 6 years ago

It depends on what you consider nice. I included fitnesse and hsac as dependencies in the pom.xml and import the XmlHttpTest in my java classes as needed. Right now I use two classes: XmlHttpTest to be able to combine an xpath and an URL to an expected value in very few lines of code and FreeMarkerFixture to combine ftl templates to datamaps for test data setup.

Both of these are typical Rabobank stuff. Funny part is, I see your and Frieds name all over the place in the code I work with. Drop by, we can have lunch :smile:

gabe2001 commented 4 months ago

hello @fhoeben - thank you for your work! I do have an issue though: no matter what I do, I cannot "see" my Freemarker template. I'm placing it in fixtures/templates (pulled in from src/main/resources) and I keep getting the TemplateNotFoundException. This runs on linux with java 11 - all the samples work fine. Do you have any suggestions/pointers/ideas?

fhoeben commented 4 months ago

@gabe2001 maybe you should create a new issue describing you setup and wiki page exactly because just like this I cannot determine why it would go wrong. The only thing I can think of just like this is that maybe there is a 'casing problem' in the template name? So for instance you try to load my_template.ftl and the template is actually called My_template.ftl.

gabe2001 commented 4 months ago

I'm now thinking that the issue is with the unpacking of the JARs. The part is not working as described in the instructions. I'll try to figure out a solution for that issue first.