🖌️
Product Process Documentation
  • Product Process Documentation
  • Definition of Done (DoD)
    • General checkpoints
      • Specific checkpoints by team
    • Important process: QA review & PO review
      • QA Review
      • PO Review
  • Work Items
    • Product Backlog Item (PBI)
    • Bug
      • Basic rules for creating a bug
      • How to report a Bug
    • Bugs Management
  • Code Standards
  • Different Test Levels
    • Unit Test
      • Frontend Unit Testing
        • What is a Unit Test?
        • How do I know if I am developing a good unit test?
        • AAA (Arrange, Act and Assert)
        • Overloaded test suits
        • Setup & Teardown
          • JEST Mocks
          • FakeTimers
        • Istanbul Annotations
        • C8 Annotations
        • JEST Runner (Debug unit tests with Jest)
    • Component Test
      • Frontend Component Testing
        • What is Component Testing?
        • Best practices
        • Bad practices
        • Setup
          • Sandbox
          • Mocks, Services and Providers
          • Test scenario
    • Integration Test
      • Frontend Integration Testing
        • What is a Integration Test?
        • AAA (Arrange, Act and Assert)
        • Best Practices
        • Bad practices
        • Setup & Teardown
        • How to create a scenario
          • Create the migrated app
          • Add to project
        • How to debug
        • Common problems
      • Testing Driven Development Guide and recommendations
    • Functional Test
    • Security Testing
      • Security Testing Tools
      • Frontend Security Testing
    • Performance testing
    • Best Practices
    • Test Documentation
  • Run test projects
    • General steps
    • Specific steps by team
  • DevOps
    • Pipelines
    • Builds
    • Specific information by team
    • Test plan
    • Service Hooks for Azure DevOps Notifications
      • Slack Notifications
      • Microsoft Teams Notifications
  • Dashboards
    • General
    • QA Dashboards
  • Release Process
    • General Steps
    • Specific steps by team
  • Migration Cells
    • Basics of testing process
  • Release process
  • References
Powered by GitBook
On this page

Was this helpful?

  1. Different Test Levels
  2. Unit Test
  3. Frontend Unit Testing

Setup & Teardown

Unit Test Structure Setup

  • beforeAll: Is run once before all the tests in a describe. This method executes the functions in charge of configuring or restoring the test environment.

  • afterAll: Is run once after all the tests in a describe. This method executes the functions in charge of cleaning the environment affected by the execution of the test suit.

  • beforeEach: Is run before each test in a describe. This method executes the functions in charge of configuring or restoring the environment to be clean before the execution of each test.

  • afterEach: Is run after each test in a describe. This method executes the functions in charge of cleaning the environment after it has been affected by a previously executed test.

  • fixture: It is the container of the component and the testing environment.

Unit Test Teardown

It is responsible for the restoration or cleaning of the test environment for each test or test suit.

The cleaning of the testing environment consist of:

  • Mock cleaning: JEST Mocks.

  • Timers restoring: FakeTimers.

PreviousOverloaded test suitsNextJEST Mocks

Last updated 2 years ago

Was this helpful?