4 Matching Annotations
- Nov 2021
-
docs.pytest.org docs.pytest.org
-
You can think of a test as being broken down into four steps: Arrange Act Assert Cleanup Arrange is where we prepare everything for our test. This means pretty much everything except for the “act”. It’s lining up the dominoes so that the act can do its thing in one, state-changing step. This can mean preparing objects, starting/killing services, entering records into a database, or even things like defining a URL to query, generating some credentials for a user that doesn’t exist yet, or just waiting for some process to finish. Act is the singular, state-changing action that kicks off the behavior we want to test. This behavior is what carries out the changing of the state of the system under test (SUT), and it’s the resulting changed state that we can look at to make a judgement about the behavior. This typically takes the form of a function/method call. Assert is where we look at that resulting state and check if it looks how we’d expect after the dust has settled. It’s where we gather evidence to say the behavior does or does not align with what we expect. The assert in our test is where we take that measurement/observation and apply our judgement to it. If something should be green, we’d say assert thing == "green". Cleanup is where the test picks up after itself, so other tests aren’t being accidentally influenced by it. At it’s core, the test is ultimately the act and assert steps, with the arrange step only providing the context. Behavior exists between act and assert.
Tags
Annotators
URL
-
-
benn.substack.com benn.substack.com
-
Rather than being led by a single ambiguously defined and overburdened CDO, data teams should have two representatives in senior management: A VP of data responsible for managing the team’s daily operations, and a chief analytics officer.
Tags
Annotators
URL
-
-
notes.andymatuschak.org notes.andymatuschak.org
-
Q. What bad habit do I often fall into when writing evergreen notes in preparation for public writing?A. I’ll try to do my public writing as part of my first pass on the notes.Q. Why do I often find myself stuck when I try to write evergreen notes as publishable prose for an audience?A. When a topic is hard enough to distill on its own, the extra cognitive load of considering a reader overwhelms me.
Tags
Annotators
URL
-