Testing JavaScript applications

Detalles Bibliográficos
Otros Autores: Da Costa, Lucas, author (author)
Formato: Libro electrónico
Idioma:Inglés
Publicado: Shelter Island, New York : Manning [2021]
Materias:
Ver en Biblioteca Universitat Ramon Llull:https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009631576606719
Tabla de Contenidos:
  • Intro
  • inside front cover
  • Testing JavaScript Applications
  • Copyright
  • dedication
  • contents
  • front matter
  • preface
  • acknowledgments
  • about this book
  • Who should read this book
  • How this book is organized: A roadmap
  • About the code
  • System requirements
  • liveBook discussion forum
  • about the author
  • about the cover illustration
  • Part 1. Testing JavaScript applications
  • 1 An introduction to automated testing
  • 1.1 What is an automated test?
  • 1.2 Why automated tests matter
  • 1.2.1 Predictability
  • 1.2.2 Reproducibility
  • 1.2.3 Collaboration
  • 1.2.4 Speed
  • Summary
  • 2 What to test and when?
  • 2.1 The testing pyramid
  • 2.2 Unit tests
  • 2.3 Integration tests
  • 2.4 End-to-end tests
  • 2.4.1 Testing HTTP APIs
  • 2.4.2 Testing GUIs
  • 2.4.3 Acceptance tests and end-to-end tests are not the same
  • 2.5 Exploratory testing and the value of QA
  • 2.6 Tests, cost, and revenue
  • Summary
  • Part 2. Writing tests
  • 3 Testing techniques
  • 3.1 Organizing test suites
  • 3.1.1 Breaking down tests
  • 3.1.2 Parallelism
  • 3.1.3 Global hooks
  • 3.1.4 Atomicity
  • 3.2 Writing good assertions
  • 3.2.1 Assertions and error handling
  • 3.2.2 Loose assertions
  • 3.2.3 Using custom matchers
  • 3.2.4 Circular assertions
  • 3.3 Test doubles: Mocks, stubs, and spies
  • 3.3.1 Mocking imports
  • 3.4 Choosing what to test
  • 3.4.1 Don't test third-party software
  • 3.4.2 To mock, or not to mock: That's the question
  • 3.4.3 When in doubt, choose integration tests
  • 3.5 Code coverage
  • 3.5.1 Automated coverage reports
  • 3.5.2 Coverage types
  • 3.5.3 What coverage is good for and what it isn't
  • Summary
  • 4 Testing backend applications
  • 4.1 Structuring a testing environment
  • 4.1.1 End-to-end testing
  • 4.1.2 Integration testing
  • 4.1.3 Unit testing
  • 4.2 Testing HTTP endpoints
  • 4.2.1 Testing middleware.
  • 4.3 Dealing with external dependencies
  • 4.3.1 Integrations with databases
  • 4.3.2 Integrations with other APIs
  • Summary
  • 5 Advanced backend testing techniques
  • 5.1 Eliminating nondeterminism
  • 5.1.1 Parallelism and shared resources
  • 5.1.2 Dealing with time
  • 5.2 Reducing costs while preserving quality
  • 5.2.1 Reducing overlap between tests
  • 5.2.2 Creating transitive guarantees
  • 5.2.3 Turning assertions into preconditions
  • Summary
  • 6 Testing frontend applications
  • 6.1 Introducing JSDOM
  • 6.2 Asserting on the DOM
  • 6.2.1 Making it easier to find elements
  • 6.2.2 Writing better assertions
  • 6.3 Handling events
  • 6.4 Testing and browser APIs
  • 6.4.1 Testing a localStorage integration
  • 6.4.2 Testing a History API integration
  • 6.5 Dealing with WebSockets and HTTP requests
  • 6.5.1 Tests involving HTTP requests
  • 6.5.2 Tests involving WebSockets
  • Summary
  • 7 The React testing ecosystem
  • 7.1 Setting up a test environment for React
  • 7.1.1 Setting up a React application
  • 7.1.2 Setting up a testing environment
  • 7.2 An overview of React testing libraries
  • 7.2.1 Rendering components and the DOM
  • 7.2.2 React Testing Library
  • 7.2.3 Enzyme
  • 7.2.4 The React test renderer
  • Summary
  • 8 Testing React applications
  • 8.1 Testing component integration
  • 8.1.1 Stubbing components
  • 8.2 Snapshot testing
  • 8.2.1 Snapshots beyond components
  • 8.2.2 Serializers
  • 8.3 Testing styles
  • 8.4 Component-level acceptance tests and component stories
  • 8.4.1 Writing stories
  • 8.4.2 Writing documentation
  • Summary
  • 9 Test-driven development
  • 9.1 The philosophy behind test-driven development
  • 9.1.1 What test-driven development is
  • 9.1.2 Adjusting the size of your iterations
  • 9.1.3 Why adopt test-driven development?
  • 9.1.4 When not to apply test-driven development
  • 9.2 Writing a JavaScript module using TDD.
  • 9.3 Testing top-down versus testing bottom-up
  • 9.3.1 What bottom-up and top-down testing mean
  • 9.3.2 How top-down and bottom-up approaches impact a test-driven workflow
  • 9.3.3 The pros and cons of bottom-up versus top-down approaches
  • 9.4 Balancing maintenance costs, delivery speed, and brittleness
  • 9.4.1 Test-driven implementation
  • 9.4.2 Test-driven maintenance
  • 9.5 Setting up an environment for TDD to succeed
  • 9.5.1 Teamwide adoption
  • 9.5.2 Keeping distinct lanes
  • 9.5.3 Pairing
  • 9.5.4 Supplementary testing
  • 9.6 TDD, BDD, validations, and specificationsBDD (behavior-driven development)
  • Summary
  • 10 UI-based end-to-end testing
  • 10.1 What are UI-based end-to-end tests?
  • 10.2 When to write each type of test
  • 10.2.1 UI-based end-to-end tests
  • 10.2.2 Pure end-to-end tests
  • 10.2.3 Pure UI tests
  • 10.2.4 A note on acceptance testing and this chapter's name
  • 10.3 An overview of end-to-end testing tools
  • 10.3.1 Selenium
  • 10.3.2 Puppeteer
  • 10.3.3 Cypress
  • 10.3.4 When to choose Cypress
  • Summary
  • 11 Writing UI-based end-to-end tests
  • 11.1 Your first UI-based end-to-end tests
  • 11.1.1 Setting up a test environment
  • 11.1.2 Writing your first tests
  • 11.1.3 Sending HTTP requests
  • 11.1.4 Sequencing actions
  • 11.2 Best practices for end-to-end-tests
  • 11.2.1 Page objects
  • 11.2.2 Application actions
  • 11.3 Dealing with flakiness
  • 11.3.1 Avoiding waiting for fixed amounts of time
  • 11.3.2 Stubbing uncontrollable factors
  • 11.3.3 Retrying tests
  • 11.4 Running tests on multiple browsers
  • 11.4.1 Using a testing framework to run tests within a browser
  • 11.4.2 Running UI-based tests in multiple browsers
  • 11.5 Visual regression tests
  • Summary
  • Part 3. Business impact
  • 12 Continuous integration and continuous delivery
  • 12.1 What are continuous integration and continuous delivery?.
  • 12.1.1 Continuous integration
  • 12.1.2 Continuous delivery
  • 12.2 The role of automated tests in a CI/CD pipeline
  • 12.3 Version-control checks
  • Summary
  • 13 A culture of quality
  • 13.1 Using type systems to make invalid states unrepresentable
  • 13.2 Reviewing code to catch problems machines can't
  • 13.3 Using linters and formatters to produce consistent code
  • 13.4 Monitoring your systems to understand how they actually behave
  • 13.5 Explaining your software with good documentation
  • Summary
  • index
  • inside back cover.