API Automation Using algoQA and CypressAPI Automation Testing with algoQA and Cypress

API Automation Testing with algoQA and Cypress

Run API automation tests using algoQA-generated scripts with Cypress UI or headless mode, and view the execution reports.

Cypress Overview

Cypress is an advanced end-to-end testing framework built with JavaScript, allowing developers to create and execute tests directly within the browser environment.

Prerequisite

For detailed prerequisites, refer to the Configuring Node.js Version and Cypress article.

API Test Automation When API Details Are Captured Using algoQA API Collection

For automating API tests using API collection, refer to the article Automating API Using API Collection.

Executing the Script Using Cypress UI

  1. Navigate to the folder where you downloaded the scripts to open the command prompt from the same folder.

    Make sure Cypress is configured on your system. For more details, refer to the prerequisite section.

  2. Run the following command to launch the Cypress UI.

    npx cypress open
    
  3. Cypress UI screen appears with Cypress configured. In this screen, select the E2E testing option.

    Cypress welcome screen with E2E Testing (Configured) and Component Testing cards
  4. Choose a browser screen appears. In this screen, select Chrome and click the Start E2E Testing in Electron button.

    Cypress Choose a browser screen with Chrome, Edge and Electron options and Start E2E Testing button
  5. The Feature File will be displayed. Click the Feature File to start the execution.

    Cypress Specs page listing API Automation LRS TestCases feature file highlighted
  6. The execution screen will be displayed.

    Cypress test runner showing API Automation test spec execution with 3 passing tests

Executing the Script in Headless Mode

With headless mode, tests run quickly without displaying the browser window. This means you can get test results faster, speeding up your testing process. Additionally, you can view the generated report. Ensure that Cypress is configured on your system.

Perform the following:

  1. Navigate to the same folder where you saved your algoQA-generated scripts. Type 'cmd' on the navigation bar to open the command prompt.
  2. Run the following command to execute the scripts:
    npx cypress run --headless
    
    Command prompt with npx cypress run --headless command highlighted and Cypress run output
  3. The report contains details like Feature, Scenario outline, examples, pass percentage, duration.
    Cypress test report showing 3 Passed banner and API Automation feature scenario outline with examples table