TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

On the Relation Between Unit Testing and Code Quality

2 pointsby bsdzalmost 6 years ago

2 comments

pattuskalmost 6 years ago
&gt; The sample consisted of data from both Brazilian and Swedish companies, comprising IT departments at one large online media and social networking company with around 5,000 employees, one smaller software life-cycle consultancy company with around 35 employees, and one company that offers programming courses to individuals and companies (around 100 employees), one multinational networking and telecommunications equipment and services company (with around 115,000 employees), an aerospace and defence company (with around 14,000 employees), and an automotive parts manufacturing company (with around 160,000 employees).<p>I may have read the article wrong, but it seems they are evaluating the impact of unit testing on code quality at fairly well-established companies where unit testing is already part of the workflow (along with versioning, bug tracking, etc...)<p>To me, this seems like it would introduce a strong bias: these companies are more likely to employ experienced and highly skilled developers than non-IT shops. What I would be interested in seeing is the effect of introducing unit testing in a team that does not currently use it.<p>I remember that as a junior dev, starting to practice unit testing was incredibly profitable in terms of discipline and code clarity&#x2F;quality. Of course now, I can certainly write reliable and clear code without unit tests. But I don&#x27;t think I would be able to do so as effectively and quickly had I not been unit testing my code for most of my career.<p>I don&#x27;t think companies that do not practice unit testing are a minority, even nowadays. As a consultant I&#x27;ve worked for Fortune 500 companies (non IT, but finance, banking, entertainment...) that did not even have a git nor a bug tracker and where most of the team had never heard of testing. I&#x27;ve also found this to be more common than I would have expected among data science teams. To me these are the shops that would benefit the most from switching to a TDD approach, and this is where the measurement should happen. Not at a &quot;social networking company with around 5,000 employees&quot; where everybody has been practicing it for years...
bsdzalmost 6 years ago
Interesting that the authors concluded there&#x27;s no strong causal relationship between unit test coverage and the number of defects or perceived code quality.<p>I felt that perhaps defects detected by tests during original coverage might have been overlooked. It seems they were examining the defects detected by only increasing coverage.<p>Maybe some of the code coverage they studied were simple smoke tests without much granularity.<p>Code quality perception is probably very subjective.