• Home
  • Insight
  • Blog
  • Business
  • Entertainment
  • Health
  • Politics
  • Shop
    • Gift Shop
    • Value Shop
    • Store
    • Bargain Shop
    • Discount
  • Sports
  • Tech
  • Travel
  • USA
  • Video
  • World
    • Asia
    • Africa
    • South America
    • North America
    • Europe
    • Oceania
Thursday, July 30, 2026
No Result
View All Result
Subscribe Now
  • Home
  • Insight
  • Blog
  • Business
  • Entertainment
  • Health
  • Politics
  • Shop
    • Gift Shop
    • Value Shop
    • Store
    • Bargain Shop
    • Discount
  • Sports
  • Tech
  • Travel
  • USA
    TX Rep. Brandon Gill Mocks James Talarico Over Fauci Action Figure Post

    TX Rep. Brandon Gill Mocks James Talarico Over Fauci Action Figure Post

    NBA players are ‘being taught’ to flop

    NBA players are ‘being taught’ to flop

    Industry was warned for years about chemical ‘runaway’ dangers. Then came near-catastrophe in O.C.

    Industry was warned for years about chemical ‘runaway’ dangers. Then came near-catastrophe in O.C.

    Trump administration seeks government-wide NDAs to stop leaks : NPR

    Trump administration seeks government-wide NDAs to stop leaks : NPR

    Dog discharges shotgun inside truck, striking woman at Nebraska traffic light

    Dog discharges shotgun inside truck, striking woman at Nebraska traffic light

    Toshifumi Suzuki, Japan’s ‘God’ of Convenience Stores, Dies at 93

    Toshifumi Suzuki, Japan’s ‘God’ of Convenience Stores, Dies at 93

     Judge Sanctioned CoreCivic for Destroying Video in ICE Death Suit

     Judge Sanctioned CoreCivic for Destroying Video in ICE Death Suit

    Suspect dead after opening fire near White House security checkpoint, Secret Service says

    Suspect dead after opening fire near White House security checkpoint, Secret Service says

    Trump trashes Colbert’s high-rated finale as “no ratings”

    Trump trashes Colbert’s high-rated finale as “no ratings”

  • Video
  • World
    • Asia
    • Africa
    • South America
    • North America
    • Europe
    • Oceania
The Insight Post
  • Home
  • Insight
  • Blog
  • Business
  • Entertainment
  • Health
  • Politics
  • Shop
    • Gift Shop
    • Value Shop
    • Store
    • Bargain Shop
    • Discount
  • Sports
  • Tech
  • Travel
  • USA
    TX Rep. Brandon Gill Mocks James Talarico Over Fauci Action Figure Post

    TX Rep. Brandon Gill Mocks James Talarico Over Fauci Action Figure Post

    NBA players are ‘being taught’ to flop

    NBA players are ‘being taught’ to flop

    Industry was warned for years about chemical ‘runaway’ dangers. Then came near-catastrophe in O.C.

    Industry was warned for years about chemical ‘runaway’ dangers. Then came near-catastrophe in O.C.

    Trump administration seeks government-wide NDAs to stop leaks : NPR

    Trump administration seeks government-wide NDAs to stop leaks : NPR

    Dog discharges shotgun inside truck, striking woman at Nebraska traffic light

    Dog discharges shotgun inside truck, striking woman at Nebraska traffic light

    Toshifumi Suzuki, Japan’s ‘God’ of Convenience Stores, Dies at 93

    Toshifumi Suzuki, Japan’s ‘God’ of Convenience Stores, Dies at 93

     Judge Sanctioned CoreCivic for Destroying Video in ICE Death Suit

     Judge Sanctioned CoreCivic for Destroying Video in ICE Death Suit

    Suspect dead after opening fire near White House security checkpoint, Secret Service says

    Suspect dead after opening fire near White House security checkpoint, Secret Service says

    Trump trashes Colbert’s high-rated finale as “no ratings”

    Trump trashes Colbert’s high-rated finale as “no ratings”

  • Video
  • World
    • Asia
    • Africa
    • South America
    • North America
    • Europe
    • Oceania
