🖌️
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
  • Arrange
  • Act
  • Assert

Was this helpful?

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

AAA (Arrange, Act and Assert)

The AAA pattern advocates for splitting each test into three parts: arrange, act and assert. This pattern provides a simple and uniform structure for all the tests in the set. This uniformity is one of the main advantages of this pattern: once you get used to it, you can easily read and understand any test. That, in turn, reduces maintenance costs for the entire test suite.

example.spec.ts
it('Verify the enter key works', () => {
    //Arrange
    grid().should('be.exist');
    grid().should('be.visible');
    cellToEdit(0,3).should('be.visible');
    
    //Act
    cellToEdit(0,3).click();
    
    inputCell(1,3).should('be.visible');
    inputCell(1,3).should('be.visible');
    
    inputCell(1,3).type('500 {enter}');
    
    inputCell(2,3).should('be.visible');
    inputCell(2,3).should('be.visible');
    
    inputCell(2,3).type('500 {enter}');
    
    //Assert
    totalRowValue().should('have.text', ' $1000 ');
})

Arrange

This section is generally used to prepare the environment and make sure that it is in the initial state. In this section you can verify that you are in the correct view by identifying, for example, whether the components to be tested exist, do not exist, are visible or invisible.

The assertions that can be made in this section (Arrange) are not the same as those in the "Assert" section, they are generally used to verify that everything is ready, while those in the other section are to verify that the behavior to be tested works.

Act

In this section all the actions necessary to achieve the test objective are performed. For example, if you need to edit a cell, all the actions for clicking in the cell, typing text and changing the focus should be here.

Unlike unit tests, this section can have several lines of code, as many as necessary to achieve the desired functionality.

The assertions that can be made in this section (Act) are not the same as those in the "Assert" section, they are generally used to verify that the steps or actions taken are on track.

Assert

In this step, you assert that the thing you acted upon in step two did what you expected.

PreviousWhat is a Integration Test?NextBest Practices

Last updated 2 years ago

Was this helpful?