{"id":25806014,"url":"https://github.com/alipsa/renjin-test-maven-plugin","last_synced_at":"2025-07-14T18:39:39.200Z","repository":{"id":57742882,"uuid":"164332661","full_name":"Alipsa/renjin-test-maven-plugin","owner":"Alipsa","description":"A maven plugin to execute R tests (hamcrest or testthat) in Renjin","archived":false,"fork":false,"pushed_at":"2024-10-07T07:21:40.000Z","size":82,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-28T02:45:27.467Z","etag":null,"topics":["maven-plugin","renjin"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Alipsa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["Alipsa"]}},"created_at":"2019-01-06T18:08:54.000Z","updated_at":"2024-10-07T07:21:37.000Z","dependencies_parsed_at":"2022-09-11T09:41:09.876Z","dependency_job_id":null,"html_url":"https://github.com/Alipsa/renjin-test-maven-plugin","commit_stats":null,"previous_names":["pernyfelt/renjin-hamcrest-maven-plugin","pernyfelt/renjin-test-maven-plugin"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/Alipsa/renjin-test-maven-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alipsa%2Frenjin-test-maven-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alipsa%2Frenjin-test-maven-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alipsa%2Frenjin-test-maven-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alipsa%2Frenjin-test-maven-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Alipsa","download_url":"https://codeload.github.com/Alipsa/renjin-test-maven-plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alipsa%2Frenjin-test-maven-plugin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264486695,"owners_count":23616108,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["maven-plugin","renjin"],"created_at":"2025-02-27T19:52:39.735Z","updated_at":"2025-07-14T18:39:39.171Z","avatar_url":"https://github.com/Alipsa.png","language":"Java","funding_links":["https://github.com/sponsors/Alipsa"],"categories":[],"sub_categories":[],"readme":"# renjin-test-maven-plugin\nPreviously called renjin-hamcrest-maven-plugin.\nA maven plugin to execute R tests using the Renjin ScriptEngine\n\nIt executes R Hamcrest and/or Testthat test located in src/test/R dir per default.\n\nSimple example test:\n```r\nlibrary(hamcrest)\n\ntest.successTest \u003c- function() {\n  print(\"running success test\")\n  assertTrue(TRUE)\n}\n```\nSee [Using the hamcrest package to write unit tests](http://docs.renjin.org/en/latest/writing-renjin-extensions.html#using-the-hamcrest-package-to-write-unit-tests)\nfor more info about Renjin Hamcrest.\n\n\nIt executes R Hamcrest test located in src/test/R dir per default.\nTestthat tests are also supported. \n\nIn some regards it is not as advanced as the test plugin in the renjin-maven-plugin e.g.\ntests are not forked and hence slightly slower; also a severely misbehaving test could crash the build but\nit does provide more developer friendly output saving you from having to analyze log output\nin the test result files. Also print() in the test will write to the console just like a\njunit test would do. \n\nTo use it, add the following to your maven build plugins section:\n\n```xml\n\u003cplugins\u003e\n  \u003cplugin\u003e\n    \u003cgroupId\u003ese.alipsa\u003c/groupId\u003e\n    \u003cartifactId\u003erenjin-test-maven-plugin\u003c/artifactId\u003e\n    \u003cversion\u003e1.3.6\u003c/version\u003e\n    \u003cconfiguration\u003e\n      \u003ctestFailureIgnore\u003etrue\u003c/testFailureIgnore\u003e\n    \u003c/configuration\u003e\n    \u003cexecutions\u003e\n      \u003cexecution\u003e\n        \u003cphase\u003etest\u003c/phase\u003e\n        \u003cgoals\u003e\n          \u003cgoal\u003etestR\u003c/goal\u003e\n        \u003c/goals\u003e\n      \u003c/execution\u003e\n    \u003c/executions\u003e\n    \u003cdependencies\u003e\n      \u003cdependency\u003e\n        \u003cgroupId\u003eorg.renjin\u003c/groupId\u003e\n        \u003cartifactId\u003erenjin-script-engine\u003c/artifactId\u003e\n        \u003cversion\u003e${renjin.version}\u003c/version\u003e\n        \u003cexclusions\u003e\n          \u003c!-- optional but needed if you use e.g.slf4j (then use the jcl bridge instead) --\u003e\n          \u003cexclusion\u003e\n            \u003cgroupId\u003ecommons-logging\u003c/groupId\u003e\n            \u003cartifactId\u003ecommons-logging\u003c/artifactId\u003e\n          \u003c/exclusion\u003e\n        \u003c/exclusions\u003e\n      \u003c/dependency\u003e\n      \u003cdependency\u003e\n        \u003cgroupId\u003eorg.renjin\u003c/groupId\u003e\n        \u003cartifactId\u003ehamcrest\u003c/artifactId\u003e\n        \u003cversion\u003e${renjin.version}\u003c/version\u003e\n      \u003c/dependency\u003e\n    \u003c/dependencies\u003e\n  \u003c/plugin\u003e\n\u003c/plugins\u003e\n```\n\nTo use the latest code, build it with `mvn clean install` and then add the plugin to your pom as follows:  \n\n```xml\n\u003cplugins\u003e\n  \u003cplugin\u003e\n    \u003cgroupId\u003ese.alipsa\u003c/groupId\u003e\n    \u003cartifactId\u003erenjin-test-maven-plugin\u003c/artifactId\u003e\n    \u003c!-- match the version with the version in the plugin pom --\u003e\n    \u003cversion\u003e1.3.6\u003c/version\u003e\n    \u003cconfiguration\u003e\n      \u003ctestFailureIgnore\u003etrue\u003c/testFailureIgnore\u003e\n    \u003c/configuration\u003e\n    \u003cexecutions\u003e\n      \u003cexecution\u003e\n        \u003cphase\u003etest\u003c/phase\u003e\n        \u003cgoals\u003e\n          \u003cgoal\u003etestR\u003c/goal\u003e\n        \u003c/goals\u003e\n      \u003c/execution\u003e\n    \u003c/executions\u003e\n    \u003cdependencies\u003e\n      \u003cdependency\u003e\n        \u003cgroupId\u003eorg.renjin\u003c/groupId\u003e\n        \u003cartifactId\u003erenjin-script-engine\u003c/artifactId\u003e\n        \u003cversion\u003e${renjin.version}\u003c/version\u003e\n        \u003cexclusions\u003e\n          \u003cexclusion\u003e\n            \u003cgroupId\u003ecommons-logging\u003c/groupId\u003e\n            \u003cartifactId\u003ecommons-logging\u003c/artifactId\u003e\n          \u003c/exclusion\u003e\n        \u003c/exclusions\u003e\n      \u003c/dependency\u003e\n      \u003cdependency\u003e\n        \u003cgroupId\u003eorg.renjin\u003c/groupId\u003e\n        \u003cartifactId\u003ehamcrest\u003c/artifactId\u003e\n        \u003cversion\u003e${renjin.version}\u003c/version\u003e\n      \u003c/dependency\u003e\n    \u003c/dependencies\u003e\n  \u003c/plugin\u003e\n\u003c/plugins\u003e\n```\nWhere ${renjin.version} is the version of Renjin you want to use e.g. 0.9.2719\n\n### Configuration\n- reportOutputDirectory \n    - where the test logs will be, default to \"${project.build.directory}/renjin-test-reports\"\n- testSourceDirectory \n    - where the test sources reside, defaults to \"${project.basedir}/src/test/R\n- testResourceDirectory\n    - where the test resources reside, defaults to \"${project.basedir}/src/test/resources\"   \n- testOutputDirectory\n    - where the tests will be executed from, defaults to \"${project.build.testOutputDirectory}\"   \n- skipTests\n    - Whether to skip tests altogether, defaults to false  \n- testFailureIgnore\n    - Whether to halt the build on the first failure encountered or not, defaults to false\n- runSourceScriptsBeforeTests\n    -Whether to run the R scripts in src/main/R prior to running tests (useful for non-package projects), \n    defaults for false.\n- sourceDirectory\n    - where the main R scripts are, defaults to \"${project.basedir}/src/main/R\"\n- printSuccess\n    - echo \"Success\" after each test is successful, defaults to false\n- replaceStringsWhenCopy\n    - replace string occurrences in the R scripts when they are copied from the src to target\n    this is useful if you created a plugin where the same code should work in both GNU R and Renjin \n    but you want to publish the renjin version with a group name you own instead of org.renjin.cran\n    and hence you need to change the call to library name in your tests\n    to include the group name (see example below). You can have as many \u003cproperty\u003e\u003c/property\u003e \n    blocks as you want.\n                   \nExample of overriding a few parameters:\n```xml\n    \u003cbuild\u003e\n        \u003cplugins\u003e\n            \u003cplugin\u003e\n                \u003cgroupId\u003ese.alipsa\u003c/groupId\u003e\n                \u003cartifactId\u003erenjin-test-maven-plugin\u003c/artifactId\u003e\n                \u003cversion\u003e1.3.6\u003c/version\u003e\n                \u003cconfiguration\u003e\n                    \u003coutputDirectory\u003etarget/test-harness/project-to-test\u003c/outputDirectory\u003e\n                    \u003ctestSourceDirectory\u003eR/test\u003c/testSourceDirectory\u003e\n                    \u003ctestFailureIgnore\u003etrue\u003c/testFailureIgnore\u003e\n                    \u003creplaceStringsWhenCopy\u003e\n                      \u003cproperty\u003e\n                        \u003cname\u003elibrary(xmlr)\u003c/name\u003e\n                        \u003cvalue\u003elibrary('se.alipsa:xmlr')\u003c/value\u003e\n                      \u003c/property\u003e\n                    \u003c/replaceStringsWhenCopy\u003e\n                \u003c/configuration\u003e\n                \u003cexecutions\u003e\n                  \u003cexecution\u003e\n                    \u003cphase\u003etest\u003c/phase\u003e\n                    \u003cgoals\u003e\n                      \u003cgoal\u003etestR\u003c/goal\u003e\n                    \u003c/goals\u003e\n                  \u003c/execution\u003e\n                \u003c/executions\u003e\n                \u003cdependencies\u003e\n                  \u003cdependency\u003e\n                    \u003cgroupId\u003eorg.renjin\u003c/groupId\u003e\n                    \u003cartifactId\u003erenjin-script-engine\u003c/artifactId\u003e\n                    \u003cversion\u003e${renjin.version}\u003c/version\u003e\n                    \u003cexclusions\u003e\n                      \u003cexclusion\u003e\n                        \u003cgroupId\u003ecommons-logging\u003c/groupId\u003e\n                        \u003cartifactId\u003ecommons-logging\u003c/artifactId\u003e\n                      \u003c/exclusion\u003e\n                    \u003c/exclusions\u003e\n                  \u003c/dependency\u003e\n                  \u003cdependency\u003e\n                    \u003cgroupId\u003eorg.renjin\u003c/groupId\u003e\n                    \u003cartifactId\u003ehamcrest\u003c/artifactId\u003e\n                    \u003cversion\u003e${renjin.version}\u003c/version\u003e\n                  \u003c/dependency\u003e\n                \u003c/dependencies\u003e\n            \u003c/plugin\u003e\n        \u003c/plugins\u003e\n    \u003c/build\u003e\n```\n\n# Generate a test report\nYou can use the surefire report plugin to generate a nice looking html report in the target/site dir.\nAdd something like the following to your maven pom:\n\n```xml\n\u003cplugins\u003e\n    \u003cplugin\u003e\n        \u003cgroupId\u003eorg.apache.maven.plugins\u003c/groupId\u003e\n        \u003cartifactId\u003emaven-surefire-report-plugin\u003c/artifactId\u003e\n        \u003cversion\u003e3.0.0-M5\u003c/version\u003e\n        \u003cconfiguration\u003e\n          \u003ctitle\u003eR Tests Report\u003c/title\u003e\n          \u003coutputName\u003etest-report\u003c/outputName\u003e\n          \u003creportsDirectories\u003e${project.build.directory}/renjin-test-reports\u003c/reportsDirectories\u003e\n          \u003clinkXRef\u003efalse\u003c/linkXRef\u003e\n        \u003c/configuration\u003e\n        \u003cexecutions\u003e\n          \u003cexecution\u003e\n            \u003cphase\u003etest\u003c/phase\u003e\n            \u003cgoals\u003e\n              \u003cgoal\u003ereport-only\u003c/goal\u003e\n            \u003c/goals\u003e\n          \u003c/execution\u003e\n        \u003c/executions\u003e\n    \u003c/plugin\u003e\n    \u003c!-- the site plugin will create formatting stuff e.g. css etc. --\u003e \n    \u003cplugin\u003e\n        \u003cgroupId\u003eorg.apache.maven.plugins\u003c/groupId\u003e\n        \u003cartifactId\u003emaven-site-plugin\u003c/artifactId\u003e\n        \u003cversion\u003e3.9.1\u003c/version\u003e\n        \u003cconfiguration\u003e\n          \u003cgenerateReports\u003efalse\u003c/generateReports\u003e\n        \u003c/configuration\u003e\n        \u003cexecutions\u003e\n          \u003cexecution\u003e\n            \u003cphase\u003etest\u003c/phase\u003e\n            \u003cgoals\u003e\n              \u003cgoal\u003esite\u003c/goal\u003e\n            \u003c/goals\u003e\n          \u003c/execution\u003e\n        \u003c/executions\u003e\n    \u003c/plugin\u003e\n\u003c/plugins\u003e\n```      \nThen run `mvn clean test site` or similar to generate the report\n\n# Testthat support\nThis plugin was originally completely targeted for hamcrest but I noticed that\nadding some level of support for testthat was easy so I decided to make this a \na renjin test plugin instead and add support for testthat.\n\nTestthat support is somewhat limited at this point. Basically i the plugin detects \nthe testthat structure it will execute only the testthat.R file and leave it to the \ntestthat package to handle. Since that is the case the reporting will not look wonderful - \nthe plugin will think that only one testfile was executed. But the reason for this is that\nusers might put all sorts of thing in the testthat.R file needed for bootstrapping everything\nso either execute this file only or run all the tests twice and have a nice report but terrible \nconsole output and unnecessary test executions. \n  \n# Executing both hamcrest and testthat tests\nIf you have both in one project you need to add an additional execution target:\n```xml   \n\u003cplugin\u003e\n\u003cgroupId\u003ese.alipsa\u003c/groupId\u003e\n\u003cartifactId\u003erenjin-test-maven-plugin\u003c/artifactId\u003e\n\u003cversion\u003e1.3.6\u003c/version\u003e\n\u003cexecutions\u003e\n  \u003cexecution\u003e\n    \u003cphase\u003etest\u003c/phase\u003e\n    \u003cid\u003etestthat\u003c/id\u003e\n    \u003cgoals\u003e\n      \u003cgoal\u003etestR\u003c/goal\u003e\n    \u003c/goals\u003e\n    \u003cconfiguration\u003e\n      \u003ctestFailureIgnore\u003etrue\u003c/testFailureIgnore\u003e\n      \u003ctestSourceDirectory\u003e${project.basedir}/tests\u003c/testSourceDirectory\u003e\n    \u003c/configuration\u003e\n  \u003c/execution\u003e\n  \u003cexecution\u003e\n    \u003cid\u003ehamcrest\u003c/id\u003e\n    \u003cphase\u003etest\u003c/phase\u003e\n    \u003cgoals\u003e\n      \u003cgoal\u003etestR\u003c/goal\u003e\n    \u003c/goals\u003e\n    \u003cconfiguration\u003e\n      \u003ctestFailureIgnore\u003etrue\u003c/testFailureIgnore\u003e\n      \u003ctestSourceDirectory\u003e${project.basedir}/src/test/R\u003c/testSourceDirectory\u003e\n    \u003c/configuration\u003e\n  \u003c/execution\u003e\n\u003c/executions\u003e\n\u003cdependencies\u003e\n  \u003cdependency\u003e\n    \u003cgroupId\u003eorg.renjin\u003c/groupId\u003e\n    \u003cartifactId\u003erenjin-script-engine\u003c/artifactId\u003e\n    \u003cversion\u003e${renjin.version}\u003c/version\u003e\n    \u003cexclusions\u003e\n      \u003cexclusion\u003e\n        \u003cgroupId\u003ecommons-logging\u003c/groupId\u003e\n        \u003cartifactId\u003ecommons-logging\u003c/artifactId\u003e\n      \u003c/exclusion\u003e\n    \u003c/exclusions\u003e\n  \u003c/dependency\u003e\n  \u003cdependency\u003e\n    \u003cgroupId\u003eorg.renjin\u003c/groupId\u003e\n    \u003cartifactId\u003ehamcrest\u003c/artifactId\u003e\n    \u003cversion\u003e${renjin.version}\u003c/version\u003e\n  \u003c/dependency\u003e\n  \u003cdependency\u003e\n    \u003cgroupId\u003eorg.renjin.cran\u003c/groupId\u003e\n    \u003cartifactId\u003etestthat\u003c/artifactId\u003e\n    \u003cversion\u003e2.1.1-b2\u003c/version\u003e\n  \u003c/dependency\u003e\n  \u003cdependency\u003e\n    \u003cgroupId\u003eorg.slf4j\u003c/groupId\u003e\n    \u003cartifactId\u003eslf4j-log4j12\u003c/artifactId\u003e\n    \u003cversion\u003e1.7.30\u003c/version\u003e\n  \u003c/dependency\u003e\n  \u003cdependency\u003e\n    \u003cgroupId\u003eorg.slf4j\u003c/groupId\u003e\n    \u003cartifactId\u003ejcl-over-slf4j\u003c/artifactId\u003e\n    \u003cversion\u003e1.7.30\u003c/version\u003e\n  \u003c/dependency\u003e         \n\u003c/dependencies\u003e\n\u003c/plugin\u003e\n``` \n\n# Version history\n\n### 1.3.6\n- Add option for filter copy (replace strings in the R code) for tests\n\n### 1.3.5\n- upgrade junit, commons-io, commons-lang3 and maven plugins\n- add auto codescan\n\n### 1.3.4\n- copy full content of testResourceDirectory\n\n### 1.3.3\n- Minor fix: honor the -DskipTest as well as true property.\n\n### 1.3.2\n- fix bug where R files in test/resources was deleted from test-classes output dir. \n- Bump up ioutils version.\n\n### 1.3.1\n- Fix bug in the cleanup that was deleting everything which prevents java tests from working. Now only removes R and S files\n\n### 1.3\n- Added basic support for testthat.\n- Renamed artifact to reflect change of purpose.\n- Enhanced docs.\n\n### 1.2\n- move session creation to after classloader has been configured\n- set working dir for src R scripts to where the script is located\n- enable execution of src R code prior to tests to support non-package testing scenarios.\n- make logging implementation classes provide\n- skip execution if no test files found\n- remove dependency on renjin core.\n- bumped up dependency versions, fix failure if no R test sources exists\n\n### 1.1\n- Minor fixes such as removing some printlines and adding total time to console output.\n\n### 1.0-final\ninitial release\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falipsa%2Frenjin-test-maven-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falipsa%2Frenjin-test-maven-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falipsa%2Frenjin-test-maven-plugin/lists"}