welltested 0.1.2 welltested: ^0.1.2 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 a Testing AI Pilot helping developers add and maintain tests as they code and deliver stable welltested apps to users.
Adding Dependencies #
To add welltested
and required dependencies
, run this command:
With Dart:
dart pub add welltested
dart pub add mockito
dart pub add --dev build_runner
With Flutter:
flutter pub add welltested
flutter pub add mockito
flutter pub add --dev build_runner
Generate and Configure API Key #
Generate API Key #
As of now Welltested
is only available in beta. To get an API Key, please apply for early access at welltested.ai
⚙️ Configure API Key #
Welltested
uses dotenv
to retrive API Key.
Create a .env
file in root of your project, with following KEY:
WELLTESTED_API=YOUR_API_KEY
Once .env
file is created you have to add this to your pubspec.yaml
as an asset, to make is accessible to the package.
assets:
- .env
Let's create tests #
To Generate tests add @Welltested()
annotation to classes you want to create unit tests.
@Welltested()
class Auth {
Future<void> logInUser() {...}
Future<void> logOutUser() {...}
}
In the above case, it will create Unit Test cases for logInUser
and logOutUser
methods of Auth
class.
Exclude Methods #
To exclude any method from testing, add its 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.
Generate Tests #
To generate unit tests for annotated classes, please run the following command:
With Dart:
dart run welltested:ai build --delete-conflicting-outputs
With Flutter:
flutter pub run welltested:ai build --delete-conflicting-outputs
Saving Tests #
Since we are in early beta stages, the tests generated may have syntax issues, imports errors and missing mocks.
If you happen to encounter and manually fix these issues, please run the below command to save the changes so we don’t overwrite them.
With Dart:
dart run welltested:save build
With Flutter:
flutter pub run welltested:save build
USAGE WIKI #
To read detailed setup instructions, code guidelines and supported platform infromation, read our Usage Wiki.
NOTE #
For complete Example please check example project.