https://github.com/testomatio/migrate-xray
XRay ➡ Testomat.io migration script
https://github.com/testomatio/migrate-xray
Last synced: 8 months ago
JSON representation
XRay ➡ Testomat.io migration script
- Host: GitHub
- URL: https://github.com/testomatio/migrate-xray
- Owner: testomatio
- Created: 2024-08-15T22:13:48.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-06-25T21:38:32.000Z (12 months ago)
- Last Synced: 2025-06-25T22:34:14.297Z (12 months ago)
- Language: JavaScript
- Homepage:
- Size: 549 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# XRay ➡ Testomat.io Migration Script
This script migrates test cases from XRay to [Testomat.io](https://testomat.io) via API.
You are free to customize this script if the default behavior doesn't fit your needs.
## Set Up Locally
* Ensure **NodeJS 20+** is installed
* Clone this repository
* Copy `.env.example` to `.env`
```
cp .env.example .env
```
* Obtain [Jira API token](https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/) from Jira
* Fill in Jira credentials into `.env` file
You should specify this variables in `.env` file:
```
JIRA_USERNAME=
JIRA_TOKEN=
JIRA_PROJECT_ID=
```
* Obtain XRay token from XRay app
> [!IMPORTANT]
> Due to unavaibility of XRay API, you need to obtain token manually.
Open XRay app, open DevTools (F12), go to Network tab, and find XRay requests by filtering Network Requests by URL:
```
url:xray.cloud.getxray.app
```
Find any request to XRay API, and in `Headers` tab find `X-Acpt` header. This is your token.
Copy it to `.env` file as `XRAY_INTERNAL_TOKEN` value
Also you will need XRAY URL to send request to. It can from be taken from `Origin`
The value would probably be one of those:
* `https://eu.xray.cloud.getxray.app`
* `https://us.xray.cloud.getxray.app`
Set it into `.env` as `XRAY_URL`

The XRAY config in `.env` file should specify these variables:
```
XRAY_URL=
XRAY_INTERNAL_TOKEN=
```
> [!TIP]
> It is possible to import a single folder from XRay. Open a XRay folder in a Test Repository and copy current URL, find `selectedFolder=` param with a folder ID as value. Copy this value from URL and set as `XRAY_FOLDER_ID` in `.env` file.
* Fill in Testomat.io credentials into `.env` file
* Create [General Token](https://app.testomat.io/account/access_tokens) in Testomat.io
* Fill in Testomat.io credentials into `.env` file
```
TESTOMATIO_TOKEN=testomat_****
TESTOMATIO_PROJECT=**
```
> `TESTOMATIO_PROJECT` is a project URL part, e.g. for `https://app.testomat.io/projects/your-project` it is `your-project`
* Install dependencies
```
npm i
```
* Run script
```
npm start
```
## Troubleshooting
#### Authentication request has expired. Try reloading the page
If you see error like this:
```
Error fetching data: Error: Failed to fetch data: /test-repository: 401 Unauthorized
{"error":"Authentication request has expired. Try reloading the page."}
```
Try to open XRay app and fetch a new token and run script again.
## Known Limitations
* **Test Params are not obtained** from a test case, as they are not availble in XRay API
* If test calls steps from another test, this test should be imported first, otherwise you will get `[steps from a missing XRay test]` in a test description
## Debugging
To enable more verbose output you can add debug flags via `DEBUG=` environment variable:
* `DEBUG="testomatio:xray:in"` - print all data coming from XRay
* `DEBUG="testomatio:xray:out"` - print all data posting to Testomat.io
* `DEBUG="testomatio:xray:migrate"` - print all data processing
* `DEBUG="testomatio:xray:*"` - print all debug information
```
DEBUG="testomatio:xray:*" npm start
```
## Customization
We keep this repository public, so you could customize the data you import.
Update `migrate.js` script to customize how sections, suites, and cases are obtained. You can customize the way how steps are transformed or test descriptions.
Update the following file and run the script.
## License
MIT