Reputation: 1583
We currently have many unit tests in Python and we're using Pytest. Ideally I'd like to stay with Pytest as that's what the company has elected to be their testing framework of choice. I wonder if people recommend fixtures in Pytest or some other good way to do this.
When doing a quick Google I see people using docstrings to explain their scenarios.
def test_all(self):
"""
GIVEN a PhoneBook with a records property
WHEN the all method is called
THEN all numbers should be returned in ascending order
"""
I wonder if someone has more experience / real world examples in this area and can guide me a bit. In my previous company we wrote methods in C# a rough example being:
authedUser = givenAnAuthenticatedUser()
transactionResult = whenIReconcileATransaction(user, transaction)
result = thenTransactionStatusIsReconciled(transactionResult)
assert result == True
Cheers
Upvotes: 0
Views: 785