Betterment / alchemist

A Flutter tool that makes golden testing easy.
MIT License
251 stars 35 forks source link

fix: the "loadFonts" function calling on every test causes longer test execution and performance issues #113

Open vase4kin opened 6 months ago

vase4kin commented 6 months ago

Is there an existing issue for this?

Version

v0.7.0

Description

Hi đź‘‹

After using the “alchemist” library, I noticed that our test execution on CI takes more time, and sometimes it hangs on the tearDownAll function.

My use case of execution tests is a bit different. I run all the tests in one isolate, mainly to speed things up on CI. The testMain during test execution is called only once, along with the testExecutable at flutter_test_config.

Let’s say I have 100 golden tests. For each of them, the loadFonts function is called before the test, which takes time to execute. It is called 100 times. But should only once.

I would like to call this function only once before my tests execution, at flutter_test_config.

I forked the library, removed the loadFonts function call on every test execution, and moved it to the flutter_test_config. The problem was resolved.

Steps to reproduce

  1. Create a test file with ten goldens tests.
  2. Execute the tests.

Actual behavior: The loadFonts function is called ten times.

Expected behavior

The loadFonts function is called only once.

Screenshots

No response

Additional context and comments

Thanks for the library 🚀