The survey of 450 Java developers also found that Spring users spend 25% of their time on tests, while non-Spring users spend 20% of their time on tests.
Mathew Lodge, CEO of AI-powered automated test solution provider DiffBlue, which sponsored the survey, said the results are an example of how tooling can help organizations adopt a certain way of working. “Everyone talks about cultural change, and the culture of testing, and good tooling helps people do the right things,” he said. “Spring has really great support for unit testing and testing in general.”
RELATED CONTENT: What’s in Java 16
Lodge noted that respondents said the primary benefit of Spring/Spring Boot is that it saves them time, but the second most important benefit to them is that the framework makes it easier for developers to write unit tests in the first place.
But, paradoxically, even spending that much time writing and maintaining tests, 45% of the survey respondents say they have less than 50% test coverage of their code; 37% said their coverage falls between 26% and 50%; while another 6% said they have complete code coverage. Of that last 6%, all are Spring users. “That just highlights how difficult it is to do unit testing,” Lodge said.
Some in the industry argue that 100% code coverage isn’t necessary; rather, organizations should focus on the areas that have the greatest impact on the user and on security. But Lodge said, “The danger is you don’t really know what you don’t know in that situation.”
He went on to say, “We try and write the smallest number of tests possible to get the maximum coverage, because you want to have as few tests as possible, so they’re easier to understand. And, you don’t get … 100 tests failing when you change one thing.”
Hand in hand with that, developers were asked to describe their organization’s code in the following terms that apply — reliable, maintainable, testable, portable, automated and modern. Most (51%) respondents described their code as reliable; 50% chose modern and 40% chose maintainable. And, despite respondents indicating they spend a quarter of their time on testing, only 37% described their code as testable. Spring users were most likely to describe their code as maintainable.
The survey report noted that DiffBlue Cover was described by 39% of respondents as “very useful,” trailing only JUnit (44%) and TestNG (40%). Parasoft’s JTest was fourth at 38%.
The survey, though, did not answer this question: Does Spring help developers be better testers, or do better testers use Spring? Spring/Spring Boot developers, according to the survey report, tend to value unit testing more highly than non-Spring users; tend to have higher quality and more maintainable code, and have better code coverage in their organizations.
Read the complete survey here.