REST API testing

163 views
Skip to first unread message

Frank Sommers

unread,
Jul 4, 2015, 11:39:03 AM7/4/15
to scalate...@googlegroups.com
Hello, 

I'm wondering, what is the currently recommended way to write Scalatests for an existing REST-based API (where JSON messages are exchanged via HTTP)? 

I need to write some tests to validate a service that someone else has written, and am looking for the most lightweight solution. I've used Dispatch before and, more recently, Spray Client for HTTP client development. I'm wondering if there are perhaps simper ways yet to develop client-side tests that exercise a REST API.

Thanks, 

-- Frank

Saquib Gul

unread,
Mar 10, 2017, 2:22:36 PM3/10/17
to scalatest-users
Frank, 
Any luck you got with this, I am working something similar these days. I am writing a framework to test API's which are written in Java, actually I need to prepare a regression suite. 

Thanks,
Saquib Gul

Donald McLean

unread,
Mar 10, 2017, 3:15:45 PM3/10/17
to scalate...@googlegroups.com
I've been using the Apache Commons HTTP client classes. I know it's (GASP) plain-old-Java, but it really works quite well for communicating to a REST API.

--
You received this message because you are subscribed to the Google
Groups "scalatest-users" group.
To post to this group, send email to scalatest-users@googlegroups.com
To unsubscribe from this group, send email to
scalatest-users+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/scalatest-users?hl=en
ScalaTest itself, and documentation, is available here:
http://www.artima.com/scalatest
---
You received this message because you are subscribed to the Google Groups "scalatest-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalatest-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.

akbac...@gmail.com

unread,
Jul 28, 2017, 12:22:28 PM7/28/17
to scalatest-users
My team just built up some utility classes with Scalaj and use them in our specs to facilitate such testing.

Bill Venners

unread,
Jul 28, 2017, 1:18:32 PM7/28/17
to scalate...@googlegroups.com
Hi All,

Oddly enough, using scalaj is what I'm about to use. We have been
using Akka http until now on this project, but need to go through an
http proxy for one use case, and Akka http doesn't seem to support
that.

Bill
> --
> You received this message because you are subscribed to the Google
> Groups "scalatest-users" group.
> To post to this group, send email to scalate...@googlegroups.com
> To unsubscribe from this group, send email to
> scalatest-use...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/scalatest-users?hl=en
> ScalaTest itself, and documentation, is available here:
> http://www.artima.com/scalatest
> ---
> You received this message because you are subscribed to the Google Groups
> "scalatest-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to scalatest-use...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Bill Venners
Artima, Inc.
http://www.artima.com

Konrad Malawski

unread,
Jul 30, 2017, 11:46:29 AM7/30/17
to scalate...@googlegroups.com
Hi Bill,
do you mean for the client?
Just letting you know, in case you'd be interested to give it a look.

-- 
Cheers,
Konrad 'ktoso’ Malawski
Akka @ Lightbend
java.pl / geecon.org / krakowscala.pl / lambrakrk.pl / gdgkrakow.pl

On Sat, Jul 29, 2017 at 2:18 AM, Bill Venners <bi...@artima.com> wrote:
Hi All,

Oddly enough, using scalaj is what I'm about to use. We have been
using Akka http until now on this project, but need to go through an
http proxy for one use case, and Akka http doesn't seem to support
that.

Bill

On Fri, Jul 28, 2017 at 9:22 AM,  <akbac...@gmail.com> wrote:
> My team just built up some utility classes with Scalaj and use them in our
> specs to facilitate such testing.
>
>
> On Saturday, July 4, 2015 at 10:39:03 AM UTC-5, fsommers wrote:
>>
>> Hello,
>>
>> I'm wondering, what is the currently recommended way to write Scalatests
>> for an existing REST-based API (where JSON messages are exchanged via HTTP)?
>>
>> I need to write some tests to validate a service that someone else has
>> written, and am looking for the most lightweight solution. I've used
>> Dispatch before and, more recently, Spray Client for HTTP client
>> development. I'm wondering if there are perhaps simper ways yet to develop
>> client-side tests that exercise a REST API.
>>
>> Thanks,
>>
>> -- Frank
>
> --
> You received this message because you are subscribed to the Google
> Groups "scalatest-users" group.
> To post to this group, send email to scalatest-users@googlegroups.com

