Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only run specific test #27

Open
hschaeufler opened this issue Oct 4, 2024 · 2 comments
Open

Only run specific test #27

hschaeufler opened this issue Oct 4, 2024 · 2 comments

Comments

@hschaeufler
Copy link

Is it possible to specify the test to be executed directly in the command?
I would like to execute only the unit test associated with the specified code file.
For Example:
dart run mutation_test lib/code_file.dart -test lib/code_file_test.dart

@hschaeufler
Copy link
Author

For those who are interested. I have found a workaround. I write the following with the widget to test in a cfg.xml:

flutter test /path/to/widget_test.dart

Than I run the test with the following command:
dart run mutation_test /path/to/widget.dart --rules tmp.cfg.xml --builtin --format none

@BrendoKatagi
Copy link

BrendoKatagi commented Dec 31, 2024

It won't work if you want to use the mutation test in a CI environment.

If you try adding the following code to the tag in the XML file:
flutter test $(echo $(git diff --name-only HEAD HEAD~1 | grep "test.dart$" | tr '\n' ' **'))**

The _addCommand method will split it by blank spaces, causing the code to malfunction:

var text = original.split(' ');

note: the Proccess.start() method should work if you pass the files argument with double quotes, but because of the split it is not possible.

is there any workaround for this?
is it possible to pass a string of files to test or specify a split pattern for commands?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants