Skip to main content
expand TDD not everyone knows that especially given the context of this question; minor hyphens and italic for book
Source Link

The ability to write useful tests is a hard won-won skill. It is not something that emerges easily when writing tests just because you were told to. You need to have a use for them in mind and do work that proves if they actually are useful.

It doesn't help that there are different philosophies about how it should be done. Some want every class isolated and all its dependencies mocked. Others want only high level-level tests that show some behavior exists in support of some requirement.

TDD (Test-Driven Development) is an art. You really need to practice at home. TDD done halfway makes a nightmarish mess. You'll know when you have a handle on TDD when you do it, not because you're supposed to, but because it makes you faster. If it's slowing you down you're still not ready to do it at work.

Testing for planned refactoring is another story. Michael Feathers' book Working Effectively with Legacy CodeWorking Effectively with Legacy Code is a must read-read if you want to transform a code base with no tests into something else that has some tests that prove that you only changed what you meant to change.

Good tests show expected behavior. Good tests show intent. Good tests show what wasn't thought of. Good tests show how to express what wasn't thought of. Good tests are a handy way to peer review code. "Shouldn't your code do this? Because it doesn't"doesn't."

The ability to write useful tests is a hard won skill. It is not something that emerges easily when writing tests just because you were told to. You need to have a use for them in mind and do work that proves if they actually are useful.

It doesn't help that there are different philosophies about how it should be done. Some want every class isolated and all its dependencies mocked. Others want only high level tests that show some behavior exists in support of some requirement.

TDD is an art. You really need to practice at home. TDD done halfway makes a nightmarish mess. You'll know when you have a handle on TDD when you do it, not because you're supposed to, but because it makes you faster. If it's slowing you down you're still not ready to do it at work.

Testing for planned refactoring is another story. Michael Feathers' book Working Effectively with Legacy Code is a must read if you want to transform a code base with no tests into something else that has some tests that prove that you only changed what you meant to change.

Good tests show expected behavior. Good tests show intent. Good tests show what wasn't thought of. Good tests show how to express what wasn't thought of. Good tests are a handy way to peer review code. "Shouldn't your code do this? Because it doesn't"

The ability to write useful tests is a hard-won skill. It is not something that emerges easily when writing tests just because you were told to. You need to have a use for them in mind and do work that proves if they actually are useful.

It doesn't help that there are different philosophies about how it should be done. Some want every class isolated and all its dependencies mocked. Others want only high-level tests that show some behavior exists in support of some requirement.

TDD (Test-Driven Development) is an art. You really need to practice at home. TDD done halfway makes a nightmarish mess. You'll know when you have a handle on TDD when you do it, not because you're supposed to, but because it makes you faster. If it's slowing you down you're still not ready to do it at work.

Testing for planned refactoring is another story. Michael Feathers' book Working Effectively with Legacy Code is a must-read if you want to transform a code base with no tests into something else that has some tests that prove that you only changed what you meant to change.

Good tests show expected behavior. Good tests show intent. Good tests show what wasn't thought of. Good tests show how to express what wasn't thought of. Good tests are a handy way to peer review code. "Shouldn't your code do this? Because it doesn't."

It doesn't help that there are different philosophies about how it should be done. Some want every class isolated and all it'sits dependencies mocked. Others want only high level tests that show some behavior exists in support of some requirement.

I've come to the conclusion that, much like documentation, the most important thing to consider is a teststest's audience. A test can do a lot of damage if it was meant to prove a functionsfunction's behavior that turns out to be replaceable with a completely different function with a different behavior that can't pass this old test. Such tests are fine in the hands of those that can see that and know to discard the test. But when others get hold of that test and wontwon't let it go, it makes refactoring harder, not easier.

Many argue about what to call these tests. Unit tests, integration tests, acceptance tests, end-to-end tests, automated tests, regression tests. These terms have become meaningless to me because I've seen them used to mean so many different things. I've learned to just keep asking what the term means in this particular shop until it’s clear. II want to know the point of each test. I don't blindly trust the names to tell me that anymore. Burned too many times. "It's a unit test" "Why?" "Because we run it with jUnit" "Ugg"

Testing for planned refactoring is another story. Michael FeathersFeathers' book Working Effectively with Legacy Code is a must read if you want to transform a code base with no tests into something else that has some tests that prove that you only changed what you meant to change.

