welltested 2.0.1 copy "welltested: ^2.0.1" to clipboard
welltested: ^2.0.1 copied to clipboard

discontinued

WelltestedAI is a Testing AI Pilot helping developers add and maintain tests as they code and deliver stable welltested apps to users.


mason logo


mason logo


Welltested AI is a testing autopilot that automatically creates and maintains unit test coverage in your codebase, helping you deliver welltested apps to users.

Setup #

⚙️ Configure API Key #

Please setup an account, and get your API Key. Welltested AI is completely free for individual developers.

Create a .env file at the root of your project, and add your API key received in the email.

WELLTESTED_API=YOUR_API_KEY

✅ Activate Dependency #

Add welltested_annotation in your pubspec.yaml along with mockito and build_runner as optional dev_dependencies.

dependencies:
  welltested_annotation: ^1.0.1
  
dev_dependencies:  

  //[optional] to generate mocks
  mockito:
  build_runner:

Then activate the welltested CLI globally:

dart pub global activate welltested

Quick Start #

1. Annotate for Testing #

Add the @Welltested() annotation to the classes and extensions whose methods you want to test or directly to top level functions.

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

In the above case, welltested will generate unit tests for logInUser and logOutUser methods of Auth class.

2. Generate Unit Tests #

To generate unit tests for annotated classes, please run:

welltested generate build

This takes a few minutes to complete and the generated tests can be found in the /test folder.

3. Save Unit Tests #

If you make adjustments to the generated tests, please save them by running the command:

welltested save unit

Note: Saving tests regularly helps welltested learn from your changes and improve the quality of future test generations.

Exclude Methods

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

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

For example, here welltested will not generate unit tests for logOutUser method.

Custom Testcases

To specify custom testcases for any method, use @Testcases() annotation.

@Welltested()
class Auth {
    @Testcases(['Throws exception when email is empty'])
    Future<User> logInUser() {...}
}

Developer Docs #

For detailed documentation, please read our Developer Docs.

NOTE #

The minimum supported Flutter SDK version is 2.5.0 with Dart SDK v2.14.0. Make sure to upgrade your project to the minimum supported Flutter and Dart SDK versions before using Welltested AI.


Welltested AI is a testing autopilot that automatically creates and maintain unit test coverage for your codebase and helps you deliver welltested apps to users.

Setup #

⚙️ Configure API Key #

Welltested is completely free for individual developers. To create an account, please sign up here.

Create a .env file at the root of your project, and add your key received in the email.

WELLTESTED_API=YOUR_API_KEY

Let's create tests #

Add the @Welltested() annotation to the class whose methods you want to test.

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

In the above case, welltested will generate unit tests for logInUser and logOutUser methods of Auth class.

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, it will not create unit tests for logOutUser method.

Custom Testcases #

To specify custom testcases for any method, use @Testcases() annotation.

@Welltested()
class Auth {
    @Testcases(['Throws exception when email is empty'])
    Future<User> logInUser() {...}
}

Generate Unit Tests #

To generate unit tests for annotated classes, please run the following command:

dart run welltested generate build

Save Unit Tests #

In case you make any adjustments to the generated tests, please run the below command to save your changes.

dart run welltested save unit

Note: We recommend saving tests regularly to improve the quality of future test generations as per your style.

Activating the global command [Optional] #

You may activate welltested CLI globally in your system using:

dart pub global activate welltested

This allows you to run commands directly like welltested unit generate from anywhere in your terminal.

Developer Docs #

To read detailed setup instructions, code guidelines and supported platform infromation, read our Developer Docs.

NOTE #

  1. The minimum supported Flutter SDK version is 2.5.0 with Dart SDK 2.14.0. Any prior projects need to be upgraded before using welltested.

For complete Example please check example project.

29
likes
0
pub points
69%
popularity

Publisher

verified publisherwelltested.ai

WelltestedAI is a Testing AI Pilot helping developers add and maintain tests as they code and deliver stable welltested apps to users.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

analysis_server_lib, analyzer, ansi_escapes, args, azure_application_insights, crypto, http, path, source_gen, welltested_annotation, yaml

More

Packages that depend on welltested