Skip to main content
Share Your Experience: Take the 2024 Developer Survey

New answers tagged

0 votes

Refactoring the testing code inside a big switch code block

It looks like the main() method is doing multiple things. This breaks the single responsibility Principle. If you move the switch into a separate method (switchMethod in my example), like you did with ...
Luc Franken's user avatar
  • 2,793
1 vote

Creating Unit and Integration Tests with Database elements

What's not clear from the question is, what things are you actually going to test? You're obviously hooking into the backend of an existing application made by a third party, to supplement its ...
Steve's user avatar
  • 8,977
3 votes

Creating Unit and Integration Tests with Database elements

You need a test database under your own control, regardless whether you create automated tests or going to test manually. So focus on creating one, (where the schema is a copy of the production ...
Doc Brown's user avatar
  • 209k
1 vote

Creating Unit and Integration Tests with Database elements

Dropping and recreating the schema is used for two reasons: A clean DB schema makes for a mostly deterministic test. It simplifies test cleanup. Using an existing schema prevents you from having a ...
Greg Burghardt's user avatar
-3 votes

TDD when removing long lived feature

Most of your failing tests are making an irrelevant assertion. Fix that before performing the change. The test should assert whatever is relevant for the use case it emulates. As you have test ...
Basilevs's user avatar
  • 2,024
2 votes

TDD when removing long lived feature

I think it is hard to give you reasonable advice without knowing the whole system, but my best guess is that you changed the Manager class to not call clearInitialData() anymore, and your test suite ...
Doc Brown's user avatar
  • 209k
7 votes

TDD when removing long lived feature

You are feeling the pain that happens when tests are not written to be independent. Step one is making all of these tests independent. Break the dependency between testInitialDataCleared and all the ...
Greg Burghardt's user avatar

Top 50 recent answers are included