You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
Required fields*
-
5I'm going to disagree at least partially. Saying "see how long it takes to notice" is just against the point of having tests. The tests are supposed to tell me if it's broken. Structural code is obviously as important as any other code because if I were to break it my whole app would be broken.Derek C.– Derek C.2021-06-30 22:08:37 +00:00Commented Jun 30, 2021 at 22:08
-
15@DerekC I didn’t say “see how long it takes them to notice.” I said “see how long it takes them to find the problem”. Some people obsess on having the finest grained tests without sanity checking or realizing they’re up against the law of diminishing returns.candied_orange– candied_orange2021-06-30 22:14:28 +00:00Commented Jun 30, 2021 at 22:14
-
21I wish more people talked about diminishing returns in the World of Testing.T. Sar– T. Sar2021-07-01 16:15:52 +00:00Commented Jul 1, 2021 at 16:15
-
4Exactly what I came here to say. When the unit test for your code looks almost exactly the same as the code itself, you have achieved the near-perfection of "obviously correct code". Just like "self-documenting code" doesn't need comments, "obviously correct code" doesn't need unit tests. When you write code like this, congratulate yourself, and skip the test.JounceCracklePop– JounceCracklePop2021-07-01 17:42:09 +00:00Commented Jul 1, 2021 at 17:42
-
2@JounceCracklePop My experience here differs. My experience is that code with tautological tests is often code which mixes concerns so haphazardly that that was the only way the developer could think to test it. Refactoring it to separate concerns better would have been a good move (and when adequately refactored, it would hopefully look like the ideal code you mention), but if not, this is where the advice to "throw an integration test at it" makes sense, since the behaviour of such code is often an emergent property of the way it's wired together.James_pic– James_pic2021-07-02 11:05:01 +00:00Commented Jul 2, 2021 at 11:05
|
Show 1 more comment
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
-
create code fences with backticks ` or tildes ~
```
like so
``` -
add language identifier to highlight code
```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible)
<https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. design-patterns), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you