{"id":15954049,"url":"https://github.com/uhafner/karatest","last_synced_at":"2026-01-30T09:05:35.544Z","repository":{"id":11346497,"uuid":"13776020","full_name":"uhafner/karatest","owner":"uhafner","description":"JUnit Adapter to test JavaKara programs","archived":false,"fork":false,"pushed_at":"2023-01-19T04:01:35.000Z","size":443,"stargazers_count":0,"open_issues_count":7,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T08:16:08.536Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","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/uhafner.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":"2013-10-22T14:34:38.000Z","updated_at":"2021-03-21T17:23:49.000Z","dependencies_parsed_at":"2023-02-10T20:05:12.576Z","dependency_job_id":null,"html_url":"https://github.com/uhafner/karatest","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/uhafner/karatest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uhafner%2Fkaratest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uhafner%2Fkaratest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uhafner%2Fkaratest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uhafner%2Fkaratest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uhafner","download_url":"https://codeload.github.com/uhafner/karatest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uhafner%2Fkaratest/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260072819,"owners_count":22954926,"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-07T13:15:17.067Z","updated_at":"2026-01-30T09:05:35.506Z","avatar_url":"https://github.com/uhafner.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Testing GreenfootKara Programs\n==============================\n\n[GreenfootKara](http://code.makery.ch/library/greenfoot-kara/) programs are only runnable using the integrated \ndevelopment environment [Greenfoot](www.greenfoot.org/) with manual interaction. **KaraTest** adds a unit test feature \nfor GreenfootKara programs. Using this extension, you can create simple [JUnit](http://junit.org/) tests to validate\nexisting GreenfootKara programs. You can start these unit tests either in an arbitrary development environment \n(e.g., IntelliJ, Eclipse, ...) or in a terminal using the build management tool [Maven](http://maven.apache.org/). \nAll you need is to deploy your scenarios and tests into the proposed folders of this project. \nGreenfoot is **not** required to start and evaluate these tests: all dependencies to Greenfoot are replaced with a \nmock that is intercepting calls to Greenfoot.\n\nAdditionally, static code analysis has been configured so that the code could be checked for common bug patterns \n(FindBugs), for coding style violations (CheckStyle), and for conformance to best practices (PMD). \nThe configuration of these tools is derived from [my Java coding style](https://github.com/uhafner/codingstyle) \n(currently available in German only).\n\nThis project has been used in my lecture **Software development with Java** to automatically evaluate the solutions of \nweekly assignments. Because of this I applied several naming conventions to simplify the processing. These naming \nconventions are not required to use **KaraTest** as a library, so feel free to change these values if required.\n\nThis project requires installation of [JDK 8](http://www.java.com) und [Maven 3.x](http://maven.apache.org/).\n\n## Configuring the scenarios\n\n**KaraTest** basically uses the same input files as Greenfoot, i.e. it is based on scenarios. Rather then always using \nthe class `MyKara` to develop the solution for a scenario the classes `Assignment1`, `Assignment2`, etc. are used.  In \norder to test a scenario you need a corresponding GreenfootKara scenario with such an assignment class. These \nscenarios must be located in the folder `scenarios`. They follow the naming convention assignment1, assignment2, etc.\nScenarios are independent of each other, i.e. you can copy these folders to or from any place you\nlike in order to prepare the installation.\n\n## Creating the tests \n\nThe tests of a scenario use the typical [JUnit](http://junit.org/) naming conventions and are named \nAssignment1Test.java, Assignment2Test.java, etc. For each assignment multiple tests could be specified\nusing a `public void` method with an `@Test` annotation. In order to get these tests automatically evaluated, they \nmust follow the Maven conventions and must be copied to the folder [src/test/java](../master/src/test/java). Tests \n(as well as the actual assignments) are located in the default package. The tests are not part of a scenario folder.\n \n## Example scenario\n \nAn example is available that shows the basic concepts of this project: [assignment0](../master/scenarios/assignment0). \nHere you can see how to structure the scenarios. A unit test is available as well:\n[Assignment0Test](../master/src/test/java/Assignment0Test.java). \nIn this assignment, a world containing a diamond needs to be created. The provided unit test checks the program\nby inspecting the created world after the program. (All examples start with an empty world. Have a look at the various\nverifyWorld methods in [AbstractKaraTest](../master/src/main/java/AbstractKaraTest.java) to see on how to start with \nan existing world). Note that the unit tests will fail after a given timeout has been exceeded. So the evaluation will \nnot hang due to broken solutions. \n \n## Running the tests \n\nYou can start the tests for all scenarios in a terminal using the following command:\n\n```\n  mvn clean test\n```\n\n## Running the static analysis\n\nYou can generate various project reports in a terminal using the following command:\n \n```\n  mvn clean test -Dmaven.test.failure.ignore=true site\n```\n\nYou can visit the generated reports in the browser afterwards: just navigate to the index file in the output folder \n`target/site/index.html`. \n\n## Note\n\nIn order to validate only classes of the actual assignments, the files Assignment1.java, Assignment2.java, etc. \nare copied from the folder `scenarios` to the folder `target/copied-assignments` during execution of Maven. \nI.e. in folder `target/copied-assignments` only the actual assignment classes are visible, the dependencies \nare not available here. Do not edit these files, since they will be overridden during the next run of Maven. \nAlso, if you open a scenario in the folder `scenarios` with Greenfoot then the containing files are automatically \nupdated by Greenfoot, i.e. these files might be not in sync anymore with the files in \nfolder `target/copied-assignments`!\n\n## License\n\nAll source code in folder [src](../master/src/) is copyrighted by Ullrich Hafner and licensed under the \n[MIT license](http://opensource.org/licenses/MIT).\n\nThe original source code of GreenfootKara 2.2.1 in the examples scenarios is copyrighted by \n[Marco Jakob](http://code.makery.ch).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuhafner%2Fkaratest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuhafner%2Fkaratest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuhafner%2Fkaratest/lists"}