Project 2: Unit Testing

Overview

In this project, you will be fixing a generic “To Do List” app. You will learn more about GitHub, and practice testing your code in Flutter.

Learning Goals

Course Learning Goal Learning Goal Career Competency
LG6 Expand your GitHub skills: forking a repo, licensing. Professionalism
LG2 Debug code using unit tests for classes and widgets Critical Thinking

Step 1 – Setting Up Your Repository

Last time, we created a new repository on GitHub. In this lab we will “fork” an existing repository. This allows you to have a personal copy of the code in your own space for edits and changes yet remain connected to the original source code.

1.1 – Forking a Repo

Read the below description of how to fork a repository.

Now, fork the following repository from GitHub into your own account.

1.2 – Cloning a Repo

Now, you can clone the repository locally with GitKraken as you did in the last lab. Find to-dont-list in your linked GitHub.com account, navigate to or create a good directory, and click the “Clone the repo!” button.

1.3 – Opening the IDE

Finally, you are ready to open the project in Visual Studio Code. Open Visual Studio, Code and using the File -> Open menu, navigate to the directory of your forked repository and open it.

Step 2 – Unit Testing

You will notice that the provided app is broken in several ways. As we write larger apps, it can become difficult to tease out the exact cause of errors. One way to help find bugs is to test the functionality of each of the classes and widgets we write. Designing good tests requires thinking critically about the behavior you want, and then specifying how you can empirically determine that the code gives you the expected behavior.

2.1 – Run Unit Tests

First, review the Flutter testing documentation discussed in lecture for classes and widgets.

Find the one class and one widget that currently have tests provided.

Run these tests. What errors are identified? For each error you see:

  • Edit the code to correct the error and pass the test.
  • Make a commit to your repository with a clear and succinct description of what you are correcting.

Grading Rubric

To Partially Complete this lab, you must

  • Fork the repository
  • Correct most errors identified by pre-existing unit test

To Complete this lab, you must do the above and

  • Correct all errors identified by pre-existing unit test
  • Consistently make GitHub commits