2
votes
1answer
187 views

equals and hashcode methods autogenerated, is it always a good practice?

Preamble: Let's say I aim to cover all my classes with test coverage. Despite the common opinion (expecially in Java community) to "not pay too much attention to Cyclomatic Complexity (CC) and code ...
15
votes
5answers
854 views

Is this pattern bad? [duplicate]

I notice that when I code I often use a pattern that calls a class method and that method will call a number of private functions in the same class to do the work. The private functions do one thing ...
9
votes
1answer
552 views

Is there a modern replacement for a mutation testing tool like Jester for Java?

“Why just think your tests are good when you can know for sure? Sometimes Jester tells me my tests are airtight, but sometimes the changes it finds come as a bolt out of the blue. Highly ...
4
votes
7answers
446 views

Should I spend time prettifying unit tests? [closed]

The company I used to work for before we had automated unit tests to test our work. However the coding standards and architecture was not very important for tests. Of course you had to indent code ...
10
votes
5answers
672 views

Is adhering to one assert per test foolish consistency in this case?

I have a class that I'm testing. The class has a function: apply(List<IRule> rules, List<ITarget> targets); In one test I want to ensure that each target has been passed to one rule, a ...
7
votes
6answers
814 views

Should we exclude code for the code coverage analysis?

I'm working on several applications, mainly legacy ones. Currently, their code coverage is quite low: generally between 10 and 50%. Since several weeks, we have recurrent discussions with the ...
8
votes
2answers
597 views

Unit Testing: “It's a code smell if you're refactoring and there are no collaborators”?

I'm reading The Art of Unit Testing by Roy Osherove. I'm at section 7.2 Writing maintainable tests where the author has this note about code smell: NOTE: When you refactor internal state to be ...
7
votes
4answers
766 views

How should I test my TEST code?

One of the few things that most software developers agree on is that you shouldn't rely on code to work correctly unless you test it. If you don't test it, it may have hidden bugs that are only ...
21
votes
7answers
1k views

Quality of Code in unit tests?

When writing unit tests, is it worth spending the extra time to make the code have good quality and readability? When writing tests I often break the Law of Demeter, for faster writing and to avoid ...
26
votes
6answers
931 views

Unit and Integration testing: How can it become a reflex

All the programmers in my team are familiar with unit testing and integration testing. We have all worked with it. We have all written tests with it. Some of us even have felt an improved sense of ...
8
votes
5answers
646 views

Is it OK to repeat code for unit tests?

I wrote some sorting algorithms for a class assignment and I also wrote a few tests to make sure the algorithms were implemented correctly. My tests are only like 10 lines long and there are 3 of ...
46
votes
12answers
2k views

If your unit test code “smells” does it really matter?

Usually I just throw my unit tests together using copy and paste and all kind of other bad practices. The unit tests usually end up looking quite ugly, they're full of "code smell," but does this ...
2
votes
2answers
214 views

How can Agile methodologies be adapted to High Volume processing system development?

I am developing high volume processing systems. Like mathematical models that calculate various parameters based on millions of records, calculated derived fields over milions of records, process huge ...
20
votes
8answers
1k views

What are the disadvantages of writing code before writing unit tests?

I have always seen the recommendation that we should first write unit tests and then start writing code. But I feel that going the other way is much more comfortable (for me) - write code and then the ...
20
votes
11answers
3k views

How much Code Coverage is “enough”?

We are starting a push for code coverage here at my work, and it has got me to thinking.... How much code coverage is enough? When do you get to the point of diminishing returns on code coverage? ...