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

WIP Protocol testrunner #264

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

WIP Protocol testrunner #264

wants to merge 6 commits into from

Conversation

prawnsalad
Copy link
Member

No description provided.

$ node test_protocol/proto_tests.js

Working:
- TestRunner embeded as a transport, taking in reads/writes + events
- TestRunner scripts executing against traffic + events

ToDo:
- Much tidying
- File structure could do with being tidier
- Loading TestRunner scripts from ./*.txt
- Wrap TestRunner as a jest test
- Include TestRunner in prod builds? Could be useful for protocol testing in live builds
- Actually write some protocol test scripts
@prawnsalad
Copy link
Member Author

Todo:

  • RESET command needs to wait until the bot instance has been fully destroyed before re-creating it
  • Go over the commands. READWAIT and EVENTWAIT feels weird to use in a script
  • Document each script command

@xPaw
Copy link
Collaborator

xPaw commented Oct 8, 2020

I feel like RESET is just asking for trouble with state that may not reset. Isn't it easier to just have separate test files?


describe('protocol test runners', async function() {
it('should run all protocol test scripts', async function() {
await TestProtocol()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we not want to hook it into the tests a little bit better, so each test becomes it and gets reported correctly by the test software?

bot.on('registered', function() {
bot.join('#prawnsalad');
});
bot.on('join', event => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are these events temporary? Should be in the txt files.

@xPaw
Copy link
Collaborator

xPaw commented Oct 8, 2020

One thing that I just realized, is that we will probably want a mechanism to call methods on IrcClient to test that it sends correct command.

Something like:

CALL invite #chan someone
READ INVITE someone #chan

Things like inviteList might be trickier, as it needs a callback.

@prawnsalad
Copy link
Member Author

we will probably want a mechanism to call methods on IrcClient

This is what hit me yesterday too. And to support something like EXPECT client bot.some.prop=foo for checking client vars.

Things like the bot.join() that's currently in test_protocol/ shouldn't be there and will be needed for only some tests so we need a way to mix js+the test script without it getting messy. I'm not entirely sure on the best way for this yet... ideas?

@xPaw
Copy link
Collaborator

xPaw commented Oct 8, 2020

Things like the bot.join()

Well this particular example would be solved by the ability to call methods on ircclient. If there needs to be a way to mix with js, perhaps such tests should just be written in JS entirely instead of being parsed from txt file?

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.

None yet

2 participants