khtan (68) [Avatar] Offline
#1
Hi Ben,
When you cover testing, will you be covering both unit testing per component and e2e testing per app?
If so, what is the testing framework(s) that you'll be using for each of these.
Thanks,
430326 (10) [Avatar] Offline
#2
Hi!
So, my plans are evolving around this due to some feedback I got in my last Manning review from readers and other factors. Originally, I was going to take a small web application and create tests around that using Polymer's WCT tooling. I've had good luck with that for vanilla Web Components.

Feedback from my last review made me realize that my book is fairly light on actual standalone components (its mostly demo applications), so I'm working on an additional chapter after covering the Shadow DOM to recap concepts and create a well thought out UI component.

I'm thinking right now that my chapter on building and testing would be better served with this UI component.

The other thing that is changing my thinking recently is around the native Web Component support in all modern browsers. Between Firefox shipping in October, and Edge announcing Chromium based releases, WCT might no longer be necessary since polyfills aren't really necessary.

With that in mind, I plan to create a proof of concept around some pretty standard, everyday stuff like Karma and Mocha or Tape. If I can prove that WCT isn't necessary, then I'll likely bail on it.

With all that said, do you have opinions yourself, especially since I'm still thinking through my plans?
khtan (68) [Avatar] Offline
#3
Hi Ben,

I've had the chance to read the first chapter and the emphasis on "no framework" puts a interesting complexion on testing.

Most frameworks tend to have a default unit and e2e testing framework, so as to relieve the developers from that decision. For example, Angular defaults to Karma unit test and Protractor e2e test framework. While Karma can be replaced with other compatible test frameworks like Jest, I do not know of any straightforward replacement for Protractor. This is because Protractor was created to make it easy to test Angular.

In your case, "no framework" would suggest a mix and match approach. Using Polymer WCT seems appropriate for unit testing the components. Also, if you can replace it with Karma, that would be very helpful to readers.

As for e2e testing framework, I do not know if Web Components will work with Protractor. Hopefully, as you progress, you might have better insight.

Meantime, thanks for this forum and hope others can put in their feedback as well.

Thanks,
430326 (10) [Avatar] Offline
#4
Awesome, thanks for the feedback!
Yeah, that's a difficult line to straddle in the book - when you say it relieves you of having to make the choice, others might say it forces you into a choice. I'm really trying to stay clear of specific solutions in general so readers don't feel boxed in. Unfortunately, with testing I'll have to break that a bit since I'm obviously not going to write a testing framework myself. Either way, great reminder on Protractor. Its been a while since I've used Angular, I'll definitely see if I can make it work.

thanks again!