> To unsubscribe from this group, send email to

> For more options, visit this group at
> http://groups.google.com/group/scalatest-users?hl=en
> ScalaTest itself, and documentation, is available here:
> http://www.artima.com/scalatest
> ---
> You received this message because you are subscribed to the Google Groups
> "scalatest-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an

> For more options, visit https://groups.google.com/d/optout.



--
Bill Venners
Artima, Inc.
http://www.artima.com
--
You received this message because you are subscribed to the Google
Groups "scalatest-users" group.
To post to this group, send email to scalatest-users@googlegroups.com

To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/scalatest-users?hl=en
ScalaTest itself, and documentation, is available here:
http://www.artima.com/scalatest
---
You received this message because you are subscribed to the Google Groups "scalatest-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalatest-users+unsubscribe@googlegroups.com.

Bill Venners

unread,
Jul 30, 2017, 12:46:42 PM7/30/17
to scalate...@googlegroups.com
Hi Konrad,

My understanding was that Akka Http only supports https proxy, not
http proxy. The page you linked to mentioned Https proxy, but not Http
proxy. Is that the correct understanding?

Bill
>> > To post to this group, send email to scalate...@googlegroups.com
>> > To unsubscribe from this group, send email to
>> > scalatest-use...@googlegroups.com
>> > For more options, visit this group at
>> > http://groups.google.com/group/scalatest-users?hl=en
>> > ScalaTest itself, and documentation, is available here:
>> > http://www.artima.com/scalatest
>> > ---
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "scalatest-users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to scalatest-use...@googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>> Bill Venners
>> Artima, Inc.
>> http://www.artima.com
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "scalatest-users" group.
>> To post to this group, send email to scalate...@googlegroups.com
>> To unsubscribe from this group, send email to
>> scalatest-use...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/scalatest-users?hl=en
>> ScalaTest itself, and documentation, is available here:
>> http://www.artima.com/scalatest
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "scalatest-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to scalatest-use...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "scalatest-users" group.
> To post to this group, send email to scalate...@googlegroups.com
> To unsubscribe from this group, send email to
> scalatest-use...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/scalatest-users?hl=en
> ScalaTest itself, and documentation, is available here:
> http://www.artima.com/scalatest
> ---
> You received this message because you are subscribed to the Google Groups
> "scalatest-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to scalatest-use...@googlegroups.com.

Konrad Malawski

unread,
Jul 31, 2017, 10:59:06 AM7/31/17
to scalate...@googlegroups.com
Hm, it seems our wording in the docs was rather sub-optimal on this one...
The people who most wanted this feature were asking for supporting HTTPS and it seems we ended up putting "HTTPS" everywhere in docs and method names as well... while it more correctly would be to say "HTTP(S)" everywhere.

And docs: http://doc.akka.io/docs/akka-http/current/scala/http/client-side/client-transport.html (which indeed overly stress the HTTPS aspect, will be fixed in next release).

So yes. we support plain HTTP proxying (and to HTTPS targets too).
What was missing until today was authentication, but I merged this today and if that's something you'd need that will be out next week (+/- a few days).

Hope this helps :)

-- 
Cheers,
Konrad 'ktoso’ Malawski
Akka @ Lightbend
java.pl / geecon.org / krakowscala.pl / lambrakrk.pl / gdgkrakow.pl

>> > To post to this group, send email to scalatest-users@googlegroups.com

>> > To unsubscribe from this group, send email to

>> > For more options, visit this group at
>> > http://groups.google.com/group/scalatest-users?hl=en
>> > ScalaTest itself, and documentation, is available here:
>> > http://www.artima.com/scalatest
>> > ---
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "scalatest-users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an

>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>> Bill Venners
>> Artima, Inc.
>> http://www.artima.com
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "scalatest-users" group.
>> To post to this group, send email to scalatest-users@googlegroups.com

>> To unsubscribe from this group, send email to

>> For more options, visit this group at
>> http://groups.google.com/group/scalatest-users?hl=en
>> ScalaTest itself, and documentation, is available here:
>> http://www.artima.com/scalatest
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "scalatest-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an

