{"id":18422500,"url":"https://github.com/sri-csl/descert-example","last_synced_at":"2026-03-19T04:18:47.224Z","repository":{"id":48478635,"uuid":"311472247","full_name":"SRI-CSL/descert-example","owner":"SRI-CSL","description":"a place where we can play with DesCert gradle plugins","archived":false,"fork":false,"pushed_at":"2023-12-07T21:58:49.000Z","size":125739,"stargazers_count":0,"open_issues_count":3,"forks_count":1,"subscribers_count":17,"default_branch":"main","last_synced_at":"2025-04-13T15:43:25.679Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SRI-CSL.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-09T21:42:04.000Z","updated_at":"2021-03-31T03:09:19.000Z","dependencies_parsed_at":"2023-12-07T22:41:54.177Z","dependency_job_id":null,"html_url":"https://github.com/SRI-CSL/descert-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SRI-CSL/descert-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SRI-CSL%2Fdescert-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SRI-CSL%2Fdescert-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SRI-CSL%2Fdescert-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SRI-CSL%2Fdescert-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SRI-CSL","download_url":"https://codeload.github.com/SRI-CSL/descert-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SRI-CSL%2Fdescert-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28698893,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T17:25:48.045Z","status":"ssl_error","status_checked_at":"2026-01-23T17:25:47.153Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-11-06T04:30:30.271Z","updated_at":"2026-01-23T19:33:00.575Z","avatar_url":"https://github.com/SRI-CSL.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Baseline DesCert Example\n## Using Daikon and Randoop Gradle Plugins\n\n[![License](https://img.shields.io/badge/license-apache%202.0-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0)\n\nThe goal of this repo is to show how to generate evidence with Baseline DesCert's Gradle plugins as part \nof this repos' own build process. Only Randoop and Daikon tasks are currently supported. These tasks\nuse Randoop 4.2.3 and Daikon 5.8.6.\n\n## 1. Prereqs\n\n### Docker\nIf you have not set up Docker on your computer yet, follow Docker's instructions to install Docker:\nhttps://docs.docker.com/get-docker/\n\n**Important Note:** If you are not using Docker, and want to build this project on your own machine, then\nyou need Java 8+ in order to build this repo and use both the Randoop and Daikon tasks. In this README, we \nassume you are using Docker and the Docker image we are about to build for this repo. \n\n### GitHub repository\n\nClone the `descert-example` repo, if you have not done so:\n\n```sh\n› git clone http://github.com/SRI-CSL/descert-example.git\n› cd descert-example\n```\n\n## 2. Configuration\n\n### Plugins configuration\n\n#### Add Gradle plugins to `build.gradle` file.\n\nOpen the `build.gradle` file and then add the following extension object:\n\n```groovy\nplugins {\n    id 'java'\n    id 'maven-publish'\n\tid 'com.sri.gradle.daikon' version '0.0.2-SNAPSHOT'\n\tid 'com.sri.gradle.randoop' version '0.0.1-SNAPSHOT'\n}\n```\n\nThe first two entries add tasks for building Java projects and tasks for publishing build artifacts to an \nApache Maven repository. The last two entries add tasks for executing both Daikon and Randoop tools. \n\n#### Configure Randoop and Daikon plugins\n \nNext, we configure the Randoop and Daikon plugins by adding the following extension objects:\n\n```groovy\n// Randoop plugin configuration\nrunRandoop {\n    randoopJar = file(\"libs/randoop.jar\")\n    junitOutputDir = file(\"${projectDir}/src/test/java\")\n    timeoutSeconds = 30\n    stopOnErrorTest = false\n    flakyTestBehavior = 'output'\n    noErrorRevealingTests = true\n    junitReflectionAllowed = false\n    usethreads = true\n    outputLimit = 2000\n    junitPackageName = 'com.foo'\n}\n\n// Daikon plugin configuration\nrunDaikon {\n    requires = file(\"libs\")\n    outputDir = file(\"${projectDir}/build/daikon-output\")\n    testDriverPackage = \"com.foo\"\n}\n```\n\n#### Manage plugins discovery\n\nLastly, we update the `settings.gradle` to make sure this repo knows where to look\nfor the Randoop and Daikon plugins, or any other plugins you have specified in the `build.gradle` file:\n\n```groovy\npluginManagement {\n    repositories {\n        mavenLocal()\n        gradlePluginPortal()\n    }\n}\n```\n\nIf the plugins have not published to either Maven Central or Gradle plugin portal, you can still use a locally-built version of the Randoop and Daikon plugins. All you have to do is the following:\n\n```sh\n› git clone http://github.com/SRI-CSL/\u003ctool\u003e-gradle-plugin.git\n› cd \u003crandoop|daikon\u003e-gradle-plugin\n› ./gradlew build\n› ./gradlew publishToMavenLocal\n```\n\nwhere `tool` is either `randoop` or `daikon`.\n\n### Docker configuration\n\n#### (Option 1) Build your own Docker image\n\nWe assume you have already cloned the `descert-example` repo and also have changed your\nyour working director to `descert-example`.\n\nFrom your terminal, build the `vesperin/randoop-4-2-3-daikon-5-8-6-amzn-alpine-full` Docker image by executing the\nfollowing command:\n\n```sh\nin descert-example/\n› docker build -t vesperin/randoop-4-2-3-daikon-5-8-6-amzn-alpine-full -f docker/Dockerfile .\n```\n\nIf everything went ok, then your new docker image would be listed on the available docker images list. \nFrom your terminal, execute the `docker images` command to show a few details of your new docker image:\n\n```sh\n› docker images\nREPOSITORY                              \t\t\t\tTAG             IMAGE ID\tCREATED        SIZE\nvesperin/randoop-4-2-3-daikon-5-8-6-amzn-alpine-full   \tlatest          \u003cID\u003e   \t22 hours ago   1.13GB\namazoncorretto                          \t\t\t\t8-alpine-full   \u003cID\u003e   \t5 days ago     201MB\n```\n\nThe [docker/Dockerfile](docker/Dockerfile) you used in the previous command contains all the commands a user could run on the command line to assemble the `vesperin/randoop-4-2-3-daikon-5-8-6-amzn-alpine-full` image.\nIn more detail, using the commands specified in this Dockerfile, Docker will\n\n\n1. Install all the necessary dependencies to build `descert-example`,\n2. Clone the [randoop-gradle-plugin](https://github.com/SRI-CSL/randoop-gradle-plugin.git) repository,\n3. Build the Randoop plug-in, as well as publish it to `Maven local`.\n4. Clone the [daikon-gradle-plugin](https://github.com/SRI-CSL/daikon-gradle-plugin.git) repository,\n5. Build the Daikon plug-in, as well as publish it to `Maven local`.\n\nWith the Randoop and Daikon plugins published to `Maven local`, Docker will\n\n1. Build the `descert-example` repository,\n2. Execute the `randoopEvidence`, `runDaikon`, and `daikonEvidence` tasks.\n\nAll evidence files will be generated after executing step 2.\n\n#### (Option 2) Getting Docker image from Docker Hub\n\nFrom your terminal, run the following command:\n\n#### 1. Pull `vesperin/randoop-4-2-3-daikon-5-8-6-amzn-alpine-full` Docker image from _Docker Hub_\n\n```sh\n› docker pull vesperin/randoop-4-2-3-daikon-5-8-6-amzn-alpine-full\n```\n\n## 3. Docker container\n\nStart a new `bash` shell in a new `vesperin/randoop-4-2-3-daikon-5-8-6-amzn-alpine-full` container\n\n```sh\n› docker run --rm -it vesperin/randoop-4-2-3-daikon-5-8-6-amzn-alpine-full /bin/bash\n```\n\nAt this point, you could explore the results of a single execution of the Randoop and Daikon plugins by\nlooking at any of the following files:\n\n### Randoop evidence\n\n- `randoop-summary.txt`\n- `randoop-evidence.json`\n-  `RandoopTestsAndMetrics.csv`\n-  `RandoopJUnitTestGeneration.csv`\n-  `RandoopToolQualification.csv`\n\n\n### Daikon Evidence\n\n-  `daikon-evidence.json`\n-  `DaikonInvsAndMetrics.csv`\n-  `DaikonPluginConfig.csv`\n-  `DaikonPluginQualification.csv`\n\n\n### Evidence (files) Examples\n\nFor example, here is the content of `randoop-evidence.json` and `daikon-evidence.json` files:\n\n```json\n{\n  \"Evidence\": {\n    \"RandoopJUnitTestGeneration\": {\n      \"INVOKEDBY\": \"RandoopGradlePlugin\",\n      \"AUTOMATEDBY\": \"RandoopGradlePlugin\",\n      \"PARAMETERS\": \"[--time-limit:30, --flaky-test-behavior:output, --output-limit:2000, --usethread:true, --no-error-revealing-tests:true, --stop-on-error-test:false, --junit-reflection-allowed:false, --junit-package-name:com.foo, --junit-output-dir:src/test/java]\"\n    },\n    \"RandoopToolQualification\": {\n      \"RANDOOP_VERSION\": \"4.2.3\",\n      \"DATE\": \"2020-03-31\",\n      \"SUMMARY\": \"Runs the Randoop Tool\",\n      \"QUALIFIEDBY\": \"SRI International\",\n      \"INSTALLATION\": \"https://github.com/SRI-CSL/randoop-gradle-plugin/blob/master/README.md\",\n      \"USERGUIDE\": \"https://github.com/SRI-CSL/randoop-gradle-plugin/blob/master/README.md\",\n      \"RANDOOP_PLUGIN_VERSION\": \"0.1\",\n      \"TITLE\": \"RandoopGradlePlugin\",\n      \"ACTIVITY\": \"TestGeneration\"\n    },\n    \"RandoopTestsAndMetrics\": {\n      \"BRANCH\": \"master\",\n      \"EXPLORED_CLASSES\": \"2\",\n      \"COMMIT\": \"6fb16d1\",\n      \"PUBLIC_MEMBERS\": \"6\",\n      \"NORMAL_EXECUTIONS\": \"314804\",\n      \"REGRESSION_TEST_COUNT\": \"885\",\n      \"ERROR_REVEALING_TEST_COUNT\": \"0\",\n      \"AVG_EXCEPTIONAL_TERMINATION_TIME\": \"0.224\",\n      \"MEMORY_USAGE\": \"4647MB\",\n      \"EXCEPTIONAL_EXECUTIONS\": \"0\",\n      \"GENERATED_TEST_FILES_COUNT\": \"3\",\n      \"AVG_NORMAL_TERMINATION_TIME\": \"0.0572\",\n      \"GENERATED_TEST_FILES\": [\n        \"src/test/java/com/foo/RegressionTest0.java\",\n        \"src/test/java/com/foo/RegressionTest1.java\",\n        \"src/test/java/com/foo/RegressionTestDriver.java\"\n      ],\n      \"CHANGES\": \"local\",\n      \"INVALID_TESTS_GENERATED\": \"0\",\n      \"NUMBEROFTESTCASES\": \"885\"\n    }\n  }\n}\n```\n\n```json\n{\n  \"Evidence\": {\n    \"DaikonPluginConfig\": {\n      \"OUTPUT_DIR\": \"build/daikon-output\",\n      \"TEST_DRIVER_PACKAGE\": \"com.foo\"\n    },\n    \"DaikonPluginQualification\": {\n      \"DATE\": \"2021-3-30\",\n      \"SUMMARY\": \"Runs the Daikon Tool\",\n      \"QUALIFIEDBY\": \"SRI International\",\n      \"INSTALLATION\": \"https://github.com/SRI-CSL/daikon-gradle-plugin/blob/master/README.md\",\n      \"USERGUIDE\": \"https://github.com/SRI-CSL/daikon-gradle-plugin/blob/master/README.md\",\n      \"TITLE\": \"DaikonGradlePlugin\",\n      \"ACTIVITY\": \"Dynamic Analysis\"\n    },\n    \"DaikonInvsAndMetrics\": {\n      \"CORES\": \"16\",\n      \"JVM_MEMORY_LIMIT_IN_BYTES\": \"477626368\",\n      \"SUPPORT_FILES\": [\n        \"build/daikon-output/RegressionTestDriver.dtrace.gz\",\n        \"build/daikon-output/RegressionTestDriver.decls-DynComp\",\n        \"build/daikon-output/RegressionTestDriver.inv.gz\"\n      ],\n      \"PP_COUNT\": \"5\",\n      \"INVARIANTS_FILE\": \"build/daikon-output/RegressionTestDriver.inv.txt\",\n      \"MEMORY_AVAILABLE_TO_JVM_IN_BYTES\": \"432013312\",\n      \"CLASSES_COUNT\": \"1\",\n      \"TEST_DRIVER\": \"src/test/java/com/foo/RegressionTestDriver.java\",\n      \"TESTS_COUNT\": \"4\",\n      \"INVARIANT_COUNT\": \"0\"\n    }\n  }\n}\n```\n\n\n## Task description\n\n### Randoop tasks\n\nCurrently, we support the following Gradle tasks on the Randoop Gradle Plugin:\n\n`randoopEvidence` - Produces an evidence artifact containing the specific details of the Randoop execution.\n`generateTests` - Generates tests for a given project using Randoop (Main task).\n`generateClassListFile` - Generates a file that lists classes that Randoop will explore to generate tests.\n`cleanupRandoopOutput` - Deletes all Randoop-generated tests.\n`checkForRandoop` - Checks if Randoop is in CLASSPATH.\n\nThe ordering of the above tasks is intented to show some dependencies between tasks. \nFor example, in order to perform the `generateClassListFile`, you must perform `cleanupRandoopOutput`\nand `checkForRandoop` first (in that order).\n\nYou can run any of the above Gradle tasks using the `gradlew` command. For example, to generate unit tests for this repo, execute the `generateTests` task from your terminal:\n\n```sh\n› ./gradlew generateTests\n```\n\n### Daikon Gradle tasks\n\nThe Daikon plugin support the following tasks: \n\n- `daikonEvidence` - Produces an evidence artifact containing the specific details of the Daikon execution.\n- `runDaikon` - Detection of likely program invariants using Daikon (Main task).\n- `generateTestDriverCode` - Generates test driver code that Daikon can execute (Optional task).\n- `daikonCheck` - Checks if Daikon is in your project's classpath.\n\n**Test driver trigger*\n\n-   `-Pdriver` - Tells the plugin to invoke `generateTestDriverCode` task. When finished, it places the generated test driver at `build/driver` directory.\n\nIf `-Pdriver` is not provided, then the plugin assumes there is already test driver it can use with Daikon.\nFor example, the following commands will generate a test driver before invoking the `daikonEvidence` task:\n\n```sh\n› ./gradlew daikonEvidence -Pdriver\n```\n\n## License\n\n    Copyright (C) 2020 SRI International\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsri-csl%2Fdescert-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsri-csl%2Fdescert-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsri-csl%2Fdescert-example/lists"}