{"id":17289523,"url":"https://github.com/amolenaar/gradle-fitnesse-classpath-builder","last_synced_at":"2025-07-07T07:39:18.678Z","repository":{"id":66950708,"uuid":"21253120","full_name":"amolenaar/gradle-fitnesse-classpath-builder","owner":"amolenaar","description":"The simplest way to generate a FitNesse classpaths from a Gradle build file.","archived":false,"fork":false,"pushed_at":"2014-08-29T21:19:58.000Z","size":132,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-31T23:29:08.446Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Groovy","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amolenaar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-26T19:57:45.000Z","updated_at":"2018-02-16T12:11:24.000Z","dependencies_parsed_at":"2023-02-20T15:14:08.746Z","dependency_job_id":null,"html_url":"https://github.com/amolenaar/gradle-fitnesse-classpath-builder","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amolenaar%2Fgradle-fitnesse-classpath-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amolenaar%2Fgradle-fitnesse-classpath-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amolenaar%2Fgradle-fitnesse-classpath-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amolenaar%2Fgradle-fitnesse-classpath-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amolenaar","download_url":"https://codeload.github.com/amolenaar/gradle-fitnesse-classpath-builder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245708994,"owners_count":20659626,"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":[],"created_at":"2024-10-15T10:35:04.602Z","updated_at":"2025-03-26T18:17:05.128Z","avatar_url":"https://github.com/amolenaar.png","language":"Groovy","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gradle based classpath generation for FitNesse\n\nFitNesse is a well known tool for software acceptance testing. If you're using Gradle as your build tool of choice, it would be great to use Gradle to provide FitNesse a classpath for executing the acceptance tests. One way of doing so is to start FitNesse (preferable with a Gradle task) and use the [FitNesse Gradle classpath](http://github.com/kukido/fitnesse-gradle-classpath) plugin.\n\nIn this blog I'll show another way to achieve the same result by generating a wiki page, which can be included in your test suite.\n\nThe FitNesse wiki uses a simple file structure to store its page content. The directory name resembles the page name, the wiki markup is stored in a file named `content.txt` and metadata is stored in a file `properties.xml`. The approach we take is that we create a new page with class path directives. There's no need to consider the properties file, since it has some sensible defaults. All the page will contain lines formatted like `!path some/archive.jar`.\n\nLet's start with the task:\n\n```\nclass WriteFitNesseClasspath extends DefaultTask {\n  @Input\n  def classpath\n\n  @OutputDirectory\n  File pagePath\n\n  @TaskAction\n  def generatePage() {\n    def contentTxt = project.file(\"${pagePath}/content.txt\")\n    contentTxt.createNewFile()\n    contentTxt.withWriter { writer -\u003e\n      writer.writeLine(\"!path ${project.sourceSets.main.output.classesDir}\")\n      writer.writeLine(\"!path src/main/resources\")\n      classpath.each { d -\u003e\n        writer.writeLine(\"!path $d\")\n      }\n    }\n  }\n}\n```\n\nOf course this needs to be wired with a task that can be executed as part of the build cycle.\n\n```\ntask(\"writeFitNesseClasspath\", type: WriteFitNesseClasspath) {\n  classpath = project.configurations.fitnesse + configurations.runtime\n\n  pagePath = project.file(\"FitNesseRoot/GradleClasspath\")\n}\n\nproject.tasks.getByName(\"clean\").dependsOn(\"cleanWriteFitNesseClasspath\")\n\ntask(\"wiki\", type: JavaExec) {\n  dependsOn writeFitNesseClasspath\n  dependsOn compileJava\n  classpath configurations.fitnesse\n  main \"fitnesseMain.FitNesseMain\"\n  args \"-p\", \"8000\", \"-e\", \"0\"\n}\n\n\n```\n\nAt this point we have:\n\n1. A Gradle configuration that generates a FitNesse page\n2. A FitNesse page that does not do a thing...\n\nThe final step is to include the GradleClasspath page in the (toplevel) suite containing your acceptance tests. A simple `!include .GradleClasspath` should do the trick.\n\nA similar task to the wiki task can be created to execute the FitNesse suite as part of the build process: just change the `args`.\n\nA working example can be found at https://github.com/amolenaar/gradle-fitnesse-classpath-builder.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famolenaar%2Fgradle-fitnesse-classpath-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famolenaar%2Fgradle-fitnesse-classpath-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famolenaar%2Fgradle-fitnesse-classpath-builder/lists"}