Skip to content

Commit e060fa7

Browse files
authored
Merge pull request LambdaTest#1272 from amanchopra1905/stage
selenium customData doc
2 parents 2f50921 + 2c713ac commit e060fa7

File tree

3 files changed

+161
-3
lines changed

3 files changed

+161
-3
lines changed

docs/error-messages.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ Argument was an invalid selector.
331331

332332
### Possible Solutions:
333333

334-
* Do check the punctuations such as @, ', and [].
334+
* Do check the punctuation's such as @, ', and [].
335335
* Make sure that there is only one field name with that path; else, use the contains() method
336336

337337

@@ -434,7 +434,7 @@ Argument was an invalid selector.
434434

435435
### Possible Solutions:
436436

437-
* Do check the punctuations such as @, ', and [].
437+
* Do check the punctuation's such as @, ', and [].
438438
* Make sure that there is only one field name with that path; else, use the contains() method
439439

440440

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
---
2+
id: selenium-add-test-meta-data
3+
title: Add your test metadata using customData capability
4+
hide_title: false
5+
sidebar_label: Adding Test Metadata
6+
description: The customData capability allows users to associate additional metadata with test runs, enabling better traceability, debugging, and reporting.
7+
keywords:
8+
- lambdatest automation
9+
- selenium automation grid
10+
- metadata
11+
- custom data
12+
- traceability
13+
- debugging
14+
- reporting
15+
url: https://www.lambdatest.com/support/docs/selenium-add-test-meta-data/
16+
site_name: LambdaTest
17+
slug: selenium-add-test-meta-data/
18+
---
19+
20+
<script type="application/ld+json"
21+
dangerouslySetInnerHTML={{ __html: JSON.stringify({
22+
"@context": "https://schema.org",
23+
"@type": "BreadcrumbList",
24+
"itemListElement": [{
25+
"@type": "ListItem",
26+
"position": 1,
27+
"name": "LambdaTest",
28+
"item": "https://www.lambdatest.com"
29+
},{
30+
"@type": "ListItem",
31+
"position": 2,
32+
"name": "Other Capabilities",
33+
"item": "https://www.lambdatest.com/support/docs/"
34+
},{
35+
"@type": "ListItem",
36+
"position": 3,
37+
"name": "Custom Data",
38+
"item": "https://www.lambdatest.com/support/docs/selenium-add-test-meta-data/"
39+
}]
40+
})
41+
}}
42+
></script>
43+
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.
44+
45+
## How to add custom metadata for running automation tests on LambdaTest
46+
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:
47+
48+
```javascript title="Test.js"
49+
exports.capabilities = {
50+
// ...other capabilities
51+
"customData": [{
52+
"_id": "5f46aaa69adf77cfe2bb4fd6",
53+
"index": "0",
54+
"guid": "9451b204-12f0-4177-8fe9-fb019b3e4bf3",
55+
"isActive": "False",
56+
"picture": "https://www.placehold.it/32x32"
57+
}]
58+
};
59+
```
60+
61+
## Use Cases for `customData`
62+
63+
### 1. Enhanced Reporting with GitHub and Jira Links
64+
**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.
65+
66+
```javascript title="Test.js"
67+
'customData': {
68+
"jiraTicket": "JIRA-12345",
69+
"githubPR": "https://github.com/organization/repo/pull/678",
70+
"testDescription": "This test validates login functionality under high load."
71+
}
72+
```
73+
74+
- **`jiraTicket` :** Links the test to the corresponding Jira issue for easy navigation.
75+
- **`githubPR` :** Links to the pull request that introduced the changes being tested.
76+
- **`testDescription` :** Provides a brief description of the test's purpose.
77+
78+
### 2. Linking Test Management Systems
79+
**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.
80+
81+
```javascript title="Test.js"
82+
'customData': {
83+
"testCaseID": "TC-56789",
84+
"testSuite": "Regression Suite",
85+
"priority": "High",
86+
"owner": "[email protected]"
87+
}
88+
```
89+
90+
- **`testCaseID` :** Maps the execution to a specific test case in the test management system.
91+
- **`testSuite` :** Specifies the test suite or category the test belongs to.
92+
- **`priority` :** Indicates the importance or severity of the test.
93+
- **`owner` :** Identifies the owner or responsible party for the test.
94+
95+
### 3. Debugging with Environment Metadata
96+
**Scenario :** When debugging test failures, it’s helpful to include information about the environment or build being tested.
97+
98+
```javascript title="Test.js"
99+
'customData': {
100+
"buildNumber": "1234",
101+
"environment": "Staging",
102+
"apiVersion": "v1.2.3",
103+
"releaseTag": "v1.2.3-rc1"
104+
}
105+
```
106+
107+
- **`buildNumber` :** Identifies the specific build of the application being tested.
108+
- **`environment` :** Indicates the environment (e.g., Development, Staging, Production) the test was run in.
109+
- **`apiVersion` :** Provides the API version being tested.
110+
- **`releaseTag` :** Links the test to a specific release or tag in the version control system.
111+
112+
### 4. Capturing User Story or Feature Metadata
113+
**Scenario :** A product manager wants test results linked to specific user stories or features for tracking progress on new functionality.
114+
115+
```javascript title="Test.js"
116+
'customData': {
117+
"featureID": "FEAT-9876",
118+
"userStory": "As a user, I want to reset my password securely.",
119+
"sprint": "Sprint 45"
120+
}
121+
```
122+
123+
- **`featureID` :** Links the test to a specific feature ID in the product backlog.
124+
- **`userStory` :** Describes the user story being validated.
125+
- **`sprint` :** Indicates the sprint or iteration in which the feature is being developed.
126+
127+
### 5. Tracking Third-Party Dependencies
128+
**Scenario :** A test depends on third-party APIs or integrations, and it’s crucial to track the versions or configurations of these dependencies.
129+
130+
```javascript title="Test.js"
131+
'customData': {
132+
"thirdPartyAPI": "Stripe",
133+
"apiVersion": "2023-01-15",
134+
"status": "Active"
135+
}
136+
```
137+
138+
- **`thirdPartyAPI` :** Identifies the external service used.
139+
- **`apiVersion` :** Specifies the version of the API.
140+
- **`status` :** Indicates the status or availability of the dependency.
141+
142+
### 6. Integrating Test Runs with CI/CD Pipelines
143+
**Scenario :** A DevOps team wants to include pipeline-specific metadata in the test report to track CI/CD execution details.
144+
145+
```javascript title="Test.js"
146+
'customData': {
147+
"pipelineID": "Pipeline-001",
148+
"jobID": "Job-456",
149+
"triggeredBy": "GitHub Actions",
150+
"commitHash": "a1b2c3d4e5f67890"
151+
}
152+
```
153+
154+
- **`pipelineID` :** Tracks the pipeline in which the test ran.
155+
- **`jobID` :** Identifies the specific CI/CD job.
156+
- **`triggeredBy` :** Indicates the trigger source (e.g., manual, GitHub Actions, Jenkins).
157+
- **`commitHash` :** Links the test to a specific commit in the version control system.
158+

sidebars.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2052,7 +2052,7 @@ module.exports = {
20522052
type: "category",
20532053
collapsed: true,
20542054
label: "Other Capabilities",
2055-
items: ["auto-heal", "command-annotations", "har-log-viewer", "selenium-geolocation-capabilities", "selenium-mask-your-data"],
2055+
items: ["auto-heal", "command-annotations", "har-log-viewer", "selenium-geolocation-capabilities", "selenium-mask-your-data", "selenium-add-test-meta-data"],
20562056
},
20572057
],
20582058
},

0 commit comments

Comments
 (0)