Polymer Tests!

0 views
Skip to first unread message

Michael Giuffrida

unread,
May 5, 2015, 6:33:58 PM5/5/15
to chromium...@chromium.org, apac...@chromium.org
Hey,

I want to send this out to chromium-settings first as a draft, but it's not Settings-specific.

I've uploaded three patches to enable browser tests for Polymer elements.

The first patch adds a blank WebUI at chrome://web-component-test so our tests have somewhere to navigate to -- they need to run from a chrome:// origin so the components can include their stuff.

The second patch adds Mocha to the mix. Mocha has wonderful async support and lets us define granular test suites and test cases without having to have a hundred separate (slow) browser test cases. I've created an "adapter" which reports Mocha results to the browser test framework. TODO: Add Mocha as a real third-party framework.

The third patch builds out the web component test framework with wcTest.BrowserTest, a browser test that our test suites can inherit from. This doesn't do a ton right now, but it's a common start for the tests we'll need. I also have an example test, CrElementsBrowserTest. This is *one* browser test which will include tests for all the cr-elements, although right now it only has tests for cr-checkbox. The idea is to have this hierarchy of tests -- one BrowserTest for each functional group, consisting of multiple files of Mocha tests. TODO: find a nicer way to define these browser tests, because "GEN_INCLUDE"ing everything and calling the RegisterWhatever function isn't super-duper-scalable.

I expect this framework to grow and evolve, but you can start writing Mocha tests now and they should be relatively stable (use cr_checkbox_tests.js as an example).

PTAL if you care about testing.

Thanks!

Jeremy Klein

unread,
May 6, 2015, 12:39:21 PM5/6/15
to Michael Giuffrida, chromium...@chromium.org, apac...@chromium.org
This looks great! Thanks for setting this up and explaining, Michael. I'll take a more detailed look later today.

--
You received this message because you are subscribed to the Google Groups "Chromium Settings" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-setti...@chromium.org.
To post to this group, send email to chromium...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-settings/CACi5S_3vs7%3DsUD9gQJOFgx5PzyHM1EhKVtfDsKvVcFvJ7VLeJQ%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages