Angular 2 Test-driven Development

Key FeaturesLearn test-driven development (TDD) in JavaScript and see its power though clear examplesEnhance your understanding with details on Karma and Protractor, and set up an Angular2 test suit with themA practical guide filled examples that focus on a wide range of testing techniques in a professional Angular2 applicationBook DescriptionThis is a complete guide that shows you testing techniques with Karma to perform unit testing and end-to-end testing with Protractor. It will show you how to optimize your Angular 2 development process using TDD techniques and ensure the final project is free of bugs.We start by reviewing the TDD life cycle, TDD in the context of JavaScript, and various JavaScript test tools and frameworks. You will see how Karma and Protractor can make your life easier while running JavaScript unit tests. We will enable you to build a test suite for an Angular2 application and build a testable Angular2 medium-to-large scale application by handling REST API data.Building on the initial foundational aspects, we move on to testing for multiple classes, partial views, location references, CSS, and the HTML element. In addition, we will explore how to use a headless browser with Karma. We will also configure a Karma file to automate the testing and tackle elements of Angular2 (components, services, classes, and broadcasting) using TDD.Finally, you will find out how to pull data using an external API, set up and configure Protractor to use a standalone Selenium server, and set up Travis CI and Karma to test your application.What you will learnGet a clear overview of TDD in the context of JavaScript with a brief look at testing techniques, tools, and frameworksGet an overview of Karma and Protractor and create test suites for an Angular2 application with themUnderstand automated testing and implement headless automated tests with KarmaImplement the testing techniques with mocks, broadcast events, and asynchronous behaviorIntegrate REST-based services and APIs into an application to extract dataAutomate Karma unit tests with Travis CIAbout the AuthorMd. Ziaul Haq is a senior software engineer, full stack JavaScript developer, front-end architect, speaker, and certified scrum master who has worked in an upwork development team (remotely) as JavaScript Developer since 2011. He likes to play with new technologies, and is a passionate programmer loves to code daylong with JavaScript. Beside JavaScript, he has worked on LAMP technologies since an early stage in his career.Ziaul Haq started his career in 2005 as a software developer, and in his 10-year career journey, he has worked with various software development hubs and start-ups, including UNICEF in different countries as a web consultant. He just completed his MS in computer science from United International University.Ziaul Haq likes to watch soccer, and is a huge fan of Barca and Messi. He also likes to read blogs, moderate techi groups, and is very active in the local JavaScript community, where he is well known as jquerygeek.

Author: Md. Ziaul Haq

Learn more