# Running CI Tests Locally

**URL:** https://meta.discourse.org/t/running-ci-tests-locally/186505
**Category:** Development
**Created:** [April 12, 2021, 1:57pm UTC](https://meta.discourse.org/t/running-ci-tests-locally/186505 "2021-04-12T13:57:52Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Grayden\_Shand](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/grayden_shand/32/166586_2.png) [@Grayden\_Shand](https://meta.discourse.org/u/Grayden_Shand)
#### Post date: [April 12, 2021, 1:57pm UTC](https://meta.discourse.org/t/running-ci-tests-locally/186505/1 "2021-04-12T13:57:53Z")

</div>

I just opened my first PR (🎉)  
[https://github.com/discourse/discourse/pull/12674](https://github.com/discourse/discourse/pull/12674)

And unfortunately it failed one of the CI checks, specifically: `core backend > Core RSpec`. And the particular test it failed on is: `TopicsController#invite when logged in when user is a group manager should attach group to the invite.`

I want to reproduce this test failure locally so I can tell whether or not I’ve fixed the problem before committing new code.

However, I can’t find any documentation on running tests locally.

Can anyone get me started?

---

<div class="post-metadata">

### Author: ![Grayden\_Shand](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/grayden_shand/32/166586_2.png) [@Grayden\_Shand](https://meta.discourse.org/u/Grayden_Shand)
#### Post date: [April 12, 2021, 2:25pm UTC](https://meta.discourse.org/t/running-ci-tests-locally/186505/2 "2021-04-12T14:25:18Z")

</div>

Found it here:  
[https://github.com/discourse/discourse/blob/master/docs/DEVELOPMENT-OSX-NATIVE.md#now-test-it-out](https://github.com/discourse/discourse/blob/master/docs/DEVELOPMENT-OSX-NATIVE.md#now-test-it-out)

To run tests run

```plaintext
bundle exec rspec

```

Importantly, before doing this you should set your `RAILS_ENV` env variable to ‘test’

```plaintext
RAILS_ENV=test

```

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [April 12, 2021, 2:46pm UTC](https://meta.discourse.org/t/running-ci-tests-locally/186505/3 "2021-04-12T14:46:08Z")

</div>

> [@Grayden\_Shand](#):
>
> I just opened my first PR (🎉)

Awesome!

> [@Grayden\_Shand](#):
>
> And unfortunately it failed one of the CI checks, specifically: `core backend > Core RSpec` . And the particular test it failed on is: `TopicsController#invite when logged in when user is a group manager should attach group to the invite.`

Since your PR deals with frontend code only, I don’t think the test failure is related to it. It’s a backend failure, most likely a flakey test (i.e. a test that sometimes fails).

---

<div class="post-metadata">

### Author: ![Grayden\_Shand](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/grayden_shand/32/166586_2.png) [@Grayden\_Shand](https://meta.discourse.org/u/Grayden_Shand)
#### Post date: [April 12, 2021, 3:05pm UTC](https://meta.discourse.org/t/running-ci-tests-locally/186505/4 "2021-04-12T15:05:18Z")

</div>

> [@pmusaraj](#):
>
> Since your PR deals with frontend code only, I don’t think the test failure is related to it. It’s a backend failure, most likely a flakey test (i.e. a test that sometimes fails).

Super helpful to know, thanks Penar!
