New answers tagged

0

First of all let's make sure that we use the same names: We have unit tests that we run on DEV Unit test should be independent of any environment: No database, message queue or external environment. You should ideally try to make a lot of this cheap and fast test. Some integration test may use an in memory database or TestContainers with test data that is ...


5

You create tests to prove that something works correctly, and you re-execute those tests to prove that it still works correctly. For determining if it makes sense to run a particular set of tests in multiple environments, you need to check what the differences are between those environments and if those differences might have an effect on the outcome of the ...


0

Your code is supposed to be tested before it enters production. That is the whole point of your test effort. Unit tests are meaningful in development, you run those before you commit code to your version control system. Now the behavior of your application may depend on the moon phase which could make it beneficial to continuously run tests in production so ...


1

I don't have enough reputation to comment, but I'll follow up on what @Kain0_0 said and your comments to his answer. If you mock your Bar dependency, you don't need to mock out its dependency of Baz too - the mock allows you to ignore that Bar even depends on Baz! With concrete objects, this may seem weird, but if you extract interfaces for your Baz and Bar ...


1

Mocks Mock out the Bar object. That way you need only understand what Foo is expecting out of Bar, which is reasonable for a Unit Test. Builders If you need real data, it might pay to architect a Builder. The Builder Object would have an interface (usually fluent, but do you) that would allow a developer to succinctly describe a number of common forms of ...


Top 50 recent answers are included