Skip to content

manalotoj/angularjs

Repository files navigation

AngularJS Unit Testing

This document provides AngularJS unit testing examples. The samples are authored in Visual Studio (VS) 2013 and test angularjs and javascript code contained in the standard, cookie-cutter ASP.NET MVC project. The stupid-simple AngularJS example can be viewed by navigating to http://localhost/sandbox.ui.main/students. The sample contains examples of routing, partials/templates, controllers, and services. These examples will eventually be extended.

Tests are contained in a library project. The tests use Chutzpah as the test runner and Jasmine as the testing framework. Note that QUnit can be used instead of Jasmine. Tests will be created for the following AngularJS elements:

  • Controllers (refer to Sandbox.Tests.Javascript.Unit/App/Students/Controllers)
  • Routes (refer to Sandbox.Tests.Javascript.Unit/App/Students/Routes)
  • Directives (work in progress)
  • Filters (work in progress)

Note that the tests refer to stupid-simple AngularJS code contained within Sandbox.UI.Main. All of the AngularJS code is contained within the App folder. It is organized with the intent that the containing ASP.NET MVC website would be comprised of multiple AngularJS single page applications (SPA) where each SPA corresponds to a grouping of functionality. For a large site, SPAs may align to top-level main menu items/tabs/etc. Each SPA is given the same name as there would only one SPA loaded/active at any given time. In the example, the name of the primary SPA module is 'sandbox'.

#Required Configuration/Software#

#Optional But Very Helpful Elements#

#Quirks#

  • If your JavaScript unit tests do not appear in test explorer, restart VS.
  • In VS 2013, running unit tests with ReSharper results in a new blank browser session each time.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published