How to run integration tests for client/server interaction

146 views
Skip to first unread message

Jonathon McKitrick

unread,
Apr 7, 2015, 3:29:29 PM4/7/15
to clojur...@googlegroups.com
I currently use lein test aliases to run server-side tests and client-side tests. But that currently means my client-side AJAX calls are either mocked or just return fixture data.

How can I run client-side tests which will actually call a running instance of the server to test live data?

David Nolen

unread,
Apr 7, 2015, 3:34:07 PM4/7/15
to clojur...@googlegroups.com
http://docs.closure-library.googlecode.com/git/class_goog_testing_net_XhrIo.html

There's a bunch of stuff under the goog.testing namespace.

David

On Tue, Apr 7, 2015 at 3:29 PM, Jonathon McKitrick <jmcki...@gmail.com> wrote:
I currently use lein test aliases to run server-side tests and client-side tests.  But that currently means my client-side AJAX calls are either mocked or just return fixture data.

How can I run client-side tests which will actually call a running instance of the server to test live data?

--
Note that posts from new members are moderated - please be patient with your first post.
---
You received this message because you are subscribed to the Google Groups "ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojurescrip...@googlegroups.com.
To post to this group, send email to clojur...@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.

jmcki...@gmail.com

unread,
Apr 7, 2015, 4:23:08 PM4/7/15
to clojur...@googlegroups.com
Just to clarify, I don't think I want to mock those calls.  I believe it makes more sense to have the front-end call a running server back-end and get real data.  Can this be set up and executed from a test suite, short of running a server in one console, and then the clojurescript test suite in another?  That seems kludgy.

You received this message because you are subscribed to a topic in the Google Groups "ClojureScript" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojurescript/rArkEBCRods/unsubscribe.
To unsubscribe from this group and all its topics, send an email to clojurescrip...@googlegroups.com.

David Nolen

unread,
Apr 7, 2015, 4:24:40 PM4/7/15
to clojur...@googlegroups.com
Ah sorry, I misread. Yeah nothing to suggest here other than staging environments.

David

Sebastian Bensusan

unread,
Apr 8, 2015, 9:59:53 AM4/8/15
to clojur...@googlegroups.com
Hi Jonathon,

I've encountered the same issue and so far my solution has been to run something like `lein ring server` on a terminal window while I run `lein test cljs` on the other. Not ideal! I see two solutions to this:

1. Use Selenium through https://github.com/semperos/clj-webdriver and do the integration tests from Clojure without calling any ClojureScript code.

2. Wrap the `lein ring server` command in the alias: [start-server,["test","cljs"],stop-server]]

I haven't got around to this. I'm concentrating on improving the ClojureScript-React testing experience first, but this will be my next step. Are you running your tests on PhantomJS?

Sebastian

jmcki...@gmail.com

unread,
Apr 8, 2015, 10:55:28 AM4/8/15
to clojur...@googlegroups.com
That's exactly what I was thinking - an alias to start the server first.  I'm at the same place, working on tests for React apps.

--
Note that posts from new members are moderated - please be patient with your first post.
---
You received this message because you are subscribed to a topic in the Google Groups "ClojureScript" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojurescript/rArkEBCRods/unsubscribe.
To unsubscribe from this group and all its topics, send an email to clojurescript+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages