Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ignored-test

Level: warn · Article: Tests

The week the senior engineer who understood the mock setup leaves the company and nobody knows why three tests are marked .skip.

What it checks

#[ignore] without a reason. #[ignore = "..."] is the documented exception and never fires.

Don’t

#![allow(unused)]
fn main() {
#[ignore]
#[test]
fn transfers_between_accounts() {
    let bank = Bank::sandbox();
    bank.transfer(Account::Alice, Account::Bob, Money::cents(500));
    assert_eq!(bank.balance(Account::Bob), Money::cents(500));
}
}

Do

#![allow(unused)]
fn main() {
#[ignore = "needs the payments sandbox; run nightly, see PAY-431"]
#[test]
fn transfers_between_accounts() {
    let bank = Bank::sandbox();
    bank.transfer(Account::Alice, Account::Bob, Money::cents(500));
    assert_eq!(bank.balance(Account::Bob), Money::cents(500));
}
}

The reason says whether the test may run again, and who to ask.

Silence it

Add the reason. That is the fix.