welltested 1.0.4 welltested: ^1.0.4 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 #
Welltested is an AI testing autopilot for Flutter developers add and maintain intelligent tests coverage and deliver stable welltested apps to users.
Generate and Configure API Key #
🗝️ Generate API Key #
Welltested is completely free for individual developers. To create an account, please sign up here.
⚙️ Configure API Key #
Create a .env
file in root of your project, and add your key received in the email.
WELLTESTED_API=YOUR_API_KEY
We uses dotenv
to retrive API Key. Once .env
file is created, please declare it as an asset in pubspec.yaml
to make is accessible to the package.
assets:
- .env
Let's create tests #
Add the @Welltested()
annotation to the class whose methods are to be tested.
@Welltested()
class Auth {
Future<void> logInUser() {...}
Future<void> logOutUser() {...}
}
In the above case, it 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 Tests #
To generate unit tests for annotated classes, please run the following command:
dart run welltested:ai build
Saving Tests #
At times, tests generated by welltested might have syntax issues. When encountering such issues, please makes the fixes and run the below command to save your changes. We remember your fixes and don't repeat the mistake.
dart run welltested:save build
USAGE WIKI #
To read detailed setup instructions, code guidelines and supported platform infromation, read our Usage Wiki.
NOTE #
- The minimum supported Flutter SDK version is 3.0.0 with Dart SDK 2.17.0. Any prior projects need to be upgraded for welltested to work.
For complete Example please check example project.