December 2018
Beginner to intermediate
404 pages
10h 14m
English
Now, let's expand the test_button_test() method seen in our initial skeleton. The simplest tests run some code on the tested object, get a result, and then use an assert statement to compare it with an expected result.
To check the method posting a message, the test counts the number of messages before and after running the wizard to confirm whether the new message was added. To run the wizard, we need to set the active_ids in the context, like UI forms do, create the wizard record with the values filled in the wizard form (at least the body message), and then run the button_send method.
The full code looks like the following:
def test_button_send(self): "Send button creates messages on Checkouts" # Add test code msgs_before ...
Read now
Unlock full access