Top 5 obstacles I faced in testing 696 web components
Tags: javascript, webcomponents, autobiography, beginners
Published: 2018-07-26 11:03:47

---
title: Top 5 obstacles I faced in testing 696 web components
published: true
description: A list of the most challenging thing I found for any developer to test web components
tags: javascript, webcomponents, autobiography, beginners
canonical_url: https://medium.com/@binhbbbb/top-5-obstacles-i-faced-in-testing-696-web-components-7e203f19ac0b
---

![](https://thepracticaldev.s3.amazonaws.com/i/fu0hobuwz6ahci3vcjo4.jpg)
###### *Image credit: thoughtsofascent*

Following my last [autobiography](https://dev.to/binhbbbb/the-story-of-a-man-who-has-tested-696-web-components-af8), I promised to post a story concerning the toughest barriers I faced during testing web components.

The fact is that, when the number of components reaches hundreds, there will be thousands of those obstacles you meet along the way. In this story, I will point out the 10 most common barriers.

### No reliable content delivery network (CDN)

In short, CDN offers a fast, efficient and secure delivery of content to websites. To test remotely on sites like CodePen, JSFidde or JSBin, a reliable CDN is heavily needed.

Otherwise, you need to test it locally, which includes downloading the source code, installing the dependencies and serving the demo on the website (I say it's triple, if not more, the amount of work).

![](https://thepracticaldev.s3.amazonaws.com/i/zi4sjmtgm8pboxu94gwi.jpg)

### Import links for dependencies are inconsistent

Most of the times you will see the HTML imports are either

`<link rel="import" href="../google-map/google-map.html">`

or

`<link rel="import href="bower_components/google-map/google-map.html">`

So, which one is the correct way?

The answer is that they are both correct. When developing locally, bower_components is the folder that contains all of your dependencies. So it is logical to import codes from there, the problem comes when you want to make demos for example on CodePen, there is no bower_components folder because it's only installed locally.

{% github https://github.com/webcomponents/polymer-boilerplate/issues/11 %}

Polymer comes up with the relative path serving style to make online and local testing consistent. webcomponents.org CDN also behaves in a pretty similar way. So if you develop a web component using Polymer, always uses the relative path for imports and the command polymer serve for serving.

### People usually forget to import the polyfill

Even though modern browsers are making progress in implementing Web Components standards, not all the technologies are natively supported. When I was testing, so far only Chrome & Opera supports Web Components natively. The rest of them provide partial support and usually need the polyfill, webcomponentsjs, to make web components function properly.

{% github https://github.com/webcomponents/webcomponentsjs %}

It's quite common that developers forget to import the polyfill in the demo. Hence, those samples will not work in any browsers except for Chrome or Opera.

### No demo or documentation

I saw a lot of projects, getting published without a demo and a single word for how to use it. This is exceptionally careless considering the element was created with the author's own way of usage. Most of the time, I have to read the source code and figure out how to use it.

![](https://thepracticaldev.s3.amazonaws.com/i/yxv5sy0sfhsz7mzqp52p.jpg)

### Naming convention is important

Even though not being official, it's always a good practice to name your main component the same name as your project's. For example, I've met cases where the primary element is named skeleton-layout.html, and the project is named good-component . Those projects leave me extremely confused.

![](https://thepracticaldev.s3.amazonaws.com/i/twy1wckm6qxze276c9aa.jpg)

### Final word

> "Testing a product is a learning process" - Brian Marick

The best thing about this journey is that I can learn the mistakes, which often go past the normal eyes, that people make. I have fun along the process, and will all the way again if given a chance.

Here is my last autobiography that I mentioned in the beginning, it’s a 4-min read. Feel free to check it out.

{% link https://dev.to/binhbbbb/the-story-of-a-man-who-has-tested-696-web-components-af8 %}

If you have any question regarding testing web components, feel free to PM or send me an email.

- *For more news and writing pieces on Web Components, follow me on Twitter [@binhbbbb](https://twitter.com/binhbbbb)*
- *If you would like to try out Web Components, check out the series [Web Components Wednesday](https://vaadin.com/blog?tag=wcw), where I introduce and explain easy-to-use web components to beginners.*