Article 67E1E CodeSOD: Testing Your Date

CodeSOD: Testing Your Date

by
Remy Porter
from The Daily WTF on (#67E1E)

"Don't unit test the library/framework code," is a good piece of advice. And yet, it's so often ignored.

Kaylee's co-worker certainly ignored it. They also ignored the basic principle of "ensure the test will work tomorrow."

[Test]public void TestNewDate(){ String date = DateTime.Now.ToShortDateString(); Assert.IsTrue(date == "26/08/2016");}

Now, this test has been in the code base since 2016, as you might guess. It was not disabled or otherwise commented out. "But surely, their CI job would choke on it?" you might wonder. That assumes there is a CI job, and not a batch of tests that developers run manually, 70% of which pass and the remaining 30% have tickets in their ticketing software to get fixed "eventually".

buildmaster-icon.png [Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments