Tag Archives: Unit Test

Jasmine Unit Tests and Maven

Unit tests are a fundamental way of maintaining stability in your code base. As a Java developer, JUnit is the tool for the job. With a suite of unit tests, they can be integrated into your build tool, and Continuous Integration jobs. But how about JavaScript? I have used Jasmine (http://jasmine.github.io/) before for unit tests. […]


Writing Unit Tests for Existing JavaScript

via Writing Unit Tests for Existing JavaScript – Adventures in JavaScript Development.

My team at Bazaarvoice has been spending a lot of time lately thinking about quality and how we can have greater confidence that our software is working as it should.

We’ve long had functional tests in place that attempt to ask questions like “When a user clicks a button, will The Widget do The Thing?” These tests tell us a fair amount about the state of our product, but we’ve found that they’re brittle – even after we abstracted away the CSS selectors that they rely on – and that they take approximately forever to run, especially if we want to run them in all of the browsers we support. The quality of the tests themselves is all over the map, too – some of them are in fact unit tests, not really testing anything functional at all.

Unit Test AngularJS Controller With Jasmine

via Welcome to Yuan Ji’s Personal Website.

Last time I demonstrated how to Consume RESTful API With Angular-HAL, and now I want to show you how to unit test my AngularJS controller code with Jasmine, a behavior-driven development framework for testing JavaScript code.

BDD and Jasmine

I’m a big fan of Test-Driven Development (TDD). And I always want to write unit test for my code. But not everyone agrees with me. There is a cost to write unit tests, and the benefit is in the long term, so it is not easy to convince others, especially managers or clients, that time spent on unit test will improve software quality and save money in the future. It is harder when developers write unit tests which don’t make sense. Sometime I even got frustrated when I tried to write unit test code for the sake of unit testing.

So what exactly shall I test? How shall I write unit tests? Dan North introduced Behavior-driven development, and he answered lots of my questions regarding the unit test. So what is Behavior-Driven Development?

Behavior-driven development is about implementing an application by describing its behavior from the perspective of its stakeholders.

Profiling Unit Tests

via iOS8 Day-by-Day :: Day 6 :: Profiling Unit Tests – ShinobiControls Website.

This post is part of a daily series of posts introducing the most exciting new parts of iOS8 for developers – #iOS8DayByDay. To see the posts you’ve missed check out the index page, but have a read through the rest of this post first!

To enjoy each of the 39 posts all in one place, you can now also download the iOS8 Day-by-Day eBook free from our website!

Writing Tests for Data Access Code – Unit Tests Are Waste

Writing Tests for Data Access Code – Unit Tests Are Waste

A few years ago I was one of those developers who write unit tests for my data access code. I was testing everything in isolation, and I was pretty pleased with myself. I honestly thought that I was doing a good job.

Oh boy was I wrong!

This blog post describes why we shouldn’t write unit tests for our data access code and explains why we should replace unit tests with integration tests.

Let’s get started.