Urgent.News

What's breaking now, across thousands of outlets.

Tech

My tests could fail. They still could not tell me I was wrong.

A test proves your code does what you meant. It cannot prove that what you meant was correct. I could have written that sentence a year ago. I still shipped on the wrong side of it this week. Here is the assertion I was leaning on: assert . equal ( sumOf ( splits ), transaction . total ) A transaction split across several categories has to add up to the total. That is a real invariant, and the…

A test can fail without confirming that the code is incorrect. The writer still shipped with the wrong result this week. The test being used was: assert.equal(sumOf(splits), transaction.total). This test can't catch if the sign convention is reversed, as both sides of the equation come from the code. The writer builds software to convert IIF files into QIF format for small business accounting software.

One example of the conversion: $150 split between two categories, with the IIF file showing a negative amount and the QIF file showing positive amounts. The mutation test revealed that flipping a correct sign would make the test fail, while flipping an incorrect sign would also make the test fail. This shows that the test doesn't verify whether the code is correct.

The writer builds a QIF file to test the conversion, with the goal of finding a sign error. The test fails, and the writer realizes that the bug is not related to signs but rather to how QIF handles payee and memo fields. The writer discovered that IIF carries both payee and memo fields, while QIF only has a payee field. The generator writing code assumed that description was equal to MEMO or NAME, which caused the payee field to be lost.

The bug was found after reading the whole code chain and realizing that the test is not checking everything the upstream parser produces. The writer learned the importance of testing assumptions, especially when they rely on someone else's software. Writing a test costs time, but it can provide answers that no amount of additional testing can.

In this case, the trade was worth fifteen minutes of testing, as it prevented a hidden bug from causing issues for users.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

AWS Shared Responsibility Model Who Takes Care of What in the Cloud

Boa parte dos incidentes de segurança na nuvem não acontece porque a AWS falhou — acontece porque alguém assumiu, incorretamente, que a AWS cuidaria de algo que na verdade era responsabilidade do…

  • AWS Shared Responsibility Model clarifies security responsibilities in cloud services.
  • AWS responsible for infrastructure security, customer responsible for data and application security.

Three things I got wrong measuring my own cache

A team that produces regulatory documents kept getting the same kind of question from other teams: does the current rule allow X?

  • Overlooked issue with negation pairs, labeling error not caught by testing
  • Control group too easy, minimal token differences between accept/reject pairs
  • Misinterpreted embedder failure as semantics issue, not surface form understanding

Backtesting overfitting: why your backtest lies and how to make it honest

Cross-post. Original: stellarbytecapital.com/blog/backtesting-overfitting A profitable backtest is the easiest thing to produce in all of quant trading, and the most worthless.

  • Overfitting occurs when strategies learn noise in historical data instead of genuine patterns
  • Multiple testing and random noise can create impressive Sharpe ratios by chance
  • Honest backtesting requires out-of-sample and walk-forward testing, avoiding over-optimization

More from Tuesday 25 August →