>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "scalatest-users" group.
> To post to this group, send email to scalatest-users@googlegroups.com

> To unsubscribe from this group, send email to

> For more options, visit this group at
> http://groups.google.com/group/scalatest-users?hl=en
> ScalaTest itself, and documentation, is available here:
> http://www.artima.com/scalatest
> ---
> You received this message because you are subscribed to the Google Groups
> "scalatest-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an

> For more options, visit https://groups.google.com/d/optout.



--
Bill Venners
Artima, Inc.
http://www.artima.com

--
You received this message because you are subscribed to the Google
Groups "scalatest-users" group.
To post to this group, send email to scalatest-users@googlegroups.com

To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/scalatest-users?hl=en
ScalaTest itself, and documentation, is available here:
http://www.artima.com/scalatest
---
You received this message because you are subscribed to the Google Groups "scalatest-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalatest-users+unsubscribe@googlegroups.com.

Bill Venners

unread,
Jul 31, 2017, 11:14:32 AM7/31/17
to scalate...@googlegroups.com
Hi Konrad,

Yes, that helps a lot. And discovered just in time, as I hadn't yet
tried plugging in the scalaj stuff.

Thanks!

Bill

On Mon, Jul 31, 2017 at 7:58 AM, Konrad Malawski
>> >> > To post to this group, send email to scalate...@googlegroups.com
>> >> > To unsubscribe from this group, send email to
>> >> > scalatest-use...@googlegroups.com
>> >> > For more options, visit this group at
>> >> > http://groups.google.com/group/scalatest-users?hl=en
>> >> > ScalaTest itself, and documentation, is available here:
>> >> > http://www.artima.com/scalatest
>> >> > ---
>> >> > You received this message because you are subscribed to the Google
>> >> > Groups
>> >> > "scalatest-users" group.
>> >> > To unsubscribe from this group and stop receiving emails from it,
>> >> > send
>> >> > an
>> >> > email to scalatest-use...@googlegroups.com.
>> >> > For more options, visit https://groups.google.com/d/optout.
>> >>
>> >>
>> >>
>> >> --
>> >> Bill Venners
>> >> Artima, Inc.
>> >> http://www.artima.com
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> >> Groups "scalatest-users" group.
>> >> To post to this group, send email to scalate...@googlegroups.com
>> >> To unsubscribe from this group, send email to
>> >> scalatest-use...@googlegroups.com
>> >> For more options, visit this group at
>> >> http://groups.google.com/group/scalatest-users?hl=en
>> >> ScalaTest itself, and documentation, is available here:
>> >> http://www.artima.com/scalatest
>> >> ---
>> >> You received this message because you are subscribed to the Google
>> >> Groups
>> >> "scalatest-users" group.
>> >> To unsubscribe from this group and stop receiving emails from it, send
>> >> an
>> >> email to scalatest-use...@googlegroups.com.
>> >> For more options, visit https://groups.google.com/d/optout.
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "scalatest-users" group.
>> > To post to this group, send email to scalate...@googlegroups.com
>> > To unsubscribe from this group, send email to
>> > scalatest-use...@googlegroups.com
>> > For more options, visit this group at
>> > http://groups.google.com/group/scalatest-users?hl=en
>> > ScalaTest itself, and documentation, is available here:
>> > http://www.artima.com/scalatest
>> > ---
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "scalatest-users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to scalatest-use...@googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>> Bill Venners
>> Artima, Inc.
>> http://www.artima.com
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "scalatest-users" group.
>> To post to this group, send email to scalate...@googlegroups.com
>> To unsubscribe from this group, send email to
>> scalatest-use...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/scalatest-users?hl=en
>> ScalaTest itself, and documentation, is available here:
>> http://www.artima.com/scalatest
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "scalatest-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to scalatest-use...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "scalatest-users" group.
> To post to this group, send email to scalate...@googlegroups.com
> To unsubscribe from this group, send email to
> scalatest-use...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/scalatest-users?hl=en
> ScalaTest itself, and documentation, is available here:
> http://www.artima.com/scalatest
> ---
> You received this message because you are subscribed to the Google Groups
> "scalatest-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to scalatest-use...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages