Skip to main content
All CollectionsKnowledge BaseCross-platform
Flutter Test Step freezes on "Waiting for another flutter command to release the startup lock..."
Flutter Test Step freezes on "Waiting for another flutter command to release the startup lock..."
Updated over 4 months ago

Issue:

The Flutter Test Step freezes or hangs with the following error:

Waiting for another flutter command to release the startup lock...

Possible solutions:

Unit tests consist of three phases:

  • Arrange - In this phase you set up test values and bring in dependencies and mock classes as needed.

  • Act - During this phase, you take whatever action you're trying to test. For example, passing a value to a method and saving its output to a variable.

  • Assert - Finally, you check to see if the result from the Act phase matches your expectations. If it doesn't, the test fails.

As long as your test fails in the Assert phase, Flutter will give you an error message regarding the problem. If something goes wrong in the Arrange or Act phases, Flutter will frequently freeze with the startup lock error.

The most frequent cause of this error is misconfigured dependencies within the unit test. Here are some possible fixes:

Deleting your cache

If you're using the Bitrise.io Cache:Pull and Bitrise.io Cache:Push Steps, there's a chance that you have an outdated dependency cached that's causing the problem.

    1. In your app, click on the Settings tab.

    2. Scroll to the bottom of the page.

    3. Use the option provided to clear your cache.

Checking resources and import issues

  • Make sure your tests aren't dependent on external resources: Your tests should never be reliant on external resources such as API's, data providers, cloud storage, or other external services.

  • Make sure your dependencies are being imported correctly. It's possible that one of your tests is malformed and isn't importing dependencies properly.

If everything above looks good, you need to manually review each of your tests. If the problem started recently, start by checking your newest tests. Otherwise consider temporarily removing half of your tests to see if the issue resolves. Keep narrowing the set until you find the test causing the issue.

Did this answer your question?