Karma + Jasmine + Visual Studio (including Visual Studio Code)

I've been developing a LOT of Angular applications lately. Some of them are hybrid projects (Angular w/ MVC); some of my projects have been completely separated (Angular for client-side, with a separate project for an API). Regardless, I always want to ensure that my code has been thoroughly tested with unit tests and acceptance (E2E) tests. When developing hybrid projects, my preferred IDE is Visual Studio. When developing a pure, client-side project, my preferred IDE is Visual Studio Code as it has a lot less remnants/artifacts tied to a solution (.vs, .xproj, .csproj, etc.) eliminating the need for a ridiculously large .gitignore file.  Additionally, I will use WebStorm depending on the need.

Jasmine is a great framework for providing both unit testing and end-to-end, acceptance testing.  Coupled with Karma, Jasmine can monitor file changes to our client-side code and execute tests on every file change in order to ensure that all tests are always passing.  In this blog post, I will demonstrate how to set up and use Karma and Jasmine in both development environments.

Read more


Unit Testing an MVC Model

Do your MVC model properties contain attributes?  Have you ever wanted to unit test the properties to verify that the ModelState fails or succeeds based on given values?  Below is a static method that can be used for your unit tests as you test your models.
Read more


Automation Testing with SeleniumHQ

In an earlier post, I provided step-by-step instructions in how to perform Behavior Driven Development using Visual Studio, SpecFlow, WatiN and DryRunner.  However, I've had a lot of students and blog readers ask me about Selenium, a more-common browser automation tool.  So, I'm writing this post to show how to accomplish BDD and automated test driven development (ATDD) using Selenium.Read more


Behavior Driven Development with SpecFlow + WatiN + DryRunner

In the previous post, we examined some of the principles behind BDD.  If you read it, I'm sure you're thinking, "Wow! That's great! But, how do I accomplish this in Visual Studio?"  There are a myriad of posts on the Internet that demonstrate different components.  However, there's not really a single post with all of the information compiled.  For that reason, I'm going to provide a step-by-step tutorial on how to perform BDD with Visual Studio. Additionally, I will show you how to perform automated testing using your Gherkin scripts.

Read more


Behavior Driven Development Principles

According to AgileAlliance.org:

BDD (Behavior Driven Development) is a synthesis and refinement of practices stemming from TDD (Test Driven Development) and ATDD (Acceptance Test Driven Development).

That's great, but what does that really mean?

BDD has its roots in TDD, but supersedes TDD in the agile development process.  BDD recognizes that User Stories are the framework for the development process and that these stories determine the necessary tasks required to satisfy given business requirements.  Read more