sensu-plugin icon indicating copy to clipboard operation
sensu-plugin copied to clipboard

Redo Testing framework

Open zbintliff opened this issue 9 years ago • 3 comments

Instead of just testing IO and sub-process as the plugin currently does.

Should we use spec (or minitest) to test the base classes? Here is an example test document for a check. And here is an example test cases for a handler/mutator.

zbintliff avatar Jan 19 '16 22:01 zbintliff

There is an issue with the above linked spec for the check in taht it always exits 0. But after https://github.com/sensu-plugins/sensu-plugin/pull/116 is merged then we can use the format in the second example (set autorun to false)

zbintliff avatar Jun 06 '16 17:06 zbintliff

@zbintliff any ideas about how we move forward on this?

cwjohnston avatar Jul 20 '16 22:07 cwjohnston

So threw this together super fast so its definitely lacking. But take a look at this. I converted everything to rspec and wrote 2 test basic test cases for sensu-handler and sensu-plugin.

I chose rspec because it seems that what all the actual plugins are using. I can keep working on this when I get some free time this week to build a better example.

But basically every file will have an accompanying _spec.rb and that will test only the functions within that file. That way we have more insight into the plugins other than input and output. If this is what you're interested in I will be happy to help.

zbintliff avatar Jul 21 '16 00:07 zbintliff