Angular Unit and Integration Testing Best Practices

19 views
Skip to first unread message

Greg Finzer

unread,
Apr 27, 2017, 8:48:49 AM4/27/17
to Angular and AngularJS discussion
I am an architect normally working in the Microsoft .NET space that is brand new to the Angular world.  I am looking for advice on the best practices for testing an Angular application.  Normally here is the stack that I would use for testing an ASP.NET MVC application:

Unit Tests - NUnit with MOQ, language C#
Integration Tests - NUnit, language C#
End to End Tests (User Interface Tests) - NUnit, Selenium, language C#

The client has zero automated tests currently on their legacy system which is a combination of Classic ASP with COM objects, ASP.NET Webforms, and ASP.NET MVC.  They are looking to replace their front end with Angular 4 and keep their WCF back end.  They have a complex database driven custom rules engine that will also stay.  Normally I would write unit tests against class methods in C#, mocking any external services.  Typical of organizations that have no automated tests, their code is tightly integrated with their external systems, and would require a lot of refactoring just to be able to test it.

My initial thoughts are to create some service integration tests for Angular in Karma/Jasmine and some Selenium/Protractor tests for the End to End Tests.  What should be tested in Angular as far as Unit Tests?  How would you do TDD in Angular?
Reply all
Reply to author
Forward
0 new messages