No Result
View All Result
No Result
View All Result
Home Mobile

How to run Flutter Golden (Snapshot) tests with Codemagic CI/CD

by Theinsightpost
August 13, 2022
in Mobile
0 0
0
How to run Flutter Golden (Snapshot) tests with Codemagic CI/CD


Written by Katarina Sheremet

Testing is a very important aspect of development—it helps to make sure that your app works properly and looks correct for its users. It is great that there are CI/CD tools that automate some of the work for you by checking the app quality, notifying the team if something goes wrong, and releasing the app to the end user.

In this article, I’m going to explain how to run Golden tests with Codemagic CI/CD.

Step 1: Create the Golden (Snapshot) test

In one of my previous articles, I’ve covered how to create Flutter Snapshot tests; therefore, I won’t focus on that topic here. Instead, I’ll just copy over some code snippets so that you don’t have to go back and forth between articles to follow.

Create golden_widget_test.dart in the test folder of the counter app and copy the following code into it:

void main() {
 testWidgets(‘Golden test’, (WidgetTester tester) async {
   await tester.pumpWidget(MyApp());
   await expectLater(find.byType(MyApp),
                     matchesGoldenFile(‘goldens/main.png’));
  });
}

Generate Snapshots:

flutter test --update-goldens

I’ve created a counter app with a Golden test and pushed it to GitHub. I was able to see my new app in Codemagic Applications.

Step 2: Run Golden (Snapshot) test with Codemagic

When you generate Golden (Snapshot) tests, the different OS platforms generate different files. There is an issue filed on GitHub for this, but it’s been closed because this is actually working as intended, even if it’s not very convenient. This means that if you generate your golden files on Linux and, afterward, run your tests on macOS, your Golden tests will most likely fail. However,
All tests that you run with Codemagic are executed on macOS.

Thus, people who use macOS have an advantage. All passing Golden tests will succeed on Codemagic CI/CD without any extra work.
If you are a macOS user, you need to press “Start new build”, and you are all set—just do not forget to first locally generate (see above) and commit golden files.

If everyone in your team uses macOS, you are done. ? No need to continue reading.

Step 3: Run Golden tests if you are not a macOS user

Codemagic supports free remote connection to macOS infrastructure and also has the CM_EXPORT_DIR variable to upload any files from builder machines when a build has finished.
You don’t need to generate golden files on your machine; instead, you can do this using Codemagic. I’ve pushed my code without generated Snapshots to GitHub.
After that, you need to create a new workflow just for the generation of Snapshots, since you don’t want to lose the build minutes and run the release workflow with tests that will fail anyway.

A new workflow with the name “Generate Goldens”

In the Test section, you need to enable Flutter test and set the Flutter test arguments to:

Enable Flutter test and set test arguments

The command above will generate Snapshots for you. Then you should copy generated Snapshots to $CM_EXPORT_DIR with the following command in the Post-test script section:

cp -r test/goldens $CM_EXPORT_DIR

Add Post-test script

Don’t forget to disable the Build and Publish section as well!

Run tests only in the Build for platforms section

Save settings and start a new build. After finishing the build, you should see the generated golden files in the Artifacts section on the left.

Artifacts section

Now, you just need to download this ZIP file and extract the generated golden files into your project.

Tip: If you have Golden tests in your project, you should add the skip parameter if the platform is not macOS. Then, if you run Flutter test locally, the tests won’t fail because of golden differences with Mac.

testWidgets('Golden test', (WidgetTester tester) async {
   await tester.pumpWidget(MyApp());
   await expectLater(
     find.byType(MyApp), matchesGoldenFile('goldens/main.png'),
   );
}, skip: !Platform.isMacOS);

Where to go from here?

If you are hungry for more, there is also a follow-up article where I explain how to send a Pull Request with updated Flutter Golden Snapshots using Codemagic. Make sure to check it out.


Useful links:


Katarina Sheremet is Flutter Developer and Google Developer Expert in Flutter and Dart, WTM Switzerland Ambassador. In her free time, she works on her own projects and apps, that are published on Google Play and App Store, Flutter packages. She also organizes events about technologies, gives talks and writes articles about Flutter and Dart. Check out her on Twitter; Medium and Expert Profile.





