What do folks use for HTTP? Testing?

43 views
Skip to first unread message

Austin Guest

unread,
Apr 24, 2015, 2:02:50 PM4/24/15
to mac...@googlegroups.com
Hi all, I'm new to Macroid, but received a very warm welcome from Nick yesterday. (Thanks!)

As I feel my way around, I wanted to nail down to important things: (1) my HTTP library and (2) my testing library. Back in non-Android-land, I like to use Dispatch (or Spray/Akka HTTP) for HTTP and Specs2 for testing.

I've perused Google's official pages on HTTP and testing and would like to find more idiomatic (and less verbose!) Scala-based alternatives. On the HTTP front, I want to make sure I'm making non-blocking requests (not immediately clear to me that Android's default client does this.) On the testing front, I want to be able to run unit tests without spinning up the full Android application.

For HTTP:

For Testing:

  • I gather that people like RoboElectric (which runs test on the JVM, not Android)
    • But RoboElectric is still in Java!
  • I found RoboSpecs which integrates RoboElectric with Specs2
    • But RoboSpecs depends on specs2 version 1.9 (current version is 3.5) and was last updated in 2012!
  • I found RoboTest, which integrates RoboElectric with ScalaTest
    • But I wanted to use Specs2! ;P
    • And... the dependencies are significantly less outdated but still not totally up-to-date
Any pointers from folks more well-versed in this than me? Any example code for getting an alternate HTTP library working in Android? Any hand-rolled methods for getting Specs2 to use a JUnit Runner that works with RoboElectric? Any alternatives I'm not thinking about?

Also: anything I can do to show my gratitude for people being nice and answering my questions? Is there any documentation that needs updating, copy-editing or any other form of grunt work that would be nice if a n00b would take care of?

Thanks in advance! :)

/a/

Austin Guest

unread,
Apr 24, 2015, 7:20:32 PM4/24/15
to mac...@googlegroups.com
So... by way of answering my own questions, I think I found a solid Android/Scala library:

Taig's Communicator is a Scala/Android-friendly wrapper around Square's OkHttp.  47 Degrees uses it to great effect in their example Macroid app -- in which they also incidentally have a suite of Specs2 tests.

So... think I'm set. Hope someone else just finding there way into this stuff finds the above useful! And if anyone else knows of better options, by all means: would love to hear about 'em!

/a/

--
You received this message because you are subscribed to a topic in the Google Groups "macroid" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/macroid/9St0fEd4YLQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to macroid+u...@googlegroups.com.
To post to this group, send email to mac...@googlegroups.com.
Visit this group at http://groups.google.com/group/macroid.
To view this discussion on the web visit https://groups.google.com/d/msgid/macroid/d2b2c163-8505-4608-96f9-7db1f54c8596%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Nick Stanchenko

unread,
Apr 24, 2015, 7:29:09 PM4/24/15
to mac...@googlegroups.com
Ah, nice to know! Regarding HTTP, in the past I’ve used android-async-http (http://loopj.com/android-async-http/), for which I wrote a simple wrapper: https://github.com/resolvable/resolvable/blob/master/src/main/scala/resolvable/http/AndroidClient.scala#L12. I only tried using Dispatch on Android briefly and remember there were some problems with the newer versions, as you also noticed. I am pretty sure someone on the scala-on-android mailing list was using Spray, maybe you could try asking there? IIRC OkHttp is blocking, but I might be wrong.

Regarding tests, Macroid right now has a rather minimalist test suite, whicih basically verifies that the macros expand and the typeclass instances are found without errors. There’s an issue for that: https://github.com/macroid/macroid/issues/52. I haven’t done Android app testing in a while, so I’m not the go-to person for that, but I’ll take a look at 47deg’s approach and maybe try to add some tests to macroid-starter as per https://github.com/macroid/macroid-starter/issues/4. Incidentally, this could be a great contribution ;) Also whenever you feel the documentation is not clear enough, please submit an issue or even a pull request to macroid/macroid on github :)

Nick
To unsubscribe from this group and all its topics, send an email to macroid+unsubscribe@googlegroups.com.

To post to this group, send email to mac...@googlegroups.com.
Visit this group at http://groups.google.com/group/macroid.
To view this discussion on the web visit https://groups.google.com/d/msgid/macroid/d2b2c163-8505-4608-96f9-7db1f54c8596%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Austin Guest

unread,
Apr 25, 2015, 12:05:30 PM4/25/15
to Nick Stanchenko, mac...@googlegroups.com
Cool! Thanks Nick! Will dig further into both HTTP options.

On the surface, looks like Communicator is trying to be async... but its underlying dependencies are `java.io` and `java.net.URLConnection`, which would seem to indicate that it's blocking.  Will definitely use the loopj library if that's the case.

And I'd *love* to write some  unit tests for the macroid-starter project! (I owe that repo a great debt, as turned the tide in convincing me jump into scala-android development. After spinning my wheels for two weeks trying to shake the tool-chain for Scaloid, I cloned that repo, and it *just worked*.)

Will also try to keep thorough notes as I walk through the basics, as that's often the best time to capture documentation that would be helpful to a newcomer. (After you know the ropes, it can be hard to put yourself back in that mind frame). Happy to submit issues or PRs for anything that seems both helpful and missing.

And again: thanks for the warm welcome! :)

/a/

Nick
To unsubscribe from this group and all its topics, send an email to macroid+u...@googlegroups.com.

To post to this group, send email to mac...@googlegroups.com.
Visit this group at http://groups.google.com/group/macroid.
To view this discussion on the web visit https://groups.google.com/d/msgid/macroid/d2b2c163-8505-4608-96f9-7db1f54c8596%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "macroid" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/macroid/9St0fEd4YLQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to macroid+u...@googlegroups.com.

To post to this group, send email to mac...@googlegroups.com.
Visit this group at http://groups.google.com/group/macroid.

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

Nick Stanchenko

unread,
Apr 25, 2015, 12:14:48 PM4/25/15
to mac...@googlegroups.com, nick....@gmail.com


And I'd *love* to write some  unit tests for the macroid-starter project! (I owe that repo a great debt, as turned the tide in convincing me jump into scala-android development. After spinning my wheels for two weeks trying to shake the tool-chain for Scaloid, I cloned that repo, and it *just worked*.)

Will also try to keep thorough notes as I walk through the basics, as that's often the best time to capture documentation that would be helpful to a newcomer. (After you know the ropes, it can be hard to put yourself back in that mind frame). Happy to submit issues or PRs for anything that seems both helpful and missing.

Sounds great! You are very right about the mind frame. It’s also true that many people tend to blame themselves for not grokking something, where in fact a simple change to the documentation would help significantly.
 
And again: thanks for the warm welcome! :)

Thank you for the kind words :)

Nick

Abimbola Esuruoso

unread,
May 11, 2016, 5:42:56 AM5/11/16
to macroid
Hey guys,

I've made another scala HTTP client which can be used for making HTTP requests. It integrates into all the well-known JSON libraries (Play/Spray/Argonaut) and it really easy to use. Have a look at https://github.com/Godis/Cirrus for more info and some quick examples
Reply all
Reply to author
Forward
0 new messages