Skip to content

IainHull/resttest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RestTest

A lightweight Scala DSL for system testing REST web services

Example

val Jason: Person = ???
val personJson = Json.stringify(Jason)
val EmptyList = List[Person]()

using(_ url "http://api.rest.org/person") { implicit rb =>
  GET asserting (statusCode is Status.OK, jsonBodyAsList[Person] is EmptyList)
  val id = POST body personJson asserting (statusCode is Status.Created) returning (header("X-Person-Id"))
  GET / id asserting (statusCode is Status.OK, jsonBodyAs[Person] is Jason)
  GET asserting (statusCode is Status.OK, jsonBodyAsList[Person] is Seq(Jason))
  DELETE / id asserting (statusCode is Status.OK)
  GET / id asserting (statusCode is Status.NotFound)
  GET asserting (statusCode is Status.OK, jsonBodyAsList[Person] is EmptyList)
}

The Plan

I plan for this to be a useful resource for writing REST web service system tests. However my initial focus is learning and documenting the creation of a Scala DSL. The progress on the implementation is slow because I am documenting my understanding of DSLs as I go.

You can follow the progress on my blog:

How to build

This project has been migrated to Scala 2.11 and the build ported to SBT.

To download and build RestTest just:

git clone [email protected]:IainHull/resttest.git
cd resttest
sbt test

To create a fully configured eclipse project just:

sbt eclipse with-source=true

Old build using Gradle

This project used to be built with gradle. It still includes the gradle files and the gradle wrapper which will download gradle and build the project for you (the only prereq is Java).

To download and build RestTest just:

git clone [email protected]:IainHull/resttest.git
cd resttest
./gradlew build

To create a fully configured eclipse project just:

./gradlew eclipse

License

RestTest is licensed under the permissive Apache 2 Open Source License.

About

A lightweight Scala DSL for system testing REST web services

Resources

License

Stars

Watchers

Forks

Packages

No packages published