{"id":18995335,"url":"https://github.com/testpointcorp/testcomplete-vansah","last_synced_at":"2025-10-11T02:35:11.637Z","repository":{"id":233640059,"uuid":"785160773","full_name":"testpointcorp/testcomplete-vansah","owner":"testpointcorp","description":"This tutorial guides you through the process of integrating TestComplete with Vansah Test Management for Jira to automatically send test case results.","archived":false,"fork":false,"pushed_at":"2024-04-17T14:18:54.000Z","size":73688,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"prod","last_synced_at":"2025-01-01T16:22:27.891Z","etag":null,"topics":["automation","automation-framework","testcomplete"],"latest_commit_sha":null,"homepage":"https://vansah.com/connect-integrations/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/testpointcorp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-11T10:16:19.000Z","updated_at":"2024-04-16T20:22:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"86cca8f4-741f-42b8-9e68-b3f7cd71065c","html_url":"https://github.com/testpointcorp/testcomplete-vansah","commit_stats":null,"previous_names":["testpointcorp/testcomplete-vansah"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/testpointcorp%2Ftestcomplete-vansah","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/testpointcorp%2Ftestcomplete-vansah/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/testpointcorp%2Ftestcomplete-vansah/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/testpointcorp%2Ftestcomplete-vansah/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/testpointcorp","download_url":"https://codeload.github.com/testpointcorp/testcomplete-vansah/tar.gz/refs/heads/prod","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240010366,"owners_count":19733514,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","automation-framework","testcomplete"],"created_at":"2024-11-08T17:30:01.660Z","updated_at":"2025-10-11T02:35:06.587Z","avatar_url":"https://github.com/testpointcorp.png","language":"JavaScript","readme":"# TestComplete Integration with Vansah Test Management For Jira\n\nThis tutorial guides you through the process of integrating TestComplete tests with Vansah Test Management For Jira. Integrating TestComplete with Vansah will allow you to send Test Case results from TestComplete to your Jira workspace.\n\nBy following this setup, you can streamline your testing workflow, ensuring that test outcomes are recorded directly in your Jira workspace.\n\n## Prerequisites\n- TestComplete - [Keyword Tests](https://support.smartbear.com/testcomplete/docs/keyword-testing/index.html) project is already setup.\n- Make sure that [`Vansah`](https://marketplace.atlassian.com/apps/1224250/vansah-test-management-for-jira?tab=overview\u0026hosting=cloud) is installed in your Jira workspace\n- You need to Generate **Vansah** [`connect`](https://docs.vansah.com/docs-base/generate-a-vansah-api-token-from-jira-cloud/) token to authenticate with Vansah APIs.\n## Configuration\n**Setting Environment Variables** - Store your Vansah API token as an environment variable for security. \n\nFor Windows (use cmd)\n```cmd\nsetx VANSAH_TOKEN \"your_vansah_api_token_here\"\n\n```\nFor macOS\n```bash\necho export VANSAH_TOKEN=\"your_vansah_api_token_here\" \u003e\u003e ~/.bash_profile\n\nsource ~/.bash_profile\n\n```\nFor Linux (Ubuntu, Debian, etc.)\n```bash\necho export VANSAH_TOKEN=\"your_vansah_api_token_here\" \u003e\u003e ~/.bashrc\n\nsource ~/.bashrc\n\n``` \n## Implementation\nTo enable Vansah integration in TestComplete project, follow these steps:\n\n### Create Variables at Project Level Scope \n - Add `testCaseKey` and `assetKey` under Temporary Variables of the Project. (Variable Names are case-sensitive)\n - Add `Vansah_URL`, `SprintName`, `ReleaseName` and `EnvironmentName` under Persistent Variables of the Project. (Variable Names are case-sensitive) \n    ![VansahVariablesinDefault](/Asset/project_variables.jpg)\n\n### Add Event Contoller in the Project\n - Add `OnLogError` from General Events Section and add Event Handler function to your Javascript file.\n - Add `OnStopTestCase` from Test Engine Events and add Event Handler funtion to your Javascript file.\n    ![EventControl](/Asset/event_control.png)\n\n\n### Add below Javascript to your Script \n - **(Option 1)** Copy the Below Code and Paste it in your script.js file\n```js\n  var path = '/api/v1/run';\n  var endpoint = Project.Variables.GetVariableDefaultValue('Vansah_URL')+path;\n  var result = \"passed\";\n\n  function EventControl_OnStopTestCase(Sender, StopTestCaseParams)\n  { \n    var testCaseKey = Project.Variables.testCaseKey; \n    var assetKey = Project.Variables.assetKey;\n  \n      // Set Test Run Properties (Optional)\n    var sprintName = Project.Variables.GetVariableDefaultValue('SprintName');\n    var releaseName = Project.Variables.GetVariableDefaultValue('ReleaseName');\n    var environmentName = Project.Variables.GetVariableDefaultValue('EnvironmentName');\n\n    // Construct properties object\n    var properties = '';\n    if (sprintName) {\n      properties += `\"sprint\": {\"name\": \"${sprintName}\"}, `;\n    }\n    if (releaseName) {\n      properties += `\"release\": {\"name\": \"${releaseName}\"}, `;\n    }\n    if (environmentName) {\n      properties += `\"environment\": {\"name\": \"${environmentName}\"}, `;\n    }\n\n    // Remove trailing comma if properties are present\n    if (properties !== '') {\n      properties = properties.slice(0, -2); // Remove last comma and space\n      properties = `\"properties\": {${properties}}, `;\n    }\n\n    // Determine asset (Test Folder or Jira Issue) based on its type\n    var assetType;\n    var assetIdentifier;\n    if (assetKey.split('-').length \u003e 2) {\n      assetType = 'folder';\n      assetIdentifier = assetKey; // Use assetKey as the identifier for folders\n    } else {\n      assetType = 'issue';\n      assetIdentifier = assetKey; // Use assetKey as the key for issues\n    }\n\n    // Construct asset object based on type\n    var asset;\n    if (assetType === 'folder') {\n      asset = `\"asset\": { \"type\": \"${assetType}\", \"identifier\": \"${assetIdentifier}\" },`;\n    } else {\n      asset = `\"asset\": { \"type\": \"${assetType}\", \"key\": \"${assetIdentifier}\" },`;\n    }\n\n    // Request body\n    var requestBody = `{\"case\": {\"key\": \"${testCaseKey}\"}, ${asset} ${properties}\"result\": {\"name\": \"${result}\"}}`;\n\n    // send HTTP request\n    var httpRequest = aqHttp.CreateRequest(\"POST\", endpoint);\n    httpRequest.SetHeader(\"Content-Type\", \"application/json\");\n    httpRequest.SetHeader(\"Authorization\", aqEnvironment.GetEnvironmentVariable(\"VANSAH_TOKEN\"));\n  \n    var httpResponse = httpRequest.Send(requestBody);\n    Log.Message(httpResponse.Text);\n  \n    //set the result to default value for the next Test Case\n    result= \"passed\";\n  }\n\n  function EventControl_OnLogError(Sender, LogParams)\n  {\n    result = \"failed\"; \n  }\n```\n - **(Option 2)** Copy and Paste [this](/SampleProjectwithVansah/Script/VansahTests.js) file to your Script folder and Locate your Event Handler to this file.\n    ![script.js](/Asset/script.png)\n\n### Add `TestCaseKey` and `AssetKey` Variables to your Keyword Tests\n\nTo facilitate the integration of test results with Vansah, it's necessary to include `TestCaseKey` and `AssetKey` variables in your keyword tests. These variables will store the relevant details from Vansah, ensuring seamless transmission of test results upon test completion.\n\n1. **Add Variables with Vansah Details:**\n   - Add `TestCaseKey` and `AssetKey` variables to each of your Keyword Tests.\n   - Populate these variables with the relevant details obtained from Vansah.\n   ![TestsVariables](/Asset/add_case_asset_details.png)\n\n2. **Set Variable Values During Runtime:**\n   - At the beginning of each keyword test, include a step to set `TestCaseKey` and `AssetKey` variables.\n   - Map these variables to the Project Level `testCaseKey` and `assetKey`. ![setTestsVariables](/Asset/set_variables.png)\n\nBy incorporating `TestCaseKey` and `AssetKey` variables into your keyword tests and setting their values dynamically during runtime, you ensure the successful execution of API requests to Vansah, facilitating efficient transmission of test results.\n\n## Conclusion\n\nBy following the above steps, your TestComplete project will be equipped to send test run results directly to Vansah, streamlining your testing and reporting process. \n\nEnsure that all files are placed and configured as described to facilitate successful integration.\n\nFor more details on TestComplete, visit the [Keyword Tests](https://support.smartbear.com/testcomplete/docs/keyword-testing/index.html). \n\nFor Vansah specific configurations and API details, please refer to the [Vansah API documentation](https://apidoc.vansah.com/).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftestpointcorp%2Ftestcomplete-vansah","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftestpointcorp%2Ftestcomplete-vansah","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftestpointcorp%2Ftestcomplete-vansah/lists"}