Source link

ShareTweetSend
Previous Post

Ghanaian midfielder David Atanga nets 3rd goal of the season in Oostende home defeat to Gent – Ghana Latest Football News, Live Scores, Results

Next Post

World’s cartoonists on this week’s events – POLITICO

Related News

Announcing Codemagic Patch: an open-source CodePush rebuild for React Native
Mobile

Announcing Codemagic Patch: an open-source CodePush rebuild for React Native

July 30, 2026
React Native OTA Updates: What You Can (and Can’t) Deploy Over the Air
Mobile

React Native OTA Updates: What You Can (and Can’t) Deploy Over the Air

May 28, 2026
Your phone drawer hides an app designed to “exploit developing brains”
Mobile

Your phone drawer hides an app designed to “exploit developing brains”

May 27, 2026
iPhone 16 has a secret charging upgrade Apple didn’t even mention
Mobile

iPhone 16 has a secret charging upgrade Apple didn’t even mention

May 26, 2026
Next Post
World’s cartoonists on this week’s events – POLITICO

World’s cartoonists on this week’s events – POLITICO

Discussion about this post

Subscribe To Our Newsletters

    Customer Support


    1251 Wilcrest Drive
    Houston, Texas
    77042 USA
    Call-832.795.1420
    e-mail – news@theinsightpost.com

    Subscribe To Our Newsletters

      Categories

      • Africa
      • Africa-East
      • African Sports
      • American Sports
      • Arts
      • Asia
      • Australia
      • Business
      • Business Asia
      • Business- Africa
      • Canada
      • Defense
      • Education
      • Egypt
      • Energy
      • Entertainment
      • Europe
      • European Soccer
      • Finance
      • Germany
      • Ghana
      • Health
      • Insight
      • International
      • Investing
      • Japan
      • Latest Headlines
      • Life & Living
      • Markets
      • Mobile
      • Movies
      • New Zealand
      • Nigeria
      • Politics
      • Scholarships
      • Science
      • South Africa
      • South America
      • Sports
      • Tech
      • Travel
      • UK
      • USA
      • Weather
      • World
      No Result
      View All Result

      Recent News

      US Navy to overhaul torpedo stockpile under new two-war strategy

      US Navy to overhaul torpedo stockpile under new two-war strategy

      July 30, 2026
      Free Cloud Computing Course | AWS Re/Start Program 

      Free Cloud Computing Course | AWS Re/Start Program 

      July 30, 2026
      Thirty Years Later

      Thirty Years Later

      July 30, 2026
      Announcing Codemagic Patch: an open-source CodePush rebuild for React Native

      Announcing Codemagic Patch: an open-source CodePush rebuild for React Native

      July 30, 2026
      • Home
      • Advertise With Us
      • About Us
      • Corporate
      • Consumer Rewards
      • Forum
      • Privacy Policy
      • Social Trends

      Theinsightpost ©2026 | All Rights Reserved. Theinsightpost is an Elnegy LLC company, registered in Texas, USA

      Welcome Back!

      Login to your account below

      Forgotten Password?

      Retrieve your password

      Please enter your username or email address to reset your password.

      Log In

      Add New Playlist

      We are using cookies to give you the best experience on our website.

      You can find out more about which cookies we are using or switch them off in .

      No Result
      View All Result
      • Home
      • Insight
      • Blog
      • Business
      • Entertainment
      • Health
      • Politics
      • Shop
        • Gift Shop
        • Value Shop
        • Store
        • Bargain Shop
        • Discount
      • Sports
      • Tech
      • Travel
      • USA
      • Video
      • World
        • Asia
        • Africa
        • South America
        • North America
        • Europe
        • Oceania

      Theinsightpost ©2026 | All Rights Reserved. Theinsightpost is an Elnegy LLC company, registered in Texas, USA

      The Insight Post
      Powered by  GDPR Cookie Compliance
      Privacy Overview

      This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

      Strictly Necessary Cookies

      Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.

      Cookie Policy

      More information about our Cookie Policy