From 4b961b1ad15ce68c9daf447f6fda35d9723d9ae7 Mon Sep 17 00:00:00 2001 From: amanchopra1905 Date: Thu, 23 Jan 2025 15:31:49 +0530 Subject: [PATCH 1/3] selenium customData doc --- docs/selenium-add-test-meta-data.md | 158 ++++++++++++++++++++++++++++ sidebars.js | 2 +- 2 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 docs/selenium-add-test-meta-data.md diff --git a/docs/selenium-add-test-meta-data.md b/docs/selenium-add-test-meta-data.md new file mode 100644 index 000000000..59f963a07 --- /dev/null +++ b/docs/selenium-add-test-meta-data.md @@ -0,0 +1,158 @@ +--- +id: selenium-add-test-meta-data +title: Add your test metadata using customData capability +hide_title: false +sidebar_label: Adding Test Metadata +description: The customData capability allows users to associate additional metadata with test runs, enabling better traceability, debugging, and reporting. +keywords: + - lambdatest automation + - selenium automation grid + - metadata + - custom data + - traceability + - debugging + - reporting +url: https://www.lambdatest.com/support/docs/selenium-add-test-meta-data/ +site_name: LambdaTest +slug: selenium-add-test-meta-data/ +--- + + +The `customData` capability allows you to associate additional metadata with test runs, enabling better traceability, debugging, and reporting. This metadata can include information like issue tracker links, test case IDs, and other critical test context. By embedding this metadata in test configurations, your team can easily integrate with their existing tools and workflows, such as GitHub, Jira, or any test management system. + +## How to add custom metadata for running automation tests on LambdaTest +To add custom metadata in your automation tests, simply add the capability `customData` in your test script with all the metadata information that we support to add: + +```javascript title="Test.js" +exports.capabilities = { + // ...other capabilities + "customData": [{ + "_id": "5f46aaa69adf77cfe2bb4fd6", + "index": "0", + "guid": "9451b204-12f0-4177-8fe9-fb019b3e4bf3", + "isActive": "False", + "picture": "https://www.placehold.it/32x32" + }] +}; +``` + +## Use Cases for `customData` + +### 1. Enhanced Reporting with GitHub and Jira Links +**Scenario :** A QA team wants to include direct links to GitHub pull requests or Jira issues related to a test. This helps developers and testers quickly access related code changes or tasks when a test fails. + +```javascript title="Test.js" +'customData': { + "jiraTicket": "JIRA-12345", + "githubPR": "https://github.com/organization/repo/pull/678", + "testDescription": "This test validates login functionality under high load." +} +``` + +- **`jiraTicket` :** Links the test to the corresponding Jira issue for easy navigation. +- **`githubPR` :** Links to the pull request that introduced the changes being tested. +- **`testDescription` :** Provides a brief description of the test's purpose. + +### 2. Linking Test Management Systems +**Scenario :** The team uses a test management tool (e.g., TestRail, Zephyr) to manage test cases. Adding the test case ID ensures results can be linked back to the test plan. + +```javascript title="Test.js" +'customData': { + "testCaseID": "TC-56789", + "testSuite": "Regression Suite", + "priority": "High", + "owner": "qa_team@company.com" +} +``` + +- **`testCaseID` :** Maps the execution to a specific test case in the test management system. +- **`testSuite` :** Specifies the test suite or category the test belongs to. +- **`priority` :** Indicates the importance or severity of the test. +- **`owner` :** Identifies the owner or responsible party for the test. + +### 3. Debugging with Environment Metadata +**Scenario :** When debugging test failures, it’s helpful to include information about the environment or build being tested. + +```javascript title="Test.js" +'customData': { + "buildNumber": "1234", + "environment": "Staging", + "apiVersion": "v1.2.3", + "releaseTag": "v1.2.3-rc1" +} +``` + +- **`buildNumber` :** Identifies the specific build of the application being tested. +- **`environment` :** Indicates the environment (e.g., Development, Staging, Production) the test was run in. +- **`apiVersion` :** Provides the API version being tested. +- **`releaseTag` :** Links the test to a specific release or tag in the version control system. + +### 4. Capturing User Story or Feature Metadata +**Scenario :** A product manager wants test results linked to specific user stories or features for tracking progress on new functionality. + +```javascript title="Test.js" +'customData': { + "featureID": "FEAT-9876", + "userStory": "As a user, I want to reset my password securely.", + "sprint": "Sprint 45" +} +``` + +- **`featureID` :** Links the test to a specific feature ID in the product backlog. +- **`userStory` :** Describes the user story being validated. +- **`sprint` :** Indicates the sprint or iteration in which the feature is being developed. + +### 5. Tracking Third-Party Dependencies +**Scenario :** A test depends on third-party APIs or integrations, and it’s crucial to track the versions or configurations of these dependencies. + +```javascript title="Test.js" +'customData': { + "thirdPartyAPI": "Stripe", + "apiVersion": "2023-01-15", + "status": "Active" +} +``` + +- **`thirdPartyAPI` :** Identifies the external service used. +- **`apiVersion` :** Specifies the version of the API. +- **`status` :** Indicates the status or availability of the dependency. + +### 6. Integrating Test Runs with CI/CD Pipelines +**Scenario :** A DevOps team wants to include pipeline-specific metadata in the test report to track CI/CD execution details. + +```javascript title="Test.js" +'customData': { + "pipelineID": "Pipeline-001", + "jobID": "Job-456", + "triggeredBy": "GitHub Actions", + "commitHash": "a1b2c3d4e5f67890" +} +``` + +- **`pipelineID` :** Tracks the pipeline in which the test ran. +- **`jobID` :** Identifies the specific CI/CD job. +- **`triggeredBy` :** Indicates the trigger source (e.g., manual, GitHub Actions, Jenkins). +- **`commitHash` :** Links the test to a specific commit in the version control system. + diff --git a/sidebars.js b/sidebars.js index 6afc9b8ba..0138cc496 100644 --- a/sidebars.js +++ b/sidebars.js @@ -2055,7 +2055,7 @@ module.exports = { type: "category", collapsed: true, label: "Other Capabilities", - items: ["auto-heal", "command-annotations", "har-log-viewer", "selenium-geolocation-capabilities", "selenium-mask-your-data"], + items: ["auto-heal", "command-annotations", "har-log-viewer", "selenium-geolocation-capabilities", "selenium-mask-your-data", "selenium-add-test-meta-data"], }, ], }, From 1fc5025eb960febbd302a540d5a55413d2153f17 Mon Sep 17 00:00:00 2001 From: amanchopra1905 Date: Thu, 23 Jan 2025 15:33:41 +0530 Subject: [PATCH 2/3] spell update --- docs/error-messages.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/error-messages.md b/docs/error-messages.md index 6355bf4dc..1653287ce 100644 --- a/docs/error-messages.md +++ b/docs/error-messages.md @@ -331,7 +331,7 @@ Argument was an invalid selector. ### Possible Solutions: -* Do check the punctuations such as @, ', and []. +* Do check the punctuation's such as @, ', and []. * Make sure that there is only one field name with that path; else, use the contains() method @@ -434,7 +434,7 @@ Argument was an invalid selector. ### Possible Solutions: -* Do check the punctuations such as @, ', and []. +* Do check the punctuation's such as @, ', and []. * Make sure that there is only one field name with that path; else, use the contains() method From 306d943d107249b9b63cc90195f37c5cc2940205 Mon Sep 17 00:00:00 2001 From: amanchopra1905 Date: Thu, 23 Jan 2025 20:13:17 +0530 Subject: [PATCH 3/3] customData capability doc --- docs/selenium-add-test-meta-data.md | 114 +++++++++++++++++++++++++--- 1 file changed, 104 insertions(+), 10 deletions(-) diff --git a/docs/selenium-add-test-meta-data.md b/docs/selenium-add-test-meta-data.md index 59f963a07..178390e7a 100644 --- a/docs/selenium-add-test-meta-data.md +++ b/docs/selenium-add-test-meta-data.md @@ -17,6 +17,9 @@ site_name: LambdaTest slug: selenium-add-test-meta-data/ --- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; +