All,<div><br></div><div>I&#39;m looking for some advice on how to assert a side effect produced by testing a function. Specifically, our project has a set of command objects that internally use SQLAlchemy for database access. We would like to have a set of integration tests that load a fixture (using the Fixture project) into the database, execute the command, and assert the results. For commands that return the result, this is straightforward. However, we are debating how to assert commands that create, update, or delete data.</div>
<div><br></div><div>Option 1: In the test, call the CreateCommand then call the GetItemsCommand asserting that the item count has increased. This keeps our test unaware of the implementation detail but it breaks isolation for testing the CreateCommand. My current thought is that this would be ok since it is an integration test.</div>
<div><br></div><div>Option 2: In the test, call the CreateCommand. Subsequently, use a SQLAlchemy query in the test to assert the change in database state. This would keep each test isolated, but it now exposes implementation details.</div>
<div><br></div><div>Your advice would be appreciated. Thanks.</div><div><br></div><div>Shawn</div><div> </div>