Good tests show expected behavior. Good tests show intent. Good tests show what wasn't thought of. Good tests show how to express what wasn't thought of. Good tests are a handy way to peer review code. "Shouldn't your code do this? CauseBecause it doesn't"

It doesn't help that there are different philosophies about how it should be done. Some want every class isolated and all it's dependencies mocked. Others want only high level tests that show some behavior exists in support of some requirement.

I've come to the conclusion that, much like documentation, the most important thing to consider is a tests audience. A test can do a lot of damage if it was meant to prove a functions behavior that turns out to be replaceable with a completely different function with a different behavior that can't pass this old test. Such tests are fine in the hands of those that can see that and know to discard the test. But when others get hold of that test and wont let it go, it makes refactoring harder, not easier.

Many argue about what to call these tests. Unit tests, integration tests, acceptance tests, end-to-end tests, automated tests, regression tests. These terms have become meaningless to me because I've seen them used to mean so many different things. I've learned to just keep asking what the term means in this particular shop until it’s clear. I want to know the point of each test. I don't blindly trust the names to tell me that anymore. Burned too many times. "It's a unit test" "Why?" "Because we run it with jUnit" "Ugg"

Testing for planned refactoring is another story. Michael Feathers book Working Effectively with Legacy Code is a must read if you want to transform a code base with no tests into something else that has some tests that prove that you only changed what you meant to change.

Good tests show expected behavior. Good tests show intent. Good tests show what wasn't thought of. Good tests show how to express what wasn't thought of. Good tests are a handy way to peer review code. "Shouldn't your code do this? Cause it doesn't"

It doesn't help that there are different philosophies about how it should be done. Some want every class isolated and all its dependencies mocked. Others want only high level tests that show some behavior exists in support of some requirement.

I've come to the conclusion that, much like documentation, the most important thing to consider is a test's audience. A test can do a lot of damage if it was meant to prove a function's behavior that turns out to be replaceable with a completely different function with a different behavior that can't pass this old test. Such tests are fine in the hands of those that can see that and know to discard the test. But when others get hold of that test and won't let it go, it makes refactoring harder, not easier.

Many argue about what to call these tests. Unit tests, integration tests, acceptance tests, end-to-end tests, automated tests, regression tests. These terms have become meaningless to me because I've seen them used to mean so many different things. I've learned to just keep asking what the term means in this particular shop until it’s clear. I want to know the point of each test. I don't blindly trust the names to tell me that anymore. Burned too many times. "It's a unit test" "Why?" "Because we run it with jUnit" "Ugg"

Testing for planned refactoring is another story. Michael Feathers' book Working Effectively with Legacy Code is a must read if you want to transform a code base with no tests into something else that has some tests that prove that you only changed what you meant to change.

Good tests show expected behavior. Good tests show intent. Good tests show what wasn't thought of. Good tests show how to express what wasn't thought of. Good tests are a handy way to peer review code. "Shouldn't your code do this? Because it doesn't"

added 1 character in body
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369

Probably the best thing you could do is make the point of each test clear enough that those who come after you will have no doubt when it's time to delete the test. This is critical because when in doubt, coders tend to drag old useless tests around.

Probably the best thing you could do is make the point of each test clear enough that those who come after you will have no doubt when it's time to delete the test. This is critical because when in doubt coders tend to drag old useless tests around.

Probably the best thing you could do is make the point of each test clear enough that those who come after you will have no doubt when it's time to delete the test. This is critical because when in doubt, coders tend to drag old useless tests around.

added 59 characters in body
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369
Loading
added 32 characters in body
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369
Loading
added 220 characters in body
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369
Loading
added 1 character in body
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369
Loading
added 25 characters in body
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369
Loading
added 232 characters in body
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369
Loading
added 7 characters in body
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369
Loading
added 168 characters in body
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369
Loading
added 7 characters in body
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369
Loading
deleted 16 characters in body
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369
Loading
added 133 characters in body
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369
Loading
added 133 characters in body
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369
Loading
added 133 characters in body
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369
Loading
added 2 characters in body
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369
Loading
added 8 characters in body
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369
Loading
added 8 characters in body
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369
Loading
added 197 characters in body
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369
Loading
added 3 characters in body
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369
Loading
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369
Loading