background preloader

Front-End Testing

Facebook Twitter

Marmelab/gremlins.js. Performance testing and measuring the page load time of web aplications using PhantomJS and Google charts. Performance testing the page load time of a web application can be a little tricky but pretty useful for simulating what the user experience of your customers.

Performance testing and measuring the page load time of web aplications using PhantomJS and Google charts

The following solution uses the PhantomJS headless browser for measuring the needed timing information, Google charts for visualizing the results. The solution can also be used pretty much as it in the continuous integration environment based on Jenkins or any other system. For what can I use this solution ? Page load time testingsize and number of resources retrieved for URL callload time for each resource The solution described below is composed of the following scripts and executables: 1. Steps to make the solution work for you (Linux OS as this is what I have , similar on MacOS or Windows). 1. Browse to a terminal window and issue wait for PhantomJS to be downloaded and issue the command “ “now PhantomJS is installed 2. 3. 4.

Nightwatch.js. Mocking Requests with Mocha, Chai and Sinon. After a bit of a rocky start yesterday I’ve finally got Mocha and Chai running in the browser which is great.

Mocking Requests with Mocha, Chai and Sinon

Today I’d like to test out some of the async functionality of Mocha. This seems to be the big selling point for most people so we’ll kick the tires a bit. Testing Handlebars With Mocha - No F*cking Idea. Mocha and Handlebars are two great things i use.

Testing Handlebars With Mocha - No F*cking Idea

Mocha is a testing library which can be used for backend (node.js) and fronend testing. On frontend its only dependency is jQuery. Handlebars is templating language that can be used for frontend javascript partials or even for backend (node.js) layouts. What ever you want! :). When i started working with express.js sinatra like framework i took a peek at other projects that people from Vision Media do. Chai.js / Should.js. 4. Testing. TDD?

4. Testing

The best way to make code testable is to start by writing the tests first - TDD style. Essentially, TDD boils down to: Frank Rousseau : Use Mocha and PhantomJS to automate the testing of web application front-ends. Testing your frontend JavaScript code using mocha, chai, and sinon. As rich Web application complexity grows, if you want to keep your sanity, you need to unit test your frontend JavaScript code.

Testing your frontend JavaScript code using mocha, chai, and sinon

For the 4 past months, I've been working for Mozilla on some big project where such testing strategy was involved. While I wish we could use CasperJS in this perspective, Firefox wasn't supported at the time and we needed to ensure proper compatibility with its JavaScript engine. CasperJS, a navigation scripting and testing utility for PhantomJS and SlimerJS. Help Scout Developers - Front-end Testing for the Lazy Developer with CasperJS. If you pride yourself on possessing the 3 Virtues of a Great Programmer, then you probably hate writing automated test suites.

Writing comprehensive suites of Unit tests flies directly in the face of everything we Great Programmers stand for. Why would a lazy, impatient developer who never makes mistakes need to waste all that time, anyway? Most of the time, all you want is an automated way to make sure your application is functioning properly at a high level. Do you really need to write mountains of Unit tests to do this? Frontend testing with phantomjs and casperjs ~ Robert Basic ~ the magic of coding... I am not usually fond of doing much frontend stuff, but I do like to dable in some javascript from time to time.

Frontend testing with phantomjs and casperjs ~ Robert Basic ~ the magic of coding...

Nothing fancy, no node.js, coffeescript and the likes for me. I still feel like making applications on the server side, and have the client just show things to the user. If needed some 3rd party javascript library or framework to make my life easier, and that's about it. For a while I was reluctant on writing any frontend tests, integration tests, or whatever you want to call them, because, y'know, *refresh-click-click-click* and the testing is done. Easy. Advanced Jasmine – Front-End JavaScript Unit Testing « ZeaLake. Test your code! Unit testing in JavaScript – XING Developer Blog. Ensuring code functionality in large web applications is quite a difficult task.

Test your code! Unit testing in JavaScript – XING Developer Blog

Nowadays, lots of business logic is handled within the client and you have to make sure that everything works as intended. Maintenance can be very complex if you consider the fact that we currently have about 176,207 lines of JavaScript code and 20 frontend engineers working in different teams. Imagine, for example, that we have seven sub-modules based on one main module.

If you know change something in the main module, the changes could also affect the functionality of each sub-module and, in a worst-case scenario, break every module. Tips for Front End Unit Testing. Building complex programs is just a matter of breaking it down into smaller units, and then putting them together.

Tips for Front End Unit Testing

Writing Testable Frontend Javascript Part 1 – Anti-patterns and their fixes. This is the first of a two part introduction to writing testable Javascript UI code.

Writing Testable Frontend Javascript Part 1 – Anti-patterns and their fixes

The first article presents a basic sample application containing several common anti-patterns and their solutions.In the second article, the application will be refactored using the described techniques, a simple XHR mock will be presented, and add a test suite will be added to help future developers maintain the code. Front end development comes with a set of challenges that are rarely discussed in articles about unit testing. Self initialization, encapsulated logic, DOM event handlers, XHR requests, and nested callbacks all make testing difficult. Fortunately, writing front end code so that it can be tested is straight forward, but it does require a little knowledge and thought. Common coding practice – Easy to understand, difficult to test While short, this contrived example uses several common anti-patterns.

Testing your frontend JavaScript code using mocha, chai, and sinon. Testing your frontend JavaScript code using mocha, chai, and sinon. Danny Croft - Web Developer made in Wales but working in London  Unit testing can make your code less prone to bugs and gives you piece of mind that everything is working the way it should.

Danny Croft - Web Developer made in Wales but working in London 

Normally when I speak to other developers about work, we end up speaking about workflow, tools and release processes. I’m always surprised by the amount of front-end developers that don’t unit test their code. When asked why, they give the following answers: “I did have a look at Selenium, but it freaked me out. Getting it installed and ready to go looked a right pig!” “The back-end guys usually just do that” “I don’t really get time to do any of that kind of stuff but I’d like to” Incredibly convenient testing of front-end Javascript with Node.js - Staal Forge. You do have automated testing for your front-end Javascript application / library / framework don’t you? And tests work equally well at console, browsers and Travis aren’t they? And you run them in every possible browser on each release (or even push) right? If the answer is no, you might be doing it wrong. Testing your Frontend JavaScript code using Mocha, Chai and Sinon. This is a republished blog post by Nicolas Perriault.

When I first read it I immediately thought it would fit perfectly on our Codeship blog. Javascript front end testing.