A testing framework for the dart programming language
- DUnit is composed of 3 main modules that could be run seperately:
Generates the AST from a dart file
a backbone test structure generator that generates a ready to convert file with all ast testing methods empty to write tests in
Generates a runnable file using the flutter test plugin that could be run directly in a Flutter project
First you have to cd to each of the modules and run dart pub get
- To run DUnit on the example file located in tests folder you need to do the following
cd dUnitdart --no-sound-null-safety generate.dart [absolute path to your DUnit directory]/examples/test.dart
this will generate a backbone file in the tests folder for each class in the file the file will look as follows:
const test = 'TEST';
class ExampleClass1Test{
//test methods
@init
before(){
}
@test
Testmethod(){
}
@test
TestgetField(){
}
@test
TestsetField(){
}
@tearDown
after(){
}
}
- after writing your tests for each methods you just have to :
dart --no-sound-null-safety run.dart
This will generate the runnable file in tests folder it should look as follows
import 'package:test/test.dart';
void main(){
test('Testmethod', () {"your written tests here"});
test('TestgetField', () {"your written tests here"});
test('TestsetField', () {"your written tests here"});
}
this file is then runnable if you copy it to your flutter project.
- To generate tests using the GPT model run:
python3 chatgpt.py
- to get the coverage run:
./coverage.sh
in the runner folder
- Random test generation for each method
- Random + feedback test generation for sequences of tests
- VScode plugin that moves the runnable file to Flutter projects directly
Documentation of each module is being written and will be available in upcoming days!
Cheers!