Skip to content
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

Added a bot test mode #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jpjpjp
Copy link
Contributor

@jpjpjp jpjpjp commented Mar 15, 2018

Added the ability to run the emulator in "bot test mode" if the environment BOT_UNDER_TEST is set to an email of one of the identities specified in tokens.json. When this occurs the emulator will intercept responses sent to test requests that have an X-Bot-Responses header. It will wait until it gets requests from the BOT_UNDER_TEST and build a consolidate response body so that that a test framework can inspect the bot requests that were generated in response to any given test input.

@ObjectIsAdvantag
Copy link
Owner

I'll need more background here certainly. Can you provide an example of how this feature would be used.

If something needed to tweak or consolidate payload depending on HTTP Headers, I would opt for a proxy architecture, such as the one I created for the webhook-affinity proxy

If a bot test framework was to be built, I would suggest to add an instrumentation mode (which is certainly close to the BOT_UNDER_TEST env proposed here), so that the emulator would send real-time notifications, or may be add some kind of "monitor feature" like Spark has for Cisco internal needs. Again let's start from a sample of what needs to be achieved.

@jpjpjp
Copy link
Contributor Author

jpjpjp commented Mar 21, 2018

Here's a project with an example: https://github.com/jpjpjp/bot-test-framework-example

@ObjectIsAdvantag ObjectIsAdvantag self-requested a review March 22, 2018 08:54
Copy link
Owner

@ObjectIsAdvantag ObjectIsAdvantag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I finally got more time to dig into this PR
Now looking at the best way to integrate 3rd party middleware to the emulator, so that the bot-test tool could integrate incremental updates & fixes from the emulator.
I see 2 possible approaches:

@ObjectIsAdvantag
Copy link
Owner

Note: I've integrated the non bot-test related parts of the PR:

  • the PUT /memberships/:id not implemented

Copy link
Owner

@ObjectIsAdvantag ObjectIsAdvantag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

About:

POST /messages create a new message.

I am not getting this mention, since this is not a Webex feature. If it something specific to the bot-test module ?

If the payload includes a personId, will create a new one on one space if one does not already exist. (personEmail not yet supported)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants