# Running Sensu plugins test locally

**URL:** https://discourse.sensu.io/t/running-sensu-plugins-test-locally/897
**Category:** Sensu Plugins
**Created:** [May 21, 2018, 9:56am UTC](https://discourse.sensu.io/t/running-sensu-plugins-test-locally/897 "2018-05-21T09:56:14Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Satendra\_Tiwari](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@Satendra\_Tiwari](https://discourse.sensu.io/u/Satendra_Tiwari)
#### Post date: [May 21, 2018, 9:56am UTC](https://discourse.sensu.io/t/running-sensu-plugins-test-locally/897/1 "2018-05-21T09:56:14Z")

</div>

Hi all,

I am trying to setup (development env. for) one of the sensu plugins ([opsgenie](https://github.com/sensu-plugins/sensu-plugins-opsgenie)). When I run rake default, I am getting the following error:

LoadError:

cannot load such file – spec\_helper

# ./test/integration/helpers/serverspec/check-heartbeat-shared\_spec.rb:3:in `require’

# ./test/integration/helpers/serverspec/check-heartbeat-shared\_spec.rb:3:in `\<top (required)\>’

Also, the [link](http://sensu-plugins.io/infra/b_and_r.md) to build and release in documentation is broken. Any kind of help is highly appreciated.

---

<div class="post-metadata">

### Author: ![majormoses](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/majormoses/32/62_2.png) [@majormoses](https://discourse.sensu.io/u/majormoses)
#### Post date: [November 6, 2018, 4:35am UTC](https://discourse.sensu.io/t/running-sensu-plugins-test-locally/897/2 "2018-11-06T04:35:45Z")

</div>

Regarding the B&R docs we are not maintining the [sensu-plugins.io](http://sensu-plugins.io) site anymore, it was a community maintained project and the resources that have access are no longer active on the project. You can find documentation in:

- [https://github.com/sensu-plugins/community](https://github.com/sensu-plugins/community)
- [https://docs.sensu.io/plugins/1.0/](https://docs.sensu.io/plugins/1.0/)

You can can see the list of `rake` tasks we create by running:

```auto
$ bundle exec rake -T
rake build # Build sensu-plugins-opsgenie-4.3.0.g...
rake check_binstubs # Test for binstubs
rake clean # Remove any temporary products
rake clobber # Remove any generated files
rake install # Build and install sensu-plugins-opsg...
rake install:local # Build and install sensu-plugins-opsg...
rake integration # Alias for kitchen:all
rake kitchen:all # Run all test instances
rake kitchen:converge:all # Run all converge instances
rake kitchen:create:all # Run all create instances
rake kitchen:destroy:all # Run all destroy instances
rake kitchen:ruby-21-debian-8 # Run ruby-21-debian-8 test instance
rake kitchen:ruby-22-debian-8 # Run ruby-22-debian-8 test instance
rake kitchen:ruby-230-debian-8 # Run ruby-230-debian-8 test instance
rake kitchen:ruby-241-debian-8 # Run ruby-241-debian-8 test instance
rake kitchen:setup:all # Run all setup instances
rake kitchen:verify:all # Run all verify instances
rake make_bin_executable # Make all plugins executable
rake release[remote] # Create tag v4.3.0 and build and push...
rake rubocop # Run RuboCop
rake rubocop:auto_correct # Auto-correct RuboCop offenses
rake spec # Run RSpec code examples
rake yard # Generate YARD Documentation

```

I will have to look into why it fails when you run the tests via the `default` task but I verified that when you run the tests via `bundle exec rake kitchen:ruby-241-debian-8` or similar they work as expected. This spins up a docker container based on `debian jessie` with a “slim” ruby environment.

If you are more interested about learning about testing plugins I have written the following posts that walk through it in more detail:

- [https://blog.sensu.io/our-approach-to-testing-sensu-plugins-869260eba94c](https://blog.sensu.io/our-approach-to-testing-sensu-plugins-869260eba94c) which is a bit more focused on general testing principles
- [https://blog.sensu.io/writing-sensu-plugin-tests-with-test-kitchen-and-serverspec-b646d2eeee51](https://blog.sensu.io/writing-sensu-plugin-tests-with-test-kitchen-and-serverspec-b646d2eeee51) which gets into the nitty gritty details of bootstrapping a plugin for testing from scratch

---

<div class="post-metadata">

### Author: ![aaronsachs](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/aaronsachs/32/47_2.png) [@aaronsachs](https://discourse.sensu.io/u/aaronsachs)
#### Post date: [April 1, 2019, 10:21pm UTC](https://discourse.sensu.io/t/running-sensu-plugins-test-locally/897/3 "2019-04-01T22:21:36Z")

</div>

This topic was automatically closed after 20 days. New replies are no longer allowed.
