neilwatson has asked for the wisdom of the Perl Monks concerning the following question:

Greetings,

I'm building an IRC bot. On advice I'm looking at Bot::BasicBot which is built on the POE modules. How does one go about building a test suite for bot functionality? The event loop structure of a bot does not seem to lend itself to typical ok, is, isnt tests of Test::More. Do I have to build a second bot and test them against each other?

Neil Watson
watson-wilson.ca

Replies are listed 'Best First'.
Re: Test suite for an IRC bot
by RonW (Parson) on Jun 24, 2015 at 20:46 UTC

    Disclaimer: This response is generic. I don't know much about the POE event framework.

    Your tests could call the functions that would otherwise by called by the event manager.

    As for testing your bots interaction with the IRC server, you could try running a basic, command line IRC client via the Expect module. Otherwise, a very basic "bot" with 2 functions that are called by the test scripts: recv_msg and send_msg. Either way, your test script "pokes" your bot-under-test, monitors what's seen on IRC, sends messages on IRC and monitors your bot's reactions to the messages it receives.