Skip to content

This repo ensures feature correctness through organized tests, each focusing on a specific aspect. Tests are set up independently and compared to expected results to confirm proper functionality.

Notifications You must be signed in to change notification settings

axah710/counter_unit_testing

Repository files navigation

Testing Modules and Methods in Flutter

  1. Objective: Ensure the correctness of modules, small units, and methods. I want to make sure that both counters work correctly, so I will use unit tests in this case.

  2. Testing Package: We will use the built-in Flutter testing package.

  3. Directory Structure:

    • Tests will be organized in a dedicated test folder.
    • Test files must end with _test.
  4. Entry Point:

    • The testing process will start with the main method in the counter_test file.
  5. Running Tests:

    • Use the flutter_test command to execute the tests.
  6. Grouping Tests:

    • Each module will be organized into groups, each with a specific group name.
  7. Counter Class Instance:

    • Create an instance of the Counter class for testing purposes: late Counter counter;
  8. Setup Method:

    • The setup method will initialize the counter instance and prepare it for testing.
  9. Individual Test Cases:

    • Each test will be executed independently, ensuring that it does not rely on the results of other tests.
    • Each test will have a descriptive name and corresponding implementation.
    • The name should reflect the specific case being tested.
  10. Expectation:

    • Use expect to compare the current state or value with the expected state or value.
  11. Isolation of Test Cases:

    • Each test case operates independently, meaning the setup state or value is reset for each test.
    • This ensures tests do not run sequentially or depend on one another.

About

This repo ensures feature correctness through organized tests, each focusing on a specific aspect. Tests are set up independently and compared to expected results to confirm proper functionality.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published