Skip to content

☂️ Skip test audit 2021 #86396

Closed
Closed

Description

@darrenaustin

[Updated from a previous approach. I explain the reason for the at the bottom for context.]

In order to reduce our technical debt, we are performing an audit of all tests that are marked with skip to ensure that we have a few of them as possible. Currently these skipped tests produce about half of our technical debt calculation (1080701 of 2346215 as of 6/30/21).

Tests are skipped for two main reasons. The first is to temporarily shut off a test that is causing tree breakage. That allows the tree to stay open while a fix is developed. For this case we are going to require a comment on the same line as the skip parameter with a URL to a github issue to track these tests and make sure they are eventually fixed. These issues should be tagged with the skip-test label to make them easier to find.

The other main reason for test skipping is because the test just isn't designed to work under some circumstances. For example, when testing for page transitions, we have no default transitions on the web so it doesn't make sense to test them on the web platform. For these tests we are going to require a comment on the same line as the skip parameter with the text [intended] preferably followed by a description as to why it is intended. This will greatly speed up audits in the future as we won't need to sort out which tests were skipped intentionally and which were just a temporary way to keep the tree green.

Audit

For each skipped test we will need to perform the following:

  • Verify the test still needs to be skipped. If it doesn't, remove the skip parameter.

  • If the test should always be skipped under the given condition, add a trailing comment with [intend] followed by the reason it is an intentional skip. For example:

      }, skip: !platform.isMacOS); // [intended] codesign is only available on macOS
  • Otherwise, the skip should be temporary, so ensure there is an issue filed for it with a label of skip-test and a link to the issue is in a trailing comment. For example:

      }, skip: true); // https://github.com/flutter/flutter/issues/87285

Tasks

Audit groups

Previous approach

The previous approach was to introduce a new 'exclude' parameter to testWidgets. However, this got some push back and wound up being insufficient. There are a lot of tests in the repo only using test or group from the dart test package, so it would involve a much bigger change to add the parameter to those as well. Instead, I opted for the simpler method of just enforcing a specific comment tag on intended skips. Here was the original plan:

The intent of skip is to temporarily shut off a failing test so that the tree can be kept open while a fix is worked on. However, there are many tests in our tree that are using skip to indicate a test that should never be run under some condition, as it just isn't designed for it.

To be able to tell the difference between a test that is temporarily shut off and one not designed to work for a certain condition, we are going to introduce a new boolean exclude parameter to testWidgets. This will work the same as skip, but will be used to indicate the skip is by design and needs to further attention._

Activity

  1. self-assigned this
    on Jul 14, 2021
  2. asashour commented on Jul 14, 2021

    @asashour
    Contributor

    If I may add something, in JUnit, it is called assume, and I guess this should be part of dart test.

  3. darrenaustin commented on Aug 11, 2021

    @darrenaustin
    ContributorAuthor

    Post mortem summary

    With the final PR merged on 8/11/21 this effort has made sure all skip tests are either marked with a tracking issue, or an [intended] justification. Here are the stats:

    • Total skip tests: 360 (down from 437 on 6/23):
      • 184 temporary skips with tracking bugs
      • 176 skips that are marked as intended so no longer considered technical debt
    • 77 tests turned back on
    • 22 new tracking issues created
    • Tech debt from skips reduced by 57.7% - 457,049 (down from 1,080,701)

    And with the new analyzer check in place the next audit should be much easier as we will only need to check the skips with tracking bugs to see if they have been fixed.

  4. github-actions commented on Aug 25, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  5. locked as resolved and limited conversation to collaborators on Aug 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

c: contributor-productivityTeam-specific productivity, code health, technical debt.c: tech-debtTechnical debt, code quality, testing, etc.team: skip-testAn issue used to track tests that are skipped.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions