{"id":17195961,"url":"https://github.com/npryce/worktorule","last_synced_at":"2025-04-13T20:41:38.273Z","repository":{"id":30860735,"uuid":"34418289","full_name":"npryce/worktorule","owner":"npryce","description":"Manage test lifecycle by correlating failures with contents of an issue tracker.","archived":false,"fork":false,"pushed_at":"2016-04-10T12:15:48.000Z","size":139,"stargazers_count":12,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T11:02:36.918Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/npryce.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}},"created_at":"2015-04-22T22:00:14.000Z","updated_at":"2018-12-10T20:31:47.000Z","dependencies_parsed_at":"2022-09-05T13:10:31.583Z","dependency_job_id":null,"html_url":"https://github.com/npryce/worktorule","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npryce%2Fworktorule","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npryce%2Fworktorule/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npryce%2Fworktorule/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npryce%2Fworktorule/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/npryce","download_url":"https://codeload.github.com/npryce/worktorule/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248782261,"owners_count":21160716,"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-15T01:51:58.464Z","updated_at":"2025-04-13T20:41:38.243Z","avatar_url":"https://github.com/npryce.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Work to Rule\n============\n\n[![Build Status](https://travis-ci.org/npryce/worktorule.svg)](https://travis-ci.org/npryce/worktorule)\n[![Maven Central](https://img.shields.io/maven-central/v/com.natpryce/worktorule.svg?maxAge=2592000)](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.natpryce%22%20AND%20a%3A%22worktorule%22)\n\nManage test lifecycle by correlating failures with contents of an issue tracker.\n\nWork to Rule lets you mark tests as in progress and associate them with issues in an issue tracker.  Work to Rule\nwill report failing, in progress tests as skipped while the issue is open, and report failures as normal if they\nreoccur after the issue is closed.\n\nThis lets you follow an acceptance-test driven development process \n(as described in [Growing Object Oriented Software, Developed by Tests](http://www.growing-object-oriented-software.com) \nand other books) in which you start by writing acceptance tests that fail, and then implement the functionality with \n(Unit) TDD until the acceptance tests pass.\n\nIt is also useful for associating contract tests that detect failures in third-party libraries or services with\nissues in the vendor's issue tracker.\n\nRequires:\n\n - Java (8+)\n - JUnit\n\nAvailable in Maven Central as [com.natpryce:worktorule:\\\u003cversion\\\u003e](http://search.maven.org/#browse%7C542918654)\n\n\nQuick Start\n-----------\n\nLet's say you have written a failing acceptance test for a new feature:\n\n~~~~~~~~~~~~~~~~~~~~~java\npublic class ExampleAcceptanceTest {\n    @Test\n    public void everything_is_awesome() {\n        assertThat(everything.awesomeness(), equalTo(1.0));\n    }\n}\n~~~~~~~~~~~~~~~~~~~~~\n\nAt this stage, the test is used for tracking development, not detecting regressions. You want to check the test in to your project, but you don't want it to break the build while you're working on the feature. \n\nFirst, add the [IgnoreInProgress](src/main/java/com/natpryce/worktorule/IgnoreInProgress.java) rule to your test.  The rule's constructor takes an instance of an [IssueTracker](src/main/java/com/natpryce/worktorule/IssueTracker.java) that can query the state of issues for your project.  In this example, our project uses a public GitHub repository.\n\n~~~~~~~~~~~~~~~~~~~~~java\nimport com.natpryce.worktorule.IgnoreInProgress;\nimport com.natpryce.worktorule.issues.github.GitHubIssues;\n\npublic class ExampleAcceptanceTest {\n    @Rule public TestRule ignoreInProgressTests = new IgnoreInProgress(\n        new GitHubIssues(\"example-organisation\", \"example-project\"));\n\n    @Test\n    public void everything_is_awesome() {\n        assertThat(everything.awesomeness(), equalTo(1.0));\n    }\n}\n~~~~~~~~~~~~~~~~~~~~~\n\nThen, annotate the failing test as [InProgress](src/main/java/com/natpryce/worktorule/InProgress.java) and associate it with one or more issues in your issue tracker by passing the issue IDs  as parameters to the InProgress annotation. \n\n~~~~~~~~~~~~~~~~~~~~~java\nimport com.natpryce.worktorule.IgnoreInProgress;\nimport com.natpryce.worktorule.InProgress;\nimport com.natpryce.worktorule.issues.github.GitHubIssues;\n\npublic class ExampleAcceptanceTest {\n    @Rule public TestRule ignoreInProgressTests = new IgnoreInProgress(\n        new GitHubIssues(\"example-organisation\", \"example-project\"));\n\n    @Test\n    @InProgress(\"1\")\n    public void everything_is_awesome() {\n        assertThat(everything.awesomeness(), equalTo(1.0));\n    }\n}\n~~~~~~~~~~~~~~~~~~~~~\n\nThat's it.\n\nWhat next?\n----------\n\nYou'll probably want to define a constant or factory method for the rule so you don't have to duplicate \nconnection parameters across your test code. \n\n~~~~~~~~~~~~~~~~~~~~~java\npublic class TestRules {\n    public static TestRule ignoreInProgressTests = new IgnoreInProgress(\n        new GitHubIssues(\"example-organisation\", \"example-project\"));\n    ...\n}\n\npublic class ExampleAcceptanceTest {\n    @Rule public TestRule ignoreInProgress = TestRules.ignoreInProgressTests;\n    \n    ...\n}\n~~~~~~~~~~~~~~~~~~~~~\n\n\nSupported Issue Trackers\n------------------------\n\nWork to Rule supports several popular issue trackers out of the box:\n\n - [GitHub Issues](https://guides.github.com/features/issues/)\n - [Bitbucket Issues](https://confluence.atlassian.com/display/BITBUCKET/Use+the+issue+tracker)\n - [JIRA](https://www.atlassian.com/software/jira)\n - [Trello](https://trello.com/)\n\nIt is easy to plug in support for new issue trackers if your preferred issue tracker is not one of the above. \nContributions welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnpryce%2Fworktorule","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnpryce%2Fworktorule","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnpryce%2Fworktorule/lists"}