### OpenID Connect Metadata URL Example Source: https://www.testiny.io/docs/sso/oidc An example of the URL format for the OpenID Connect metadata, which is required for configuring SSO in Testiny. ```URL https://((customdomain))/((prefix:s))/.well-known/openid-configuration ``` -------------------------------- ### Find Test Cases Starting with 'App' Source: https://www.testiny.io/docs/api-quickstart Demonstrates a POST request to find test cases where the title begins with 'App', using the 'like' operator. ```bash POST 'https://app.testiny.io/api/v1/testcase/find' body: { "filter": { "title": { "op": "like", "value": "App%" } } } ``` -------------------------------- ### Fetch multiple entities using Testiny API (GET) Source: https://www.testiny.io/docs/api-quickstart Retrieve multiple entities from the Testiny API using a GET request. Parameters for filtering, ordering, or pagination can be passed as query parameters. ```shell GET https://app.testiny.io/api/v1/ ``` -------------------------------- ### Docker Compose for Testiny Server and PostgreSQL Source: https://www.testiny.io/docs/server This Docker Compose configuration sets up Testiny Server with a pre-configured PostgreSQL database. It defines services for the PostgreSQL container and the Testiny Server container, including network configurations, environment variables, and volume mounts for data persistence. This setup is suitable for getting started and may require adjustments for production environments. ```yaml services: testiny_postgres: image: postgres:14 container_name: testiny_postgres networks: - testiny_net environment: POSTGRES_USER: admin POSTGRES_PASSWORD: YOUR_SECRET_DB_PASSWORD volumes: - testiny_postgres_data:/var/lib/postgresql/data restart: unless-stopped testiny_server: image: registry.gitlab.com/testiny/server:stable container_name: testiny_server depends_on: testiny_postgres: condition: service_started networks: - testiny_net ports: - "7700:7700" environment: SERVER_URL: "http://localhost:7700" DB: postgres PG_HOST: testiny_postgres PG_USER: admin PG_PASSWORD: YOUR_SECRET_DB_PASSWORD volumes: - testiny_storage:/testiny/storage restart: unless-stopped volumes: testiny_postgres_data: name: testiny_postgres_data external: false testiny_storage: name: testiny_storage external: false networks: testiny_net: name: testiny_net ``` -------------------------------- ### Add Links to CI Run or Artifacts Source: https://www.testiny.io/docs/automation/importing-results This example demonstrates how to add clickable URLs to test runs by specifying them as fields using the `--field-values` option. ```bash --field-values my_url=https://www.example.com ``` -------------------------------- ### Get TestCaseFolder Schema and Example Source: https://www.testiny.io/docs/rest-api/create-a-new-test-case-folder-entity Defines the JSON schema and provides an example for a successful response when retrieving a single TestCaseFolder. It includes fields like id, title, timestamps, and project associations. ```json { "id": 0, "title": "A Descriptive Title", "sort_index": 0, "is_deleted": true, "created_at": "1970-01-01T00:00:00.000Z", "created_by": 0, "modified_at": "1970-01-01T00:00:00.000Z", "modified_by": 0, "deleted_at": "1970-01-01T00:00:00.000Z", "deleted_by": 0, "_etag": "string", "project_id": 0, "testcase_folder_parent_id": 0, "description": "string" } ``` -------------------------------- ### Display Testiny CLI Help (NPM) Source: https://www.testiny.io/docs/automation/cli This command uses npx to execute the Testiny CLI package and displays all available commands and options. It's the standard way to get help when using the CLI installed via NPM. ```bash npx @testiny/cli --help ``` -------------------------------- ### Install Testiny CLI with NPM Source: https://www.testiny.io/docs/integrations/ci-cd/custom-ci Installs the Testiny CLI using npm, a package manager for Node.js. This is a convenient way to install and keep the CLI updated for use in CI/CD environments. ```bash npm install -g testiny-cli ``` -------------------------------- ### Filter Test Cases by Title Like 'App' Source: https://www.testiny.io/docs/api-quickstart Fetches test cases where the 'title' field starts with 'App'. This utilizes the 'like' operator for pattern matching. ```json { "filter": { "title": { "op": "like", "value": "App%" } } } ``` -------------------------------- ### Server Setup: Database Seeding Source: https://www.testiny.io/docs/release-notes Ensures the database is seeded only once, even if the Testiny server setup is attempted multiple times from a fresh container missing the storage volume. ```text Only seed the database once even if setting up the Testiny server multiple times from a fresh container with the storage volume missing ``` -------------------------------- ### Fetch Test Case IDs with Filtering and ID Only (POST) Source: https://www.testiny.io/docs/api-quickstart This example demonstrates how to fetch only the IDs of test cases from a specific project using a POST request. It utilizes the DataReadParams to filter by 'project_id' and set 'idOnly' to true. ```shell POST 'https://app.testiny.io/api/v1/testcase/find' body: { filter: { "project_id": 3 } }, idOnly: true } ``` -------------------------------- ### Todoist Browse Link Example Source: https://www.testiny.io/docs/integrations/issue-trackers/todoist This is an example of the URL format for browsing Todoist projects. This link is used in Testiny to open the item list of your Todoist tool. ```text https://todoist.com/app/project/your-project-id ``` -------------------------------- ### Example API Key Naming Convention Source: https://www.testiny.io/docs/settings/api-keys An example of how an API key might be named, incorporating the current date. This naming convention helps in identifying the purpose or creation time of the key. ```text api-key-2022-11-01 ``` -------------------------------- ### Install and Configure Jira Add-on Source: https://www.testiny.io/docs/integrations/issue-trackers/jira-cloud This describes the process of installing the Jira add-on from the Atlassian Marketplace for a bi-directional integration. It involves obtaining an installation token from Testiny and configuring the add-on within Jira. ```text Install the app from the official Atlassian marketplace or by searching for "Testiny" in Jira (Apps > Find new apps). After installation, select "Configure" in the Jira add-on. Create an installation token in Testiny (Details tab of your Jira Cloud integration). Paste the Testiny installation token into the add-on configuration window in Jira and press "Connect". ``` -------------------------------- ### Execute Tests and Upload Results with Testiny CLI Source: https://www.testiny.io/docs/integrations/ci-cd/custom-ci This snippet demonstrates the general workflow: executing automated tests to generate a report and then using the Testiny CLI to upload these results. It assumes the CLI is installed and test results are in a supported format. ```shell # Execute your automated tests and generate a report (e.g., results.xml) # Example: npx playwright test --reporter=junit # Upload the results to Testiny testiny-cli upload --results "./results.xml" --project "your-project-id" --api-key "your-api-key" ``` -------------------------------- ### Install Testiny CLI with NPM Source: https://www.testiny.io/docs/automation/ci-cd-integration This snippet shows how to install the Testiny CLI using NPM, a common method for installing packages across various operating systems and environments. This is typically the first step in integrating the CLI into a CI/CD pipeline. ```bash npm install -g testiny-cli ``` -------------------------------- ### Install Jira Add-on for Testiny Server Source: https://www.testiny.io/docs/integrations/issue-trackers/jira-server Instructions for installing the Testiny Server add-on from the Atlassian Marketplace to enable a full bi-directional integration with Jira. This allows viewing Testiny activities directly within Jira issues. ```Jira Add-on Installation 1. Install the app from the official Atlassian marketplace. (Alternatively, navigate in Jira to Apps > Find new apps and search for "Testiny"). 2. After installing, select "Configure Integration" for the Testiny Server Plugin. 3. Set the Testiny Server URL and click "Save". ``` -------------------------------- ### Create a Single Test Run Source: https://www.testiny.io/docs/api-quickstart Creates a single test run with a specified title, project ID, and description. This is done using a POST request to the '/api/v1/testrun' endpoint. ```HTTP POST https://app.testiny.io/api/v1/testrun body: { "title": "My test run", "project_id": 3, "description": "created via API" } ``` -------------------------------- ### Initialize PostgreSQL Databases for Testiny Server Source: https://www.testiny.io/docs/server/advanced-topics This script demonstrates how to create and configure the necessary PostgreSQL databases ('central', 'tenant_main', 'tenant_testing') for Testiny Server. It includes setting ownership, encoding, tablespace, connection limits, and synchronous commit settings. ```sql CREATE ROLE testiny LOGIN PASSWORD 'changeme'; /* make sure to set a custom password here or change it after */ CREATE DATABASE central WITH OWNER = 'testiny' ENCODING = 'UTF8' TABLESPACE = pg_default CONNECTION LIMIT = -1; /* restrict if required, should be 2 * PG_MAX_POOL */ ALTER DATABASE central SET synchronous_commit=remote_apply; REVOKE CONNECT ON DATABASE central FROM PUBLIC; CREATE DATABASE tenant_main WITH OWNER = 'testiny' ENCODING = 'UTF8' TABLESPACE = pg_default CONNECTION LIMIT = -1; /* restrict if required, should be 2 * PG_MAX_POOL */ ALTER DATABASE tenant_main SET synchronous_commit=remote_apply; REVOKE CONNECT ON DATABASE tenant_main FROM PUBLIC; CREATE DATABASE tenant_testing WITH OWNER = 'testiny' ENCODING = 'UTF8' TABLESPACE = pg_default CONNECTION LIMIT = -1; /* restrict if required, should be 2 * PG_MAX_POOL */ ALTER DATABASE tenant_testing SET synchronous_commit=remote_apply; REVOKE CONNECT ON DATABASE tenant_testing FROM PUBLIC; ``` -------------------------------- ### Pull and Run Testiny Server Docker Image Source: https://www.testiny.io/docs/server Instructions for pulling the Testiny Server Docker image and launching it. This involves using Docker commands to fetch the image and then running a container, passing necessary environment variables for configuration. ```Shell docker pull testiny/testiny-server:latest docker run -d -p 8080:8080 -e SERVER_URL="https://testiny.mycompany.org" -e DB="postgres" testiny/testiny-server:latest ``` -------------------------------- ### Get TestCaseFolder Schema and Example Source: https://www.testiny.io/docs/rest-api/update-one-test-case-folder-entity Defines the JSON schema and provides an example for a successful response when retrieving a single TestCaseFolder. It includes fields like id, title, timestamps, and project associations. ```json { "id": 0, "title": "A Descriptive Title", "sort_index": 0, "is_deleted": true, "created_at": "1970-01-01T00:00:00.000Z", "created_by": 0, "modified_at": "1970-01-01T00:00:00.000Z", "modified_by": 0, "deleted_at": "1970-01-01T00:00:00.000Z", "deleted_by": 0, "_etag": "string", "project_id": 0, "testcase_folder_parent_id": 0, "description": "string" } ``` -------------------------------- ### Testiny CLI Help Source: https://www.testiny.io/docs/automation/reference Displays the general help information for the Testiny CLI, including usage instructions, available global options, and a list of supported commands. ```bash Usage: testiny-importer [options] [command] Options: --app App endpoint to use -P, --project Target project id, key or name --apikey The API key to use. Not recommended - use the environment variable TESTINY_API_KEY or TESTINY_IMPORT_API_KEY instead -h, --help display help for command Commands: testcase [options] Import manual test cases (with folders) automation [options] Import automated test run results, including test cases and environment data testrun [options] Import manual test case results as a testrun (*deprecated for importing automation results*) licenses Show included OSS package licenses help [command] display help for command ``` -------------------------------- ### Testiny CLI Environment Detection Source: https://www.testiny.io/docs/integrations/ci-cd/overview Demonstrates the Testiny CLI's capability to automatically detect and support various CI/CD environments. It lists supported environments and explains how to manually specify an environment using the `--environment` flag. ```bash Supported environments: none, auto, gitlab, github, azure, circle, jenkins, teamcity, bamboo, drone, buddy, bitbucket, gocd, appveyor, aws_codebuild, buildkite, codeship, codefresh, cloudbuild, semaphore, travis Use '--environment' to manually specify an environment. 'auto' for environment auto-detect; 'none' to disable. ``` -------------------------------- ### Testiny API: Get TestCase Schema and Example Source: https://www.testiny.io/docs/rest-api/delete-a-test-case-by-id Defines the JSON schema for a single Testiny TestCase, including fields for identification, metadata, ownership, and custom test case properties. Provides an example of a TestCase object. ```json { "id": "integer", "title": "string", "sort_index": "number", "is_deleted": "boolean", "created_at": "date-time", "created_by": "number", "modified_at": "date-time", "modified_by": "number", "deleted_at": "date-time", "deleted_by": "number", "_etag": "string", "project_id": "integer", "owner_user_id": "integer", "$owner_name": "string", "type": "string", "template": "string", "precondition_text": "string", "content_text": "string", "steps_text": "string", "expected_result_text": "string", "priority": "number", "status": "string", "testcase_type": "string", "automation": "string", "estimate": "number" } ``` ```json { "id": 0, "title": "A Descriptive Title", "sort_index": 0, "is_deleted": true, "created_at": "1970-01-01T00:00:00.000Z", "created_by": 0, "modified_at": "1970-01-01T00:00:00.000Z", "modified_by": 0, "deleted_at": "1970-01-01T00:00:00.000Z", "deleted_by": 0, "_etag": "string", "project_id": 0, "owner_user_id": 0, "$owner_name": "string", "type": "string", "template": "string", "precondition_text": "", "content_text": "", "steps_text": "", "expected_result_text": "", "priority": 1, "status": "", "testcase_type": "", "automation": "", "estimate": 100 } ``` -------------------------------- ### Submit JUnit Report with Testiny CLI (Linux) Source: https://www.testiny.io/docs/automation/getting-started This command imports JUnit-style XML test results using the Testiny CLI on Linux. Ensure the TESTINY_API_KEY environment variable is set and provide the project ID or key, source name, and the report file path. ```bash export TESTINY_API_KEY=**** ./testiny-importer-linux automation --project ID_OR_KEY --source "unit-tests" --junit report.xml ``` -------------------------------- ### Testiny API: Get TestCase Schema and Example Source: https://www.testiny.io/docs/rest-api/create-a-new-test-case-entity Defines the JSON schema for a single Testiny TestCase, including fields for identification, metadata, ownership, and custom test case properties. Provides an example of a TestCase object. ```json { "id": "integer", "title": "string", "sort_index": "number", "is_deleted": "boolean", "created_at": "date-time", "created_by": "number", "modified_at": "date-time", "modified_by": "number", "deleted_at": "date-time", "deleted_by": "number", "_etag": "string", "project_id": "integer", "owner_user_id": "integer", "$owner_name": "string", "type": "string", "template": "string", "precondition_text": "string", "content_text": "string", "steps_text": "string", "expected_result_text": "string", "priority": "number", "status": "string", "testcase_type": "string", "automation": "string", "estimate": "number" } ``` ```json { "id": 0, "title": "A Descriptive Title", "sort_index": 0, "is_deleted": true, "created_at": "1970-01-01T00:00:00.000Z", "created_by": 0, "modified_at": "1970-01-01T00:00:00.000Z", "modified_by": 0, "deleted_at": "1970-01-01T00:00:00.000Z", "deleted_by": 0, "_etag": "string", "project_id": 0, "owner_user_id": 0, "$owner_name": "string", "type": "string", "template": "string", "precondition_text": "", "content_text": "", "steps_text": "", "expected_result_text": "", "priority": 1, "status": "", "testcase_type": "", "automation": "", "estimate": 100 } ``` -------------------------------- ### Import Multiple JUnit XML Reports with Testiny CLI Source: https://www.testiny.io/docs/automation/getting-started This command imports multiple JUnit XML report files from the 'results/' directory into Testiny. It requires setting the TESTINY_API_KEY environment variable and specifies the project ID or key, the source name, and the pattern for the report files. ```bash export TESTINY_API_KEY=**** npx @testiny/cli automation --project ID_OR_KEY --source unit-tests --junit results/*.xml ``` -------------------------------- ### Testiny API: Get TestCase Schema and Example Source: https://www.testiny.io/docs/rest-api/find-a-single-test-case-entity-with-the-given-id Defines the JSON schema for a single Testiny TestCase, including fields for identification, metadata, ownership, and custom test case properties. Provides an example of a TestCase object. ```json { "id": "integer", "title": "string", "sort_index": "number", "is_deleted": "boolean", "created_at": "date-time", "created_by": "number", "modified_at": "date-time", "modified_by": "number", "deleted_at": "date-time", "deleted_by": "number", "_etag": "string", "project_id": "integer", "owner_user_id": "integer", "$owner_name": "string", "type": "string", "template": "string", "precondition_text": "string", "content_text": "string", "steps_text": "string", "expected_result_text": "string", "priority": "number", "status": "string", "testcase_type": "string", "automation": "string", "estimate": "number" } ``` ```json { "id": 0, "title": "A Descriptive Title", "sort_index": 0, "is_deleted": true, "created_at": "1970-01-01T00:00:00.000Z", "created_by": 0, "modified_at": "1970-01-01T00:00:00.000Z", "modified_by": 0, "deleted_at": "1970-01-01T00:00:00.000Z", "deleted_by": 0, "_etag": "string", "project_id": 0, "owner_user_id": 0, "$owner_name": "string", "type": "string", "template": "string", "precondition_text": "", "content_text": "", "steps_text": "", "expected_result_text": "", "priority": 1, "status": "", "testcase_type": "", "automation": "", "estimate": 100 } ``` -------------------------------- ### Get TestRun Response Schema and Example Source: https://www.testiny.io/docs/rest-api/create-a-new-test-run-entity This snippet details the JSON schema and provides an example for a successful response when retrieving a single TestRun. It outlines all fields associated with a TestRun, including its ID, title, timestamps, creator/modifier information, project association, and status. ```json { "id": 0, "title": "A Descriptive Title", "is_deleted": true, "created_at": "1970-01-01T00:00:00.000Z", "created_by": 0, "modified_at": "1970-01-01T00:00:00.000Z", "modified_by": 0, "deleted_at": "1970-01-01T00:00:00.000Z", "deleted_by": 0, "_etag": "string", "project_id": 0, "closed_at": "1970-01-01T00:00:00.000Z", "closed_by": 0, "is_closed": true, "testplan_id": 0, "description": "" } ``` -------------------------------- ### Submit JUnit Report with Testiny CLI (macOS) Source: https://www.testiny.io/docs/automation/getting-started This command imports JUnit-style XML test results using the Testiny CLI on macOS. Set the TESTINY_API_KEY environment variable and provide the project ID or key, source name, and the report file. ```bash export TESTINY_API_KEY=**** ./testiny-importer-macos automation --project ID_OR_KEY --source "unit-tests" --junit report.xml ``` -------------------------------- ### Get User Permissions for Projects (C#) Source: https://www.testiny.io/docs/rest-api/requests-the-current-users-permissions-for-each-project Example of how to retrieve user permissions for projects using C# HttpClient. It demonstrates setting the request URL, adding necessary headers like 'Accept' and 'X-Api-Key', sending the request, and handling the response. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://app.testiny.io/api/v1/permission/me/projects"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("X-Api-Key", ""); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Submit JUnit Report with Testiny CLI (Windows) Source: https://www.testiny.io/docs/automation/getting-started This command imports JUnit-style XML test results using the Testiny CLI on Windows. Set the TESTINY_API_KEY environment variable and specify the project ID or key, source name, and the report file. ```powershell set TESTINY_API_KEY=**** testiny-importer-win.exe automation --project ID_OR_KEY --source "unit-tests" --junit report.xml ``` -------------------------------- ### Get TestRun Response Schema and Example Source: https://www.testiny.io/docs/rest-api/update-one-test-run-entity This snippet details the JSON schema and provides an example for a successful response when retrieving a single TestRun. It outlines all fields associated with a TestRun, including its ID, title, timestamps, creator/modifier information, project association, and status. ```json { "id": 0, "title": "A Descriptive Title", "is_deleted": true, "created_at": "1970-01-01T00:00:00.000Z", "created_by": 0, "modified_at": "1970-01-01T00:00:00.000Z", "modified_by": 0, "deleted_at": "1970-01-01T00:00:00.000Z", "deleted_by": 0, "_etag": "string", "project_id": 0, "closed_at": "1970-01-01T00:00:00.000Z", "closed_by": 0, "is_closed": true, "testplan_id": 0, "description": "" } ``` -------------------------------- ### Submit JUnit Report with Testiny CLI (Node.js/npm) Source: https://www.testiny.io/docs/automation/getting-started This command uses the Testiny CLI to import JUnit-style XML test results. It requires setting the TESTINY_API_KEY environment variable and specifying the project ID or key, a source name, and the report file. ```bash export TESTINY_API_KEY=**** npx @testiny/cli automation --project ID_OR_KEY --source "unit-tests" --junit report.xml ``` -------------------------------- ### Find Project Entities via GET Request Source: https://www.testiny.io/docs/rest-api/find-project-entities-using-the-specified-query-parameters This snippet demonstrates how to find 'Project' entities using a GET request to the Testiny API. It includes the base URL, the 'q' query parameter for filtering, and the 'X-Api-Key' header for authorization. The example shows how to construct the request and handle the response. ```http GET https://app.testiny.io/api/v1/project?q={"filter": {"id": 1}} Authorization: X-Api-Key ``` -------------------------------- ### Run Testiny Server with Docker CLI (Windows) Source: https://www.testiny.io/docs/server This command shows how to run Testiny Server using the Docker CLI on a Windows system. It's similar to the Linux version but uses caret (^) for line continuation. The command maps the server port, mounts a volume for storage, and configures environment variables for database connection and server URL, pulling the stable Testiny Server image. ```cmd docker run -it -p 7700:7700 ^ -v testiny_storage:/testiny/storage ^ -e DB="postgres" ^ -e PG_HOST="127.0.0.1" ^ -e PG_PORT="5432" ^ -e PG_USER="postgres" ^ -e PG_PASSWORD="mysecretpassword" ^ -e SERVER_URL="http://localhost:7700" ^ --name testiny-server ^ registry.gitlab.com/testiny/server:stable ``` -------------------------------- ### Testiny Server CLI Help Source: https://www.testiny.io/docs/server/advanced-topics Displays all available command-line interface options for Testiny Server. This command is useful for discovering all functionalities and their parameters. ```bash node standalone.js --help ``` -------------------------------- ### Azure Pipelines YAML for Testiny Integration Source: https://www.testiny.io/docs/integrations/ci-cd/azure-pipelines This YAML configuration for Azure Pipelines demonstrates installing Node.js, installing the Testiny CLI via npm, running automated tests (Playwright example), and uploading the results to Testiny using the CLI. It highlights the use of a secret variable for the API key. ```YAML trigger: - main pool: vmImage: ubuntu-latest steps: - task: NodeTool@0 inputs: versionSpec: '18' displayName: 'Install Node.js' - script: # Install project dependencies # ... # Run your automated tests & generate a report file # ... # Install Testiny CLI & upload results - task: PublishTestResults@1 condition: succeededOrFailed() - script: npm install --no-save @testiny/cli@latest displayName: 'Install Testiny CLI' - script: npx @testiny/cli automation --project 1 --source e2e-tests --playwright results/results.json displayName: 'Upload results to Testiny' env: TESTINY_API_KEY: $(SECRET_TESTINY_API_KEY) ``` -------------------------------- ### Find TestCaseQuery by ID (C# HttpClient) Source: https://www.testiny.io/docs/rest-api/find-a-single-test-case-query-entity-with-the-given-id Example using C# HttpClient to fetch a TestCaseQuery by its ID. It sets the necessary headers, sends the GET request, and handles the response. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://app.testiny.io/api/v1/testcase-query/:id"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("X-Api-Key", ""); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Display Testiny CLI Help (Linux) Source: https://www.testiny.io/docs/automation/cli This command executes the Testiny CLI binary directly on a Linux system to display all available commands and options. It assumes the binary has been downloaded and extracted. ```bash ./testiny-importer-linux --help ``` -------------------------------- ### Retrieve TestCaseFolder by ID (C#) Source: https://www.testiny.io/docs/rest-api/find-a-single-test-case-folder-entity-with-the-given-id Example using C# HttpClient to fetch a TestCaseFolder by its ID. Requires the 'X-Api-Key' header for authorization. The code sends a GET request and prints the JSON response. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://app.testiny.io/api/v1/testcase-folder/:id"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("X-Api-Key", ""); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Submit Test Results with Custom Run Fields Source: https://www.testiny.io/docs/automation/getting-started This command demonstrates how to submit test results while specifying custom Run Fields and their values. This is useful for identifying and grouping test runs, especially in CI/CD environments. ```bash export TESTINY_API_KEY=**** npx @testiny/cli automation --project ID_OR_KEY --source "unit-tests" --field-values my_run_key=1234 --run-fields my_run_key --junit report.xml ``` -------------------------------- ### Display Testiny CLI Help (macOS) Source: https://www.testiny.io/docs/automation/cli This command executes the Testiny CLI binary on a macOS system to display all available commands and options. It assumes the binary has been downloaded and extracted. ```bash ./testiny-importer-macos --help ``` -------------------------------- ### C# Example for Testiny API TestCaseQuery Search Source: https://www.testiny.io/docs/rest-api/find-test-case-query-entities-using-the-specified-query-parameters This C# code uses HttpClient to send a GET request to the Testiny API to find TestCaseQuery entities. It includes setting the API key and accept headers. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://app.testiny.io/api/v1/testcase-query"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("X-Api-Key", ""); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Download Raw Blob Data (API Example) Source: https://www.testiny.io/docs/rest-api/download-raw-blob-data-by-entity-id Demonstrates how to make a GET request to download raw blob data by entity ID. Includes the API endpoint and authorization header. ```http GET https://app.testiny.io/api/v1/blob/raw/:id ``` -------------------------------- ### Complete Distributed Test Run Source: https://www.testiny.io/docs/automation/getting-started This command finalizes a distributed test run by marking it as complete. It should be used after all incomplete reports have been submitted. ```bash export TESTINY_API_KEY=**** # complete run npx @testiny/cli automation --project ID_OR_KEY --source "unit-tests" --complete-runs --field-values my_run_key=1234 --run-fields my_run_key ``` -------------------------------- ### C# Example: Find AutomationSource Entities Source: https://www.testiny.io/docs/rest-api/find-automation-source-entities-using-the-specified-query-parameters This C# code snippet demonstrates how to use HttpClient to make a GET request to the Testiny API to find 'AutomationSource' entities. It includes setting the API key and handling the response. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://app.testiny.io/api/v1/atm-source"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("X-Api-Key", ""); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Submit Distributed Test Results (Incomplete) Source: https://www.testiny.io/docs/automation/getting-started This command imports a partial set of test results, marking the run as incomplete. This is useful for distributed testing scenarios where multiple reports need to be added to the same run. ```bash export TESTINY_API_KEY=**** # report 1 npx @testiny/cli automation --project ID_OR_KEY --source "unit-tests" --incomplete --field-values my_run_key=1234 --run-fields my_run_key --junit report1.xml # report 2 npx @testiny/cli automation --project ID_OR_KEY --source "unit-tests" --incomplete --field-values my_run_key=1234 --run-fields my_run_key --junit report2.xml ``` -------------------------------- ### Add Attachment to Test Case Source: https://www.testiny.io/docs/api-quickstart Uploads a file and attaches it to a specific test case. Requires title and filename as query parameters, and the file data in the request body. ```HTTP POST https://app.testiny.io/api/v1/testcase/upload-attachment/:id Query parameters: * title (REQUIRED) * filename (REQUIRED) * mime_type (optional) - if not set the content-type header is used body: raw/binary (image/file) data ``` ```HTTP POST 'https://app.testiny.io/api/v1/testcase/upload-attachment/1234?title=MyScreenshot&filename=screenshot.jpeg&mime_type=image/jpeg' body: raw/binary (image/file) data ``` -------------------------------- ### Import Distributed Test Results to Same Run Source: https://www.testiny.io/docs/automation/importing-results This example shows how to import results from split tests into the same Testiny run. It uses the `--incomplete` flag for individual reports and a final command to mark the run as complete. Custom run fields are also specified. ```bash export TESTINY_API_KEY=**** # report 1 npx @testiny/cli automation --project ID_OR_KEY --source "unit-tests" --incomplete --field-values my_run_key=1234 --run-fields my_run_key --junit report1.xml # report 2 npx @testiny/cli automation --project ID_OR_KEY --source "unit-tests" --incomplete --field-values my_run_key=1234 --run-fields my_run_key --junit report2.xml # complete run npx @testiny/cli automation --project ID_OR_KEY --source "unit-tests" --complete-runs --field-values my_run_key=1234 --run-fields my_run_key ``` -------------------------------- ### Create Multiple Test Runs in Bulk Source: https://www.testiny.io/docs/api-quickstart Creates multiple test runs simultaneously by sending an array of test run objects to the '/api/v1/testrun/bulk' endpoint. Each object in the array should contain the title and project ID for a test run. ```HTTP POST https://app.testiny.io/api/v1/testrun/bulk body: [ { "title": "My test run", "project_id": 3, },{ "title": "Another test run", "project_id": 3, }] ``` -------------------------------- ### Custom Test Run Title Pattern Source: https://www.testiny.io/docs/automation/importing-results This example demonstrates how to define a custom pattern for test run titles in Testiny using the `--run-title-pattern` option. The pattern can include placeholders for environment variables like CI pipeline ID, branch name, and commit hash. ```bash --run-title-pattern "Pipeline %{ci_pipeline_id} - %{vc_branch} - %{vc_commit}" ``` -------------------------------- ### Testiny CLI: Handling Incomplete Runs Source: https://www.testiny.io/docs/automation/importing-results By default, the Testiny CLI automatically completes automation test runs after importing results. To prevent this, for example, when submitting results from different jobs or builds, use the `--incomplete` flag. This allows for adding more results to an ongoing test run. ```bash testiny upload --source "backend-api" --report "./results.xml" --incomplete ``` -------------------------------- ### Upgrade Testiny Server with Docker Source: https://www.testiny.io/docs/server This snippet details the steps to upgrade Testiny Server using direct Docker commands. It includes stopping and removing the existing container, pulling the latest stable image, and then restarting the server. ```Shell docker stop testiny-server docker rm testiny-server docker pull registry.gitlab.com/testiny/server:stable # Execute the same command as shown under Using Docker ```