Mastering Angular Test-Driven Development Build High-Quality Angular Apps with Step-by-step Instructions and Practical Examples

Do you want to learn how to build robust, reliable, and impressive Angular applications? If yes, then Angular test-driven development is for you! Mastering Angular Test-Driven Development is a comprehensive guide that provides you with essential resources to enhance your skills and deliver high-qual...

Descripción completa

Detalles Bibliográficos
Otros Autores: Agbla, Ezéchiel Amen, author (author)
Formato: Libro electrónico
Idioma:Inglés
Publicado: Birmingham, England : Packt Publishing [2024]
Edición:First edition
Materias:
Ver en Biblioteca Universitat Ramon Llull:https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009853628706719
Tabla de Contenidos:
  • Cover
  • Title Page
  • Copyright and Credits
  • Contributors
  • Table of Contents
  • Preface
  • Part 1: Getting Started with Test-Driven Development in Angular
  • Chapter 1: Taking Your First Steps with TDD
  • Technical requirements
  • Understanding TDD and its role in Angular
  • What is Angular and TDD?
  • The red-green-refactor cycle
  • Benefits of the red-green-refactor cycle
  • The role of TDD in Angular development
  • Setting up the development environment
  • Installing Node.js on Windows or macOS
  • Installing Node.js on Linux
  • Creating a new Angular project
  • Exploring different files related to writing tests
  • *.spec.ts files
  • The karma.conf.js file
  • The test.ts file
  • The tsconfig.spec.json file
  • The src/test.ts file
  • Summary
  • Chapter 2: Using Jasmine and Karma to Test Angular Applications
  • Technical requirements
  • Mastering Jasmine's unit testing techniques
  • What is Jasmine?
  • Writing descriptive test suites
  • Choosing meaningful names
  • Structuring test suites
  • Writing clear and concise test descriptions
  • Maintaining and updating descriptive test suites
  • Writing your first unit tests in an Angular project
  • Utilizing code coverage and test result analysis with Karma
  • Code coverage visualization
  • Summary
  • Part 2: Writing Effective Unit Tests
  • Chapter 3: Writing Effective Unit Tests for Components, Services, and Directives
  • Technical requirements
  • Advanced techniques for Angular unit testing - lifecycle hooks
  • Discovering lifecycle hooks
  • Practical application
  • Advanced techniques for Angular unit testing - Angular services
  • Testing service methods
  • Using rigorous directive testing to ensure proper rendering and functionality
  • Implementing color change directives
  • Writing tests for the colorChange directive
  • Summary.
  • Chapter 4: Mocking and Stubbing Dependencies in Angular Tests
  • Technical requirements
  • Monitoring and controlling dependency calls using method stubs and spies
  • Method stubs and spies
  • Injecting mocked dependencies using TestBed providers
  • Handling async operations and complex scenarios
  • Understanding asynchronous operations
  • Handling asynchronous operations
  • Emphasizing the importance of testing async operations
  • Summary
  • Chapter 5: Testing Angular Pipes, Forms, and Reactive Programming
  • Technical requirements
  • Testing an Angular pipe as used in our project
  • Positive number to percentage string formatting test
  • Negative number to percentage string formatting test
  • Decimal number to percentage string formatting test
  • Non-number to percentage string formatting test
  • Implementing TDD for the Reactive Form in our calculator app
  • Writing a test for the calculator form
  • Implementing the user interface
  • Writing tests for the calculator component
  • Summary
  • Part 3: End-to-End Testing
  • Chapter 6: Exploring End-to-End Testing with Protractor, Cypress, and Playwright
  • Technical requirements
  • Understanding E2E testing
  • Discovering the benefits of E2E testing
  • Exploring different approaches to E2E testing
  • Comparison between script-based testing and exploratory testing
  • Harnessing the power of E2E testing tools
  • Analyzing the benefits of E2E testing in a project
  • Exploring Protractor, Cypress, and Playwright for E2E testing
  • Protractor
  • Cypress
  • Playwright
  • Summary
  • Chapter 7: Understanding Cypress and its Role in End-to-End Web Applications
  • Technical requirements
  • Discovering Cypress and its role in an Angular project
  • Understanding Cypress
  • Seamless integration with Angular
  • Efficient testing workflow
  • Real-time reloading and debugging.
  • Setting up Cypress in our Angular project
  • Installing Cypress
  • Configuring Cypress
  • Writing your first E2E test
  • Summary
  • Chapter 8: Writing Effective End-to-End Component Tests with Cypress
  • Technical requirements
  • Structuring E2E tests
  • Writing test cases
  • Addition context
  • Subtraction context
  • Multiplication context
  • Division context
  • Using Cypress custom commands
  • Summary
  • Part 4: Continuous Integration and Continuous Deployment for Angular Applications
  • Chapter 9: Understanding Continuous Integration and Continuous Deployment (CI/CD)
  • Technical requirements
  • Understanding CI and CD
  • What is CI?
  • Benefits of CI for development teams
  • Key principles of CI implementation
  • What is CD?
  • Benefits of CD for development teams
  • Key principles of CD implementation
  • Setting up CI/CD pipelines for automating build with GitHub Actions
  • Step 1 - create or choose a repository and project
  • Step 2 - open GitHub Actions in your project repository
  • Step 3 - define your CI/CD workflow
  • Setting up CI/CD pipelines for automating tests with GitHub Actions
  • Setting up CI/CD pipelines for automating the deployment process with GitHub Actions
  • Summary
  • Chapter 10: Best Practices and Patterns for Angular TDD
  • Best practices for TDD in Angular projects
  • Exploring patterns for implementing TDD in any Angular project
  • Choosing a TDD pattern for your Angular project
  • Summary
  • Chapter 11: Refactoring and Improving Angular Code through TDD
  • Technical requirements
  • Refactoring Angular code with TDD
  • The power of the test-first approach
  • Benefits of TDD in refactoring
  • Examples in action
  • Choosing the right tests to write
  • Identifying code smells and areas for improvement in Angular applications
  • What are code smells?
  • Why should we care about code smells in Angular?.
  • Identifying the most common code smells in Angular applications
  • Iterative improvement - red-green-refactor cycle for continuous code enhancement
  • Red - setting the stage with failing tests
  • Green - making the test pass with minimal code
  • Refactor - transforming the code with confidence
  • Summary
  • Index
  • Other Books You May Enjoy.