GithubHelp home page GithubHelp logo

Comments (7)

mtsmfm avatar mtsmfm commented on July 20, 2024

@MatthewMazaika

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.

IAmPatrickB avatar IAmPatrickB commented on July 20, 2024

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.

timkinnane avatar timkinnane commented on July 20, 2024

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.

yozlet avatar yozlet commented on July 20, 2024

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.

timkinnane avatar timkinnane commented on July 20, 2024

@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.

ummaycoc avatar ummaycoc commented on July 20, 2024

Did anything come of this?

from hubot-test-helper.

timkinnane avatar timkinnane commented on July 20, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.