welltested 2.0.0-preview.1 welltested: ^2.0.0-preview.1 copied to clipboard
WelltestedAI is a Testing AI Pilot helping developers add and maintain tests as they code and deliver stable welltested apps to users.
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. Please setup an account, and get your API Key.
Create a .env
file at the root of your project, and add your key received in the email.
WELLTESTED_API=YOUR_API_KEY
Ensure you have the welltested CLI activated:
dart pub global activate welltested
Quick Start #
Annotate for Testing #
Add the @Welltested()
annotation to the classes 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.
Generate Unit Tests #
To generate unit tests for annotated classes, please run the command:
welltested generate build
The command takes a few minutes to complete and the generated tests can be found in the /test
folder.
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 is recommended to help welltested learn from your changes and improve the quality of future test generations.
Exclude Methods #
By default, all methods in an annotated class are tested. 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 details documentation, please read our Developer Docs.
NOTE #
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.