-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define and document testing patterns for scripts #985
Comments
Whoops, completely forgot about hubotio/generator-hubot#45 |
💯 ❌ 👍 I've mentioned elsewhere we're using the hubot-mock-adapter, with some helpers. It's a pretty simple framework on top of it, so probably can be extracted. Here's an example script with test and the helper: https://gist.github.com/technicalpickles/971b40520fb8db63a6f4 |
💯 👍 This is very much needed. I don't think I can even use Hubot for all the things I want to do, because it is difficult/convoluted to try to test it. These workflows include: Incoming webhook -> Channel message or attachment I think it might just be easier to make my own smaller bot. It won't do as much or have access to all the community scripts (without porting them), but at the same time, it doesn't need to. I've read up on the hubot-test-helper and hubot-mock-adapter. |
I was recently upgrading our Hubot instance and tests, and https://github.com/mtsmfm/hubot-test-helper worked great! So far it's the only working test framework I've found. I wrote an article about it here. |
@mdelagrange I think you mixed up your links. You double linked to the GitHub repo. Looking forward to reading the article! |
Oops, thanks @michaelansel. Fixed! |
Excellent writeup! Hopefully that can get people building some form of tests until we develop an official pattern (unless you would like to do that! 😉) |
I'd love to take a crack at it. I'll give it a go soon. |
Starting to fix hubotio/hubot#985 by adding hubot-test-helper from @mtsmfm to the script template
I have a couple of pull requests open for Hubot testing patterns. hubotio/generator-hubot#61 adds testing of Hubot responses to the script generator, and #1094 shows sample tests for the default script from the robot generator. |
Unit testing of scripts is pretty poor right now and there is no recommendation in the documentation on how testing should be done.
There are some thoughts in #873 about a new script pattern that might better enable testing.
We need a pattern that enables both unit testing of script components and functional testing of the overall script. It would be nice if functional tests could be reused by a larger test harness.
Some code that looks useful:
https://github.com/mtsmfm/hubot-test-helper
https://github.com/blalor/hubot-mock-adapter
Once a pattern gets figured out, we should bake it into the generator.
The text was updated successfully, but these errors were encountered: