Chapter 10
Preferred usage, Test Concepts and Tests

This software may be used in different environments, is highly configurable and also there is a huge amount of packages potentially in use.

In order not to get lost in extensive tests for covering all and everything, the author applies the notion of preferred usage. This is essentially the way the author uses this software. This is also what is tested extensively. Other ways of usage are supported insofar as reported bugs are fixed in general, but since explicit tests lack, the quality is lower for these cases.

The preferred usage is defined as follows:

It is the “founded conviction” of the author, that in most of the use cases, restriction to the preferred usage is possible but when deviating, there is some increased risk that there is a bug in this LaTeX builder.

The set of documents coming with this software are compiled sticking to the preferred usage. Above all, this manual [Rei] not only describes all vital features, but also uses them, with one big exception: Its document class is book, and it cannot have other document classes of course. Most other documents are articles and [Rei23a] refers to a presentation with class beamer and to the according handout which is again an article. So the build process for these documents altogether cover the preferred usage to a wide extent. Thus, a bug in this LaTeX builder is likely to be reflected in a deficiency in the compiled version of one of these documents.

This shows that testing the compiled documents is a reasonable test strategy. It is not feasible to do this manually for whole documents, and it is also technically close to impossible to do it automatically. What can be checked automatically is coincidence with the last document.

So the strategy is to either change the (source of the) software or the source of the documents, but never both at once. If the software is changed, the created documents must persist. Changes in the manual are locally in the sources and result in local changes in the compiled document, because the software was not changed. Thus, the compiled document can be checked manually. Since the only output format being part of the preferred usage is PDF, only compilations into PDF must be taken into account.

Section 5.8 describes how this LaTeX builder can perform an equality check on PDF documents. There, both Section 6.13 on parameters for equality check is referenced and Table 7.7 comprising build failures if the documents do not coincide. We highlight the parameter chkDiff which determines whether the check is performed and build failures TLP01 thrown if the documents differ. In tests, chkDiff is set true, the default is false.

Although this test concept seems appealing, it is not always easy to realize.

Before explaining the difficulties, let us differentiate between the two ways the pom of this plugin uses this plugin itself. The pom for performing tests is based on pom4pdf.xml, not on the actual pom.xml of the project a version of which is on github. For pom4pdf.xml, the current version is determined by filtering, which remains correct even during the release process. In addition, the project pom.xml used for development contains another, explicit dependency to latex-maven-plugin. This one is used for creating the documents for the site and also for developer tests. Thus, during development pom.xml is kept close to pom4pdf.xml, and it has a snapshot version x.y.0-SNAPSHOT.

Let us first consider the case of development in which the version of this plugin is a SNAPSHOT version. Then tests refer to the (snapshot) version under consideration. If a change is made to the documents and all tests pass, the changed documents are compiled with current software, and go into the next snapshot deployed. To be precise, the documents are compiled with deployed software, which is equivalent with the software compiled from the current sources.

If in contrast the software is changed, keeping the manual unchanged, then still compilation of the documents and also check is performed with the deployed version of this latex-maven-plugin. So, to decide whether the documents remain the same after the software change, a second build must be performed, because this compiles with the newly deployed snapshot of this software.

The situation is even more complicated if development is finished for the current version and a new release must be built. As is state of the art, for this task the maven-release-plugin is used. It requires for sake of reproducibility, that the pom of the project, not the pom has dependencies and plugins only in release versions, no snapshot versions.

As is state of the art, for release the maven-release-plugin is used. Whereas it has no explicit restrictions on the pom for tests pom4pdf.xml, it requires for sake of reproducibility, that the pom of the project pom.xml has dependencies and plugins only in release versions, no snapshot versions. This applies also to this plugin. For development, it has version x.y.0-SNAPSHOT to deploy x.y.0, and this is also the version one wants to create a site with, but this is the one to released at present. A possible fallback is always to deactivate the usage of this plugin. As a consequence, later a version x.y.1 shall be released, which uses x.y.0 for site creation. Better is to use the last release version and to configure it so that the documents can be compiled with the old version. This may require a creative release planning, including features used to compile documentation and maybe a change in the parameters or some other change in the environment, which must be compensated in later releases also.

Let us give examples of creative realizations of the described test concept relying on thorough release planning. To release 2.0.0 starting with the prior version 1.8.0, almost only injections are added. These can be done manually using 2.0.0-SNAPSHOT. Then the injected files are checked in into version control and then the documentation can be compiled with old version 1.8.0 with the same result. In a release 2.0.1, version 1.8.0 can be replaced by 2.0.0.

For version 2.1.0 it is planned, that this plugin can use latexmk, and in the manual this is also described. In 2.1.0-SNAPSHOT the manual may be compiled using latexmk, but nevertheless, in 2.1.0 the manual is still compiled without latexmk, using release 2.0.0 for creating the manual for the site. Only in 2.1.1, also the manual is included in the site using latexmk.

For version 2.2.0 it is planned, to support bib2gls directly. Observe that 2.1.0 supports can treat bib2gls via latexmk, but without all the monitoring 2.2.0 offers with direct support. Of course, the manual describes direct support and some 2.2.0-SNAPSHOT is able to compile the manual using bib2gls directly. Nevertheless, close to release for site creation, 2.1.0 is used again relying on latexmk to invoke bib2gls. In 2.2.1 then 2.2.0 can be used for site creation invoking bib2gls directly.

Note that the test concept based on preferred usage has a considerable weakness: It cannot test warnings, errors and exceptions because they are not preferred usage. On the other hand, it is an important design goal, that the result of this software is trustable if no warning, error or exception occurs. This requires extensive tests also on imperfect runs. These must be supplemented in the future.

FIXME: this chapter describes the tests to be performed.

Missing are tests on logging, tests on various input formats, output formats, tests including several paths defined by invocation of auxiliary applications for index, glossary, …