The code duplication is evil and should be fixed.
We have a lot of code duplication in a bunch of test cases which all set up certain scenarios in a rather complicated test environment for performing the actual tests. In many cases this setup code (a screen full of code or two) is simply copied, most likely because the entire new test case is started as a copy of an existing test case. A few modifications in the setup are made to suit this particular case.
Now over time, differences creep in.
The test environment is improved and offers new convenience methods. Some tests need only three objects under test, not four. Formatting is changed, within the permitted spectrum.
Over time each test case looks a little different. In order to see what is different within all the noise you have to actually copy and paste that code segment into a diff program of your choice. Little changes can be essential. It becomes impossible to tell whether the differences are necessary or arbitrary. The test case becomes impossible to understand quickly. It becomes hard to tell whether the test environment is set up correctly at all.
This code redundancy is terrible and must be eliminated with extreme prejudice. The replacement is a function which performs the setup. It caters to the different needs of the test cases through parametrization. The differences in the setup between test cases can now be immediately understood from the different arguments: Start up one or two objects under test? To which state? Perform full initialization? etc.
Because the function has been thoroughly reveiwedreviewed and debugged and is heavily used, we can rely on it. When it finishes, we can be sure the correct scenario has been set up. There is a separation of concerns (even though that does not apply to your use case). All errors now come from the actual test, or its object.
(I have not even mentioned the usual and valid objection against code duplication, namely that it is badly maintainable when you want to change something in the duplicated code.)