# Testing a Discourse API client on Travis-CI

**URL:** https://meta.discourse.org/t/testing-a-discourse-api-client-on-travis-ci/42947
**Category:** Development
**Created:** [April 21, 2016, 7:15pm UTC](https://meta.discourse.org/t/testing-a-discourse-api-client-on-travis-ci/42947 "2016-04-21T19:15:00Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![sckott](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sckott/32/115359_2.png) [@sckott](https://meta.discourse.org/u/sckott)
#### Post date: [April 21, 2016, 7:15pm UTC](https://meta.discourse.org/t/testing-a-discourse-api-client-on-travis-ci/42947/1 "2016-04-21T19:15:00Z")

</div>

What’s the best or fastest way to get Discourse installed on Travis for testing a client for the Discourse API ?

It appears as though the `discourse_api` gem uses `webmock` so I think does not use a real Discourse installation.

It would be nice to install Discourse on Travis and test against it for my test suite. Any example travis files for that?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [April 22, 2016, 1:54am UTC](https://meta.discourse.org/t/testing-a-discourse-api-client-on-travis-ci/42947/2 "2016-04-22T01:54:57Z")

</div>

Can you explain what you are trying to do and why you need Discourse installed with a specific example of type of test you are trying to run?

---

<div class="post-metadata">

### Author: ![sckott](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sckott/32/115359_2.png) [@sckott](https://meta.discourse.org/u/sckott)
#### Post date: [April 22, 2016, 2:11am UTC](https://meta.discourse.org/t/testing-a-discourse-api-client-on-travis-ci/42947/3 "2016-04-22T02:11:07Z")

</div>

I have a R client for the Discourse API at [GitHub - sckott/discgolf: Discourse API R client · GitHub](https://github.com/sckott/discgolf)

My test suite currently uses a Discourse installation I maintain. I’d prefer to test against a Discourse installation setup each time Travis is run (or cached if possible on Travis).

I could test against stored JSON blobs - but I’d like to see if I can test against a running Discourse installation if possible, and not a real installation with real users - that’s why I want one installed for testing.

As far as examples, it’s the entire test suite I want to run, but here is an example testing against the `/posts` route [discgolf/tests/testthat/test-posts.R at master · sckott/discgolf · GitHub](https://github.com/sckott/discgolf/blob/master/tests/testthat/test-posts.R)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [April 22, 2016, 2:15am UTC](https://meta.discourse.org/t/testing-a-discourse-api-client-on-travis-ci/42947/4 "2016-04-22T02:15:00Z")

</div>

Interesting, I guess this is a question of cost, ideally you just run a Digital Ocean droplet with Discourse, keep it up to date and test against that.

But that would cost you a minimum of 5-10 bucks a month. I am not sure how you would wrangle an install of Discourse into travis without incurring a massive upfront delay.

---

<div class="post-metadata">

### Author: ![sckott](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sckott/32/115359_2.png) [@sckott](https://meta.discourse.org/u/sckott)
#### Post date: [April 22, 2016, 3:03am UTC](https://meta.discourse.org/t/testing-a-discourse-api-client-on-travis-ci/42947/5 "2016-04-22T03:03:47Z")

</div>

Right, I’ll just stub out some json instead. Thanks for the help!
