We have tried to educate the developers not to add items in the middle by sending the information out in emails, mentioning this in team meetings, and even putting comments in the code. Without fail though, someone will be in a hurry and forget about this and the next time someone goes to test the web application, it will have been broken.
Google Mock has a way to group expectations into a sequence that will cause the test to fail if not used in the proper order.
using ::testing::InSequence; { InSequence pipeDelimitedStringOrder; EXPECT_CALL(...)...; EXPECT_CALL(...)...; ... EXPECT_CALL(...)...; }
Now if a developer goes to change this method, they will see that the tests fail and will (hopefully) add any new methods to the end of the list.
No comments:
Post a Comment