rarc

Project Url: qameta/rarc
Introduction: Rest-Assured RAML Codegen - Generates test http client, based on Rest-Assured with help of RAML spec
More: Author   ReportBugs   
Tags:

This project simplifies generation of test clients (with Rest-Assured lib under the hood) by your RAML spec. Currently this project pointed to 0.8, but will be upgraded to 1.0 soon.

Quick Start

  • Place your spec to src/main/resources/api.raml
  • Add to your <build> section in pom.xml:
<plugin>
    <groupId>ru.lanwen.raml</groupId>
    <artifactId>rarc-maven-plugin</artifactId>
    <executions>
        <execution>
            <goals>
                <goal>generate-client</goal>
            </goals>
            <configuration>
                <basePackage>ru.lanwen.raml.test</basePackage>
            </configuration>
        </execution>
    </executions>
</plugin>
  • Add dependency to rest-assured (currently tested on 3.0.2):
<dependency>
    <groupId>io.rest-assured</groupId>
    <artifactId>rest-assured</artifactId>
    <version>3.0.2</version>
</dependency>
  • Run mvn clean compile
  • Use it! (Don't forget to add static imports and factory to base endpoint)
ApiExample.example(
        ApiExample.Config.exampleConfig()
                .withReqSpecSupplier(
                        () -> new RequestSpecBuilder().setBaseUri("http://your_host/")
                )
            )
            .rpcApi()
            .uid().withUid("1")
            .info()
            .get(identity()).prettyPeek();

See working example in rarc-example module.

Apps
About Me
GitHub: Trinea
Facebook: Dev Tools