Comments (7)
At this time, there is no way to share brain 😢
But I wonder why do you want to share the brain 💫
Could you tell me the context and ideal test code? (the code won't work at the time but I want to know how do you want to write test 😉 )
from hubot-test-helper.
This is something I do as well, but I haven't written tests for my custom scripts yet - in an Enterprise level organization, we have hundreds of rooms our Hubot is in. I've written a few custom scripts to support Authentication based on level of user in a Room, the room a user is in, or the room a request comes from. Ours also provides the ability to message users across rooms by mentioning a nick that's designated to the hubot "i.e. @hubot this room belongs to Perf", then anyone who mentions @Perf the bot will transmit the message to their private room.
I'm looking at implementing some custom test scripts this week, I'll let you know what challenges I run into.
from hubot-test-helper.
Would also like to do this. I'm testing scripts for a platform with many rooms, where use cases need hubot to remember past interactions and context with a user across rooms. Ran into a wall trying to test some uncommon behaviour for fairly specific interactions. e.g. it should respond to a given user in any room, but not other users - or - it will respond to any user in a given room, but not other rooms.
I have similar requirements to this example from Hubot-Conversation but would prefer to find an approach consistent with my other tests using hubot-test-helper.
e.g.
@room1 = helper.createRoom name: 'room1'
@room2 = helper.createRoom name: 'room2'
@room1.user.say 'user1', 'hello its me'
@room2.user.say 'user1', 'its me again'
I discovered one easy tip for anyone trying this, that the httpd: false
option will prevent EADDRINUSE 0.0.0.0:8080
errors from trying to setup multiple concurrent listeners.
from hubot-test-helper.
Here's a really simple test case: I have a hubot script which can be triggered in any room that the bot is in, and the result is that it should emit a message to a configured target room.
Here's the script: https://github.com/18F/18f-bot/blob/master/scripts/love.coffee
Here's the test case I wrote: https://github.com/18F/18f-bot/blob/master/test/scripts/love_test.coffee
However, this test case only works because hubot-test-helper
doesn't differentiate between rooms in which the message is being emitted. Ideally, the test case should involve two rooms, emit the trigger message in the first room, and assert that the result message is emitted in the second room.
EDITED TO ADD: @timkinnane, I only just noticed hubot-pretend
. Nice! I'll try rewriting the test with that when I get a moment.
from hubot-test-helper.
@yozlet - Cool! You'll be the first user afaik. I think it's pretty good and have used it extensively in my own project. I tried to write clear and comprehensive tests, but I'd be really interested to get your feedback - it's easy to miss things when you're the creator and only user.
Have a look here for multi-room test examples.
from hubot-test-helper.
Did anything come of this?
from hubot-test-helper.
@ummaycoc I'm working on a new framework of the whole stack I developed based on hubot, nubot/playbook/pretend - it will provide multi room testing tools, but is still a little way off. If you'd like to get early access please email me: [email protected]
For now, here's the updated link from above, for using Pretend to do multi-room tests...
https://github.com/timkinnane/hubot-pretend/blob/master/test/usage/02-rooms_test.js
from hubot-test-helper.
Related Issues (20)
- how to mock a specific room/channel HOT 2
- ability to test robot.listen HOT 2
- nothing stored in brain HOT 2
- Cannot find module `hubot` HOT 6
- please add support testing scripts that depends on other middle-ware only scripts HOT 4
- Expose the robot logger HOT 4
- test sendPrivate to specific user HOT 1
- Room destroy throws error when httpd is false HOT 5
- running node 6.9.2 'yield' is reserved HOT 20
- Message send in Timeout aren't tracked in room.messages HOT 1
- Doesn't seem to work with custom listeners? HOT 1
- Allow user to require the Hubot script themselves HOT 3
- hubot ^3.0.0 and hubot-test-helper in JS ES2015 HOT 11
- Mock dependencies HOT 1
- Timeout in beforeEach HOT 1
- [Question] Testing adapter-specific send() code HOT 2
- Testing DMs with hubot
- testing exec replies HOT 1
- Updating from 1.7.0 to 1.8.1/1.9.0 breaks HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hubot-test-helper.