{"id":13712304,"url":"https://github.com/SmartBear/readyapi4j","last_synced_at":"2025-05-06T21:33:49.133Z","repository":{"id":3634668,"uuid":"50371312","full_name":"SmartBear/readyapi4j","owner":"SmartBear","description":"Java library for BDD and code-driven API testing supporting both local and remote test execution","archived":true,"fork":false,"pushed_at":"2022-06-17T14:50:59.000Z","size":3421,"stargazers_count":19,"open_issues_count":78,"forks_count":10,"subscribers_count":22,"default_branch":"master","last_synced_at":"2024-11-13T22:35:41.052Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SmartBear.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-25T18:25:45.000Z","updated_at":"2024-01-13T23:54:49.000Z","dependencies_parsed_at":"2022-08-08T09:30:20.042Z","dependency_job_id":null,"html_url":"https://github.com/SmartBear/readyapi4j","commit_stats":null,"previous_names":["smartbear/ready-api-testserver-client"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartBear%2Freadyapi4j","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartBear%2Freadyapi4j/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartBear%2Freadyapi4j/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartBear%2Freadyapi4j/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SmartBear","download_url":"https://codeload.github.com/SmartBear/readyapi4j/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252772533,"owners_count":21801941,"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-08-02T23:01:16.925Z","updated_at":"2025-05-06T21:33:48.024Z","avatar_url":"https://github.com/SmartBear.png","language":"Java","funding_links":[],"categories":["By Technology"],"sub_categories":["Java"],"readme":"# ReadyAPI4j - a Java library for API testing\r\n\r\nThe ReadyAPI4j library lets you easily test REST and SOAP APIs using Java, Groovy or Cucumber. \r\nUnder the hood the library uses the open-source test-execution engine of [SoapUI](http://www.soapui.org).\r\n\r\n* Quickly get started:\r\n  * [with Java](#getting-started-with-java) - together with any testing framework - read the documentation for the core Java APIs [here](modules/core)\r\n  * [with our Groovy DSL](#getting-started-with-groovy) - read the documentation of the DSL [here](modules/groovy-dsl)\r\n  * [with Cucumber](modules/cucumber) - with cucumber-jvm \r\n  * [with the Maven plugin](modules/maven-plugin)\r\n* [Running Tests with TestEngine](#running-tests-with-testengine)\r\n* [Core Concepts](CONCEPTS.md) - explains readyapi4j core concepts\r\n* [Modules](MODULES.md) - an overview of the included maven modules\r\n\r\n## Getting Started with Java\r\n\r\n1. Add the following Maven dependency to your project:\r\n \r\n\t```xml\r\n\t\u003cdependency\u003e\r\n\t\t\u003cgroupId\u003ecom.smartbear.readyapi\u003c/groupId\u003e\r\n\t\t\u003cartifactId\u003ereadyapi4j-facade\u003c/artifactId\u003e\r\n\t\t\u003cversion\u003e1.0.0-SNAPSHOT\u003c/version\u003e\r\n\t\u003c/dependency\u003e\r\n\t```\r\n\r\n2. Create and execute a simple recipe with your favorite unit-testing framework:\r\n\r\n\t```java\r\n    @Test\r\n    public void simpleCountTest() throws Exception {\r\n         RecipeExecutionResult result = executeRecipe(\r\n             GET(\"https://api.swaggerhub.com/specs\")\r\n                 .withParameters(\r\n                     query(\"specType\", \"API\"),\r\n                     query(\"query\", \"testengine\")\r\n                 )\r\n                 .withAssertions(\r\n                     json(\"$.totalCount\", \"4\")\r\n                 )\r\n         );\r\n         \r\n         assertExecutionResult(result);\r\n    }\r\n\t```\r\n\r\n3. Run your test and enjoy the results (or not...);\r\n\r\n    ```\r\n    java.lang.AssertionError: Execution failed: [[JsonPath Match] Comparison failed for path [$.totalCount], expecting [4], actual was [5]] \r\n    Expected :FINISHED\r\n    Actual   :FAILED\r\n    ```\r\n\r\nLearn more about the Java testing vocabulary by:\r\n- having a look at the [core module](modules/core)\r\n- having a look at the [java samples](modules/samples/java/src/test/java/com/smartbear/readyapi4j/samples/java)\r\n- having a look at the [core unit tests](modules/core/src/test/java/com/smartbear/readyapi4j)\r\n- [browsing the javadoc](http://smartbear.github.io/readyapi4j/apidocs/) \r\n\r\n## Getting Started with Groovy \r\n\r\nReadyAPI4j provides a Groovy DSL to create and execute API tests locally or on TestEngine. Documentation of the DSL\r\nis [available here](modules/groovy-dsl).\r\n\r\nThe following steps explain how to use this DSL in a JUnit test.\r\n\r\n1. Add the following Maven dependency to your project:\r\n \r\n\t```xml\r\n\t\u003cdependency\u003e\r\n\t\t\u003cgroupId\u003ecom.smartbear.readyapi\u003c/groupId\u003e\r\n\t\t\u003cartifactId\u003ereadyapi4j-groovy-dsl\u003c/artifactId\u003e\r\n\t\t\u003cversion\u003e1.0.0-SNAPSHOT\u003c/version\u003e\r\n\t\u003c/dependency\u003e\r\n\t```\r\n\r\n2. Create a JUnit test with a test recipe in Groovy:\r\n\r\n  The example below shows how to create and execute a recipe with one single step locally, using the SoapUI OS engine. \r\n  This requires the additional dependency on com.smartbear.readyapi:readyapi4j-local, but there is no need to install SoapUI. \r\n   ```groovy\r\n   import Execution\r\n   import org.junit.Test\r\n   \r\n   import static RecipeExecution.executeRecipe\r\n\r\n    class DslTestDemo {\r\n    \r\n        @Test\r\n        void testSwaggerHubApi() {\r\n           //Executes recipe locally - this requires the additional dependency com.smartbear.readyapi:readyapi4j-local\r\n            Execution execution = executeRecipe {\r\n                get 'https://api.swaggerhub.com/specs', {\r\n                    parameters {\r\n                        query 'specType', 'API'\r\n                        query 'query', 'testengine'\r\n                    }\r\n                    asserting {\r\n                        jsonPath '$.totalCount' occurs 0 times\r\n                    }\r\n                }\r\n            }\r\n            assert execution.errorMessages.empty\r\n        }\r\n    }   \r\n   ```\r\n   Here is sample output from this test. It shows that the assertion on the test step has failed:\r\n   ```\r\n   Assertion failed: \r\n   \r\n   assert execution.errorMessages.empty\r\n          |         |             |\r\n          |         |             false\r\n          |         [[JsonPath Count] Comparison failed for path [$.totalCount], expecting [0], actual was [1]]\r\n          SoapUIRecipeExecution@f810c18\r\n   ```\r\n   \r\n   Similarly, you can execute the recipe on TestEngine with the following:\r\n   ```groovy\r\n   import Execution\r\n   import org.junit.Test\r\n   \r\n   import static RecipeExecution.executeRecipeOnServer\r\n   \r\n   class DslTestDemo {\r\n       @Test\r\n       void testSwaggerHubApi() {\r\n           Execution execution = executeRecipeOnServer '\u003cyour TestEngine url, e.g. http://localhost:8080\u003e', '\u003cyour user\u003e', '\u003cyour password\u003e', {\r\n               get 'https://api.swaggerhub.com/specs', {\r\n                   parameters {\r\n                       query 'specType', 'API'\r\n                       query 'query', 'testengine'\r\n                   }\r\n                   asserting {\r\n                       jsonPath '$.totalCount' occurs 0 times\r\n                   }\r\n               }\r\n           }\r\n           assert execution.errorMessages.empty\r\n       }\r\n   }\r\n   ```\r\nHere is sample output from this test:\r\n```\r\nAssertion failed: \r\n\r\nassert execution.errorMessages.empty\r\n       |         |             |\r\n       |         |             false\r\n       |         [TestStepName: GET request 1, messages: [JsonPath Count] Comparison failed. Path: [$.totalCount]; Expected value: [0]; Actual value: [1].]\r\n       TestEngineExecution@dfddc9a\r\n```\r\n## More samples / tutorials\r\n\r\nThe [samples submodule](modules/samples) here on GitHub contains a number of samples for Java, Groovy and Maven.\r\n\r\n## Running tests with TestEngine\r\n\r\nTo get access to extended functionality like data-driven testing, centralized execution and reporting, etc., you \r\nneed to execute your tests with [ReadyAPI TestEngine](https://support.smartbear.com/readyapi/docs/testengine/index.html) instead of running \r\nthem locally. \r\n\r\nTestEngine is a standalone server that exposes a REST API for running API tests, it receives and runs *test recipes* \r\nin the same underlying JSON format that is also used in the test shown above. If you're using the RecipeExecutionFacade \r\n(as in the example above) all you have to do is add system (or environment) variables that point the facade to a \r\nrunning TestEngine instance. For example, if we add\r\n\r\n```\r\ntestengine.endpoint=http://localhost:8080\r\ntestengine.user=admin\r\ntestengine.password=testengine\r\n```\r\n\t\r\nas either system/env properties to our execution and then rerun the above test - those tests will be executed by the \r\nspecified locally running TestEngine instance using the default credentials.\r\n\r\n### Logging of Recipes and HTTP transactions\r\n\r\nUsage of the facade as in the above examples also enables logging of both generated recipes and HTTP transaction logs \r\nof executed tests (in HAR file format). Adding the following two properties:\r\n\r\n```\r\nreadyapi4j.log.executions.folder=target/logs/executions\r\nreadyapi4j.log.recipes.folder=target/logs/recipes\r\n```\r\n\r\nwill automatically result in the corresponding artifacts being written to the corresponding folders.\r\n\r\n## Learn More about TestEngine\r\n\r\n[ReadyAPI TestEngine](https://smartbear.com/product/ready-api/testengine/overview/)\r\n\r\n[ReadyAPI](https://smartbear.com/product/ready-api/overview/)\r\n\r\n## License\r\n\r\nThis library is licensed under the Apache 2.0 License - copyright Smartbear Software\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSmartBear%2Freadyapi4j","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSmartBear%2Freadyapi4j","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSmartBear%2Freadyapi4j/lists"}