Code duplication in tests is not bad.

Change my mind.

Follow

@musicmatze Hm...as always "it depends".
For code that is in the "Arrange-Act"-section of your test: Yes, code duplication is NOT bad.

For code that is in the "Assert"-section, I'd say, it makes sense to have a single function, especially, if you must assert *multiple* things on an object: `assert_complex(expected_value, actual_value);`

For Arrange-Act-Assert pattern see here:
freecontent.manning.com/making

@robby

· · Web · 0 · 0 · 2
Sign in to participate in the conversation
Mastodon for Tech Folks

This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!