{"id":16195951,"url":"https://github.com/pheymann/rest-refactoring-test","last_synced_at":"2025-04-07T16:35:03.778Z","repository":{"id":44474429,"uuid":"77563549","full_name":"pheymann/rest-refactoring-test","owner":"pheymann","description":"Create small and simple refactoring tests for your REST service","archived":false,"fork":false,"pushed_at":"2017-09-06T17:05:33.000Z","size":102,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-13T18:52:35.183Z","etag":null,"topics":["akka-http","play-framework","refactoring","rest","restful","sbt","scala","spray","testing"],"latest_commit_sha":null,"homepage":"","language":"Scala","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/pheymann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-28T21:52:09.000Z","updated_at":"2019-01-21T01:50:26.000Z","dependencies_parsed_at":"2022-07-15T17:00:33.167Z","dependency_job_id":null,"html_url":"https://github.com/pheymann/rest-refactoring-test","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pheymann%2Frest-refactoring-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pheymann%2Frest-refactoring-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pheymann%2Frest-refactoring-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pheymann%2Frest-refactoring-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pheymann","download_url":"https://codeload.github.com/pheymann/rest-refactoring-test/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247688530,"owners_count":20979692,"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":["akka-http","play-framework","refactoring","rest","restful","sbt","scala","spray","testing"],"created_at":"2024-10-10T08:46:08.937Z","updated_at":"2025-04-07T16:35:03.746Z","avatar_url":"https://github.com/pheymann.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/pheymann/rest-refactoring-test.svg?branch=develop)](https://travis-ci.org/pheymann/rest-refactoring-test)\n[![Chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/rest-refactoring-test/Lobby)\n\n**rrt-core**:\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.pheymann/rrt-core_2.11/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.pheymann/rrt-core_2.11)\n**rrt-play**:\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.pheymann/rrt-play_2.11/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.pheymann/rrt-play_2.11)\n**rrt-plugin**:\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.pheymann/rrt-plugin/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.pheymann/rrt-plugin)\n\nCurrently in release process: 2.2.1\n\n# [DEPRECATED | replacement [artie](https://github.com/pheymann/artie)] rest-refactoring-test (rrt)\nOften you have to refactor or fix REST services which are not covered by extensive automated test and are hard\nto test at all. But you want to make sure that these services haven't changed their behaviour after \nyou have done your changes. \n\nThis library gives you the tools to test your services fast and simple. You only describe the data you need\nand how the request is built and let the library do the work. See this small example:\n\n```Scala\nimport com.github.pheymann.rrt._\n\n// GET /rest/hello/:name?age: Int\nval config = newConfig(\"my-test\", ServiceConfig(\"refactored-rest.com\", 8080), ServiceConfig(\"old-rest.com\", 8081))\n              .withRepetitions(100)\n              .withIgnoreJsonKeys(List(\"service-tracking-id\"))\n\nval testCase = for {\n  userNames \u003c- genStaticData(\"Luke\", \"Anakin\", \"Yoda\")\n  ages      \u003c- genInts(Some(900))\n  result    \u003c- testGet { _ =\u003e\n    // selects randomly one name out of the static list\n    val uri = s\"/rest/hello/${userNames()}\"\n    // adds a query parameter `age` with a random `Int` between 0 and 900\n    val params = Params().add(\"age\", ages)\n    \n    uri |+| params\n  }\n} yield result\n\nassert(checkAndLog(testCase.runSeq(config)))\n```\n\nOutput:\n\n```\n[GET] start my-test\n\n[####################] 100%\n\ntest case my-test succeeded\n  succeeded tries: 100\n  failed tries     0\n```\n\nHere, we create a test for a *GET* endpoint `/rest/hello/:name` which is currently provided by the \nrefactored REST service on `refactored-rest.com` and the old version on `old-rest.com`. The library\nwill create a request with random `name` and `age` and send it to both services. It will\nthen remove the `\"service-tracing-id\"` key with value from the response Json and compare the responses and \nlog possible differences. This step is repeated 100 times as configured.\n\nBesides the random generation or selection of values you are also able to load data from a database,\ne.g. if you need existing user ids.\n\nFor more information have a look into the [Wiki](https://github.com/pheymann/rest-refactoring-test/wiki).\n\n## Get The Libraries\nYou can get the core library by adding the following dependency:\n\n```SBT\nlibraryDependencies += \"com.github.pheymann\" %% \"rrt-core\" % \"2.1.x\" % Test\n```\n\nFurthermore you can add a [Play](https://www.playframework.com/) dependency which adds the ability to \nread Play database configs.\n\n```SBT\nlibraryDependencies += \"com.github.pheymann\" %% \"rrt-play\" % \"2.1.x\" % Test\n```\n\nBoth libs are built for Scala *2.11.x*.\n\n## SBT Plugin\nIf you want to have a `rrt` task and don't want to manually define all modules you need you can use the\nSBT plugin. It is built for SBT version *0.13.x* and can be used by adding the following line to your\n`plugins.sbt` file:\n\n\n```SBT\naddSbtPlugin(\"com.github.pheymann\" % \"rrt-plugin\" % \"2.1.x\")\n```\n\nWith that you can add the dependencies as follows:\n\n```SBT\nimport com.github.pheymann.rrt.plugin._\n\nlibraryDependencies ++= Seq(\n  rrtCore % RestRefactoringTest,\n  rrtPlay % RestRefactoringTest\n)\n```\n\nAnd run your refactoring tests with the following task: `rrt:test`. As this task extends `Test` you also have\naccess to all sub-tasks.\n\n## Dependecies\nThis library is build with:\n - Free Mondas provided by [cats](https://github.com/typelevel/cats) to build the library api\n - the http client by [akka-http](http://doc.akka.io/docs/akka-http/current/scala.html) for the REST calls\n - the db api from [scalike-jdbc](http://scalikejdbc.org/) for the database interactions\n \n## Examples\nIn this early phase you can only find some running examples in the [integration tests](https://github.com/pheymann/rest-refactoring-test/tree/develop/core/src/it/scala/com/github/pheymann/rrt). You can also have a look into the [Wiki](https://github.com/pheymann/rest-refactoring-test/wiki).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpheymann%2Frest-refactoring-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpheymann%2Frest-refactoring-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpheymann%2Frest-refactoring-test/lists"}