olexale / bdd_widget_test

A BDD-style widget testing library
MIT License
101 stars 30 forks source link

How to group certain features by using tags? #34

Closed huiyangns closed 2 years ago

huiyangns commented 2 years ago

For integration test running in a browser, is there any configuration to set tags and using them to group feature files?

It seems that unlike flutter test command, flutter drive command does not provide --tag option

Another question is when a feature file fails, how to capture the screenshot at fail time?

Thanks

olexale commented 2 years ago

flutter driver does not support tags. I'd recommend updating the test suite to the integration_test framework, it's been there for quite a long time. If, for any reason, you can not do that - take an eye on this issue. Once it is solved, tags will appear automatically.

bdd_widget_test doesn't add any functionality by itself. if you need to capture screenshots - you need to implement this. I see two options from the top of my head:

  1. You may use the AFTER section for capturing the screenshot. Steps from this section will always be executed, so you'd need to define what is "fail time" in your steps.
  2. You may wrap common steps (like iWait, iTap, etc.) implementations in try..catch blocks and make screenshots there. A bit more boilerplate, but at the same time, you'll get more control.

Additionally, I'd recommend giving it a try without screenshots. On a scale they will significantly slow down testing execution. You will learn how to debug tests quite soon, so try to keep your test suit rapid.

huiyangns commented 2 years ago

Hi Olexale,

Thanks for replying. I have updated my test suite to integration_test framework. But according to the official document, when running integration_test in the browser, we have to use flutter drive to do that. https://docs.flutter.dev/testing/integration-tests So it seems that we lose the ability to group feature files by tags under that situation.

Is there any work round to deal with this issue except waiting adding tags support to flutter drive command?

olexale commented 2 years ago

Hey @huiyangns,

With flutter test, it's possible to filter which tests to run by test name (--name parameter). I'd investigate whether there is something similar exists with flutter driver.

If not - probably not the best solution, but you may just remove tests that are not needed before running all tests. You always will be able to generate them back from feature files.

olexale commented 2 years ago

I'm closing this issue as it is not a bug or feature request. Feel free to re-open it or create a new one if needed.