August 2018
Beginner
160 pages
4h 8m
English
You should think of fixtures not only as a means of providing resources, but also of providing supporting code for your tests. By supporting code, I mean classes that provide high-level functionality for testing.
For example, a bot framework might provide a fixture that can be used to test your bot as a black box:
def test_hello(bot): reply = bot.say("hello") assert reply.text == "Hey, how can I help you?"def test_store_deploy_token(bot): assert bot.store["TEST"]["token"] is None reply = bot.say("my token is ASLKM8KJAN") assert reply.text == "OK, your token was saved" assert bot.store["TEST"]["token"] == "ASLKM8KJAN"
The bot fixture allows the developer to talk to the bot, verify responses, and check the contents ...
Read now
Unlock full access