Files in the top-level directory from the latest check-in
- .gitignore
- bin
- resources
- src
- tests
- LICENSE
- project.clj
- publish
- README.md
itl
Integration Test Library
An experiment in writing executable documentation in Clojure.
Inspired by the SLIM Test System, it uses a Markdown parser to transform documents into an AST which can be executed by regular Clojure functions. Since we are not using classes and methods, but instead just functions, we couldn't port the SLIM protocol and write all our tests in FitNesse. This flexibility also allows us to deviate a bit from the norms enforced by thinking of test tables as instances of a class.
Project Test Results
This project is self-testing. We run this README file as part of every build.
Prerequisites
I have tested the entire build process using JDK 11
This project's version of Clojure requires at least Java 8.
You'll also need to install Leiningen
Building the project
The easiest thing to do is run ./prepare-release
to run all the project tests,
document generation, and linting. This is the best way to make sure your changes
work fine.
Other things you can do:
lein test
runs the itl tests printing full output- In a REPL you can run one or all itl tests using
itl.core/run
. There is sample code at the bottom ofitl.core
Getting
You can download the source code for itl from its Project Page
Getting Started
Coming soon.
Testing
This library tests itself! You can run: lein cli README.md
, which
should execute this document. If you use lein cli -- -h
you'll see
some options you can use.
!!! abstract "global:itl test suite" These are all the different tests for itl itself.
File | Result | Pass | Fail | Exception |
---|---|---|---|---|
tables.md | tables.html | 18 | 0 | 0 |
tags.md | tags.html | 0 | 0 | 0 |
[All ITL Tests (execute-pages: indir=tests, outdir=docs)]
Check out the itl.example
namespace as well as bin/test-all
for how
the documentation for this project was executed.
Making it Pretty
You'll notice this file is pretty nice looking! That's because we
used a nice simple CSS file. The default is in
resources/itl-md.css
You can specify your own CSS by passing the --css
flag to itl.cli
.
Table Types
See source code for more details on which tables you can put into your documents and what they do.
Tagging
You can tag a section of a document. Then, if you run itl.cli
with one
or more -t
or --tag
switches, followed by the name of the tag you
want to run, only the sections with the given tags, plus the global
tag, will be executed. You can see an example of how this is done in
source code.
Deprecated features
- As of
0.4.0
, Generative tables (gentable
andgenerative-table
) are deprecated. - As of
0.3.3
, AsciiDoc support is deprecated. This means no new features will be added to the AsciiDoc portion of the library, and at some future release it will be purged altogether.
Breaking changes
Upgrading from 0.4.* to 1.*
- All deprecated features are no longer present.
- Page-level operations, bindings, and assertions are no longer supported. All work must be done in executable tables now.
- The approach to working with tables has been rebuilt to be based on the SLIM model as closely as possible but in a functional context. Read this document closely to see how things have changed. See http://fitnesse.org/FitNesse.UserGuide.WritingAcceptanceTests.SliM to understand the inspiration. We are not using the SLIM protocol, but instead operating directly on MarkDown files.
Upgrading from 0.3.* to 0.4.*
- The 4-argument
run
function initl.core
has been removed. Use one of the other options. - The
CSS_FILE
environment variable has been replaced with the--css
switch initl.cli
-- you can useitl.markdown/with-css
on the REPL instead of using the environment variable.
Upgrading from 0.2.* to 0.3.*
The syntax for '<x'
variable interpolation has been removed completely.
Use {{x}}
instead, and don't worry about manually resolving it using
generated-var
. column-table
does the resolution for you.
Upgrading From 0.1.* to 0.2.*
- itl used to be quiet. It didn't print any status information. Now it
does. A lot. If you want it to be quiet again, pass the
--quiet
or-q
switch toitl.cli
- The
execute example files
table used to take anoutdir
, which was where it both looked for the examplemd
files to parse as well as where it writes its file calledexample-output.log
. Now, you would use anindir
parameter to specify heremd
files are found, anoutdir
parameter to specify where thehtml
files are written, and alogfile
parameter for where the output from running the files should go. If nologfile
is given, output will go to standard out. You must specify anindir
andoutdir
Contributing
If you have a contribution to make, you are welcome to! Send an email to stephen@calmabiding.me and we can have a conversation about how you like to contribute!
License
Copyright © 2022 Stephen Starkey
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.