#2283 Test Documentation

SlimerDude Sun 11 May 2014

Hi,

I guess this question is mainly for Brian, but other opinions welcome!

The crux of the post is that I would like documentation for test classes to be compiled into pods.

More specifically, I'd like Compiler to generate .apidoc files for descendants of sys::Test so that sys::Type.doc() returns their fandoc. For currently all subclasses of Test are ignored when it comes to .apidoc generation (because DefNode.isDocumented() returns false for test classes).

Note I do not want the tests to appear in the API docs, but rather, for them to behave as if they were annotated with @NoDoc -> that is, generated and compiled into the pod, but not displayed.

If test documentation is really not wanted in a pod (say, to reduce its file size) then the stripTest config, as now used by BuildPod, is a great way to remove all test files.

And why? I want to automatically generate acceptance test documentation from the test fandocs. (From there I'm thinking of some sort of Concordion framework).

Work arounds I'm looking at include either getting Compiler to parse a single TypeDef (which looks tricky) or parsing the source file myself - but both options require access to the original source which is not ideal.

brian Mon 12 May 2014

So is the goal to provide a hook in the build file so that apidocs are generated for tests? I think that should be pretty easy.

Or is the goal to change the default behavior of the Fantom compiler? That I'm not very keen on doing :)

SlimerDude Mon 12 May 2014

Hi Brian, just a hook would be great!

My current workaround hinges on being able to find the correct src file for a given test Type - with no guarantee the file is named after Type. Then I use compiler::Tokenizer to find docComments, with no guarantee the doc comments belong to the Type (and not some field or method). It's pretty brittle!

brian Wed 14 May 2014

I pushed a fix changeset

In your build scripts you can add this to turn on test apidocs:

override Void onCompileFan(CompilerInput ci) { ci.docTests = true }

SlimerDude Wed 14 May 2014

That's brilliant! Thanks Brian.

Login or Signup to reply.