The testGAMS R package serves to test GAMS code. It provides functions that manage GAMS invocation and output. These functions allow you to implement tests for GAMS in R. It is recommended to structure your tests using the testthat framework. This framework is used to test testGAMS
itself. The self-tests, contained in the tests/testthat
subdirectory, therefore also serve as examples of using testGAMS with testthat.
From an R or RStudio console, installing the testGAMS package is done as follows:
# Install the devtools package, if you have not done so already
install.packages("devtools")
# Install testGAMS development version from GitHub, it is not available on CRAN
devtools::install_github("iiasa/testGAMS")
This should also install all further required R packages other than gdxrrw which requires following a special installation procedure that depends on the operating system and R version that you are using.
In addition to the R packages listed in the DESCRIPTION
file, a GAMS installation is required.
Since GAMS tests require GAMS, online automated testing services such as TravisCI or GitHub Actions are not usable as they do not support GAMS. A local Jenkins deployment with access to a licensed GAMS installation is a good alternative. The testGAMS package itself is tested with Jenkins. See the Jenkinsfile
and Makefile
for an example of how this is done through a Jenkins pipeline.
Note that the testGAMS self-tests use JunitReporter to summarize the test results in JUnit XML format. This XML is ingested by the Jenkins JUnit plugin during the post stage of the Jenkins pipeline defined in the Jenkinsfile
to produce a test report that is browsable via the Jenkins web interface. Such automated test reporting is very helpful, and a good reason for using testthat together with Jenkins.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.