3

browser tests need to be run from command line like pub run test -pdartium. Is there a way to debug such tests.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567

2 Answers2

2

The Dart team is working hard to make tests with the new test package debuggable. Until the related issues are fixed you can use this workaround:

To run browser tests with the new test package, for example from WebStrom, including debugging, just replace the <x-test-dart ...> tag with a normal Dart script tag pointing to your test file and run it like any Dart browser application from WebStorm.

This also works for Polymer tests. Ensure you run await initPolymer(); or the appropriate initialization necessary for the used Polymer version.

I usually create a copy of the test entry page file where I can keep the replaced script tag.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
1
pub run test -pdartium --pause-after-load

starts the test only after I click a "play" button on the test page. This gives me time to open up Dev Tools in Dartium and set breakpoints. I can also open up the Observatory and do stuff there.

user7610
  • 25,267
  • 15
  • 124
  • 150