Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Flaky Tests - Fighting Nightmares

Flaky Tests - Fighting Nightmares

"A liar will not be believed even if he tells the truth" - Aesop

A test can also be such a liar: Unreliable tests are living nightmares for anyone who writes automated tests or even pays attention to their results. Sometimes they pass, sometimes they don't, and therefore do not give a valid statement about the state of the software. In the worst case, they can impair the credibility of the entire test suite. It doesn't matter whether you write unit, integration or end-to-end tests, you can counter them in any way you like.

I've spent hours and hours on such tests, and I want to share my path through them and the lessons learned from them: So that together we can avoid or even get rid of these nightmares.

Ramona Schwering

March 17, 2023
Tweet

More Decks by Ramona Schwering

Other Decks in Programming

Transcript

  1. Cypress._.times(10, () => {
    describe('Description', () => {
    it('runs 10 times', () => {
    //...
    });
    });
    });

    View full-size slide

  2. describe('Customer login', () => {
    let customer = {};
    beforeEach(() => {
    // Set application to clean state
    cy.setInitialState()
    .then(() => {
    // Create test data
    return cy.setFixture('customer');
    })
    }):
    // … tests will start below
    })

    View full-size slide

  3. {
    "retries": {
    // Configure retry attempts for `cypress run`
    // Default is 0
    "runMode": 2,
    // Configure retry attempts for `cypress open`
    // Default is 0
    "openMode": 0
    }
    }

    View full-size slide