How can you make sure that an app does exactly what it should do without any weird unexpected surprises? Well, you test it, of course. You could test everything manually by launching the app, using it, and trying your best to make the app blow up with errors. Or you can write a bunch of automated tests, which is arguably a more time-efficient and thorough way to test your apps. Let’s take a look at unit, widget, and integration tests in the video tutorial above.

Code snippets

VS Code snippets

  "Basic test scaffolding": {
    "prefix": "t_scaffold",
    "body": [
      "import 'package:flutter_test/flutter_test.dart';",
      "void main() {",
      "  late ${1:ClassName} sut;",
      "  setUp(() {",
      "    sut = ${1:ClassName}();",
      "  });",
      "  group('', () {});",
    "description": "Basic test scaffolding"
  "Test following the Arrange-Act-Assert pattern": {
    "prefix": "aaaTest",
    "body": ["test(", "  \"$1\",", "  () async {", "    $2", "  },", ");"],
    "description": "Test following the Arrange-Act-Assert pattern"

About the author 

Matt Rešetár

Matt is an app developer with a knack for teaching others. Working as a freelancer and most importantly developer educator, he is set on helping other people succeed in their Flutter app development career.

You may also like

  • Snippets for Android Studio:
    For t_scaffold:

    import ‘package:flutter_test/flutter_test.dart’;

    void main() {
    late $NAME$ sut;

    setUp(() {
    sut = $NAME$();

    group(”, () {});
    For aaaTest:
    () async{

  • of course like your website but you have to check the spelling on several of your posts. A number of them are rife with spelling issues and I in finding it very troublesome to inform the reality on the other hand I will certainly come back again.

  • Normally I do not read article on blogs, however I would like to say that this write-up very forced me to try and do so! Your writing style has been amazed me. Thanks, quite great post.

  • Hello, Neat post. There’s an issue together with your site in internet explorer, would check this텶E still is the marketplace chief and a large element of other folks will leave out your magnificent writing due to this problem.

  • I do trust all the ideas you’ve presented in your post. They are really convincing and will definitely work. Nonetheless, the posts are too short for newbies. May just you please lengthen them a bit from next time? Thank you for the post.

  • Hi, Neat post. There is a problem along with your website in internet explorer, would test this텶E still is the market chief and a good section of other folks will pass over your magnificent writing due to this problem.

  • Fantastic beat I would like to apprentice while you amend your web site how could i subscribe for a blog site The account helped me a acceptable deal I had been a little bit acquainted of this your broadcast offered bright clear concept

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}