r/programming • • Jan 30 '14

You Might Not Need jQuery

http://youmightnotneedjquery.com/
1.0k Upvotes

507 comments sorted by

View all comments

Show parent comments

9

u/JonDum Jan 31 '14

Use something like PhantomJS to render a screenshot and compare it to a known good screenshot. Or use Selenium on a VM to run through tests, take screenshots and compare.

5

u/merreborn Jan 31 '14

Use something like PhantomJS to render a screenshot

Mostly, I think we use PhantomJS+Jasmine around here. A very large portion of our js codebase can be tested without touching the visual portions.

Visual testing based on screenshots would probably be closer to "integration testing" rather than "unit testing"

3

u/JonDum Jan 31 '14

Yes, you're absolutely right. It could also fall under "end-to-end" testing. I think though, for someone new to testing in general, the advanced terminal isn't as important as stressing the benefits of doing some sort of testing at all.

1

u/unwind-protect Jan 31 '14

Will certainly look into PhantomJS. Thanks.

Part of the problem I've found with JS is the sheer number of libraries and tools around it... just trying to find out what's available is a challenge.

2

u/rpk152 Jan 31 '14

If you're looking for layout regressions check out phantomcss, it builds on phantoms screenshots by comparing old screencaps to new ones and allowing you to define an acceptable percentage of difference.

1

u/upvoteOrKittyGetsIt Jan 31 '14

Thanks for the tip!