Skip to content

celonis/copilot-test-automation

Repository files navigation

🎉 Copilot API test automation

💻 Author

Manoj Sharma

Pre-requisite

  1. python3
  2. pip3

Build the code

  1. Clone the repo
  2. Go to project directory
cd py_api_test_automation_tests
  1. Install poetry
pip3 install poetry
  1. Go to virtual env
poetry shell
  1. Install dependencies
poetry install 

🤔 How to run API tests?

We need API_KEY to run these tests. Either set the environment variable or add the API_KEY directly in the config file. API KEY is used to create APP_KEY in the BG API tests.

E.g MacOS

export API_KEY=<Your environment specific app key>
export REALM=<'develop','alpha' or 'beta'>

⚠️ We need to place the required config file in resources folder under tests (tests/resources/config.yaml).

Config file (config.yaml)

TestConfig:
  testDataPrefix: API-AUTOMATION-TEST-
  realm: $REALM #set this value directly in yaml or set it via environment variable
  logRequestResponse : False #set it to True or False depending upon if you want to log request/response in report and on console

beta:
  Services:
    SampleService:
      baseUri: https://platform-core-qa-api.beta.celonis.cloud
      apiKey: $API_KEY #set this value directly in yaml or set it via environment variable

alpha:
  Services:
    SampleService:
      baseUri: https://business-graph.alpha.celonis.cloud
      apiKey: $API_KEY #set this value directly in yaml or set it via environment variable
      headers:
        - name: Authorization
          value: Bearer $API_KEY #set this value directly in yaml or set it via environment variable
        - name: tests
          value: tests
    SampleStreamService:
      baseUri: https://business-graph.alpha.celonis.cloud
      apiKey: $API_KEY #set this value directly in yaml or set it via environment variable
      stream: True
      headers:
        - name: Authorization
          value: Bearer $API_KEY #set this value directly in yaml or set it via environment variable

develop:
  Services:
    SampleService:
      baseUri: https://platform-core-qa-api.develop.celonis.cloud
      apiKey: $API_KEY #set this value directly in yaml or set it via environment variable

⚠️ Create a settings.py folder in the root of the project. This is used to standarize the ROOT_DIR.

import os

ROOT_DIR = os.path.dirname(os.path.abspath(__file__))

Run tests locally

poetry run pytest

Or filter the test run using markers

poetry run pytest -m <markers>

eg. to run all tests marked with '@pytest.mark.sanity'

poetry run pytest -m sanity 

🤔 Where are Test report?

Test Report are generated inside the report folder in root directory. If logRequestResponse property is enabled, then request/response body is also added to the report. This is useful in case of CI/CD run.

👋 Contributing

Contributions are always welcome! Thanks to all the contributions

Reach out to Manoj Sharma for queries.

⚠️ License

⚠️ Note: Details will be added soon......

🤝 Contact

Reach out to Manoj Sharma for queries.

About

No description, website, or topics provided.

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages