I am writing some Dart library and want to have it unittested. I created directory test
and want to put my tests in here. Because I am going to have a lot of tests, I want to have them separated to multiple files. My questions is, what is the Dart convention, how to do that. I want to have my tests easily run all, however, I also want to be able to run just one file of tests.
What are your suggestions?
There is a tool that does exactly that, Dart Test Runner. An excerpt from that page:
Dart Test Runner will automatically detect and run all the tests in your Dart project in the correct environment (VM or Browser).
It detects any test writen in a file suffixed with _test.dart
where your test code is inside a main()
function. It doesn't have any problem detecting and running unittest tests.
It's pretty easy to install it and run it. Just two commands:
$ pub global activate test_runner
$ pub global run test_runner
For more options, please check Dart Test Runner page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With