html - Unit testing javascript of a backend driven website -


i implemented nightwatch (behavior driven) testing couple of websites. of them backend driven (java, jsp).

now of employees wrong choice, , should unit test framework.

but front-end doesn't have 'units', reacts on html present on page, , binds plugins / vanilla js class it.

am wrong, unit testing simple impossible front-end, there (almost) no functions return value. bound on page-load html element.

for example:

<div data-components="mycomponent"><div>inner</div></div> 

loads javascript (mycomponent), alter/add/remove html page. not 'return' anything. updates page.

all advice more welcome.

unit testing 1 of many ways test code. if have existing code doesn't have tests yet there's chance you're not going able test unit tests. unit testing has considered when designing application. unit testing popular because design , testability tend go hand in hand. unit tests can seen matter of code quality, eventhough it's possible write bad unit tests.

that being said, testing things user interfaces tend fall outside realm of unit tests. it's not possible design ui-code in such way can write usefull tests. approach here remove logic can untestable parts.

at company have large unit test suite server side code , client side code (js) , couple of selenium tests. work envolve things testable selenium tests.

it depends on kind of things you're making. user-interfaces can complex , elaborate , definitly want test those. @ same time, oppurtunities unit tests.


Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -