Skip to content

Execute all the TestProject jobs in a specific project and ensure all pass.

Notifications You must be signed in to change notification settings

www-norma-dev/test-project-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace
 
 

Repository files navigation

TestProject Job Execution

TestProject Job Execution is a Github action that can be used for running test jobs that are created via the TestProject platform. The action requires the application ID and API key to be able to call the TestProject APIs and execute all the tests that exist in the given project.

The action will first get a list of all jobs in the project, execute them, and then will check periodically the status of every job until all jobs are finished. If any job fails, the action will also fail so that the CI/CD pipeline does not continue.

Test extension in local environment

To run the action locally, you need to create a file called .env in the root of the repository.

The file should contain the following parameters:

  • INPUT_PROJECT_ID:
  • INPUT_API_KEY:
  • INPUT_APPLICATION_URL:

Import the .env file using the following code in file execute-tests.js:

const dotenv = require('dotenv');
dotenv.config();

After importing the .env file, you can run the project using the following command:

node execute-tests.js

Using the action

To use this action as part of your pipeline, add a new job for testing which will use this action and pass the required parameters project_id and api_key.

name: CI/CD Pipeline

on: 
  push: 
    branches:
      - production

jobs:
  test:
    name: CI Pipeline
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: TestProject test automation
        uses: www-norma-dev/[email protected]
        with:
          project_id: ${{ secrets.TEST_PROJECT_ID }}
          api_key: ${{ secrets.TEST_PROJECT_API_KEY }}
          application_url: https://app.example.dev

In the above snippet, the project_id and api_key are being fetched from the GitHub project secrets. For more information about how to add and manage project secrets, read the guide from GiHub Docs.

Parameters

project_id: The ID of the project on TestProject of which you want to execute tests for.

api_key: The API key of your TestProject account. Can be created here

application_url: url of the application where the tests will be run

check_interval: The interval in seconds of which the action should check the status of running tests. (Recommended to not make this too short so you will not be spamming TestProject APIs)

wait_for_tests: Whether the action should wait for the tests to complete (pass/fail) or if it should just start them and complete the action. (Default = true)

agent: select a default agent in the active agents in test-project (Default = false)

waiting_execution_time: Execution time in minutes allows to stop the execution after a time

About

Execute all the TestProject jobs in a specific project and ensure all pass.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%