Welltested Docs
v1.x.x
v1.x.x
  • Welltested AI
    • Set up
    • Unit Tests
      • Annotation
      • Generate Tests
      • Save Tests
      • Good to Knows
        • Custom Testcases
        • Regenerate Bad Tests
        • The Batching Rule
    • FAQs
      • Paid Plans
      • Code Privacy
      • Support
    • IDE Assist
      • Commands
      • Code Actions
    • Testability Guidelines
Powered by GitBook
On this page
  • @Welltested()
  • Testcases
  • Exclude Methods
  1. Welltested AI
  2. Unit Tests

Annotation

PreviousUnit TestsNextGenerate Tests

We provide a seamless workflow integrations for devs by working via code annotations and build_runner CLI.

@Welltested()

You can mark all the methods inside a class to be tested by adding @Welltested() annotation.

import 'package:welltested/welltested.dart';

@Welltested()
class Auth {
    Future<void> logInUser() {...}
    Future<void> logOutUser() {...}
}

In above example, we will generate unit tests for logInUser and logOutUser methods of Auth class.

Note: We currently don't support testing top-level (global) functions. Coming soon.

Testcases

Our testing AI auto decides smart exhaustive test cases for each function based on its use case and contextual code. However you can specify your own custom test cases for a method by adding annotation to them.

IDE Assist: You can also use to review unit test cases and also modify them.

Exclude Methods

By default, all methods in an annotated class are included. To exclude any method from testing, add their name to the excludedMethods list in the Welltested annotation.

@Welltested(excludedMethods: ['logOutUser'])
class Auth {
    Future<void> logInUser() {...}
    Future<void> logOutUser() {...}
}

In the above case, we will not create unit tests for logOutUser.

IDE Assist: You may use or to run bulk excludes.

@Testcases()
Fetch Unit Testcases
Exclude Method
Exclude Other Methods