{"id":22362951,"url":"https://github.com/lambdatest/unittest-tunnel","last_synced_at":"2026-04-27T08:31:34.836Z","repository":{"id":97545506,"uuid":"502158947","full_name":"LambdaTest/UnitTest-tunnel","owner":"LambdaTest","description":"How to start tunnel for automation test in UnitTest on LambdaTest","archived":false,"fork":false,"pushed_at":"2022-06-10T20:06:17.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-06-01T05:11:05.788Z","etag":null,"topics":["lambdatest","selenium","testing","unittest"],"latest_commit_sha":null,"homepage":"","language":"Python","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/LambdaTest.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,"zenodo":null}},"created_at":"2022-06-10T19:30:17.000Z","updated_at":"2022-06-13T08:00:51.000Z","dependencies_parsed_at":"2023-03-12T16:00:13.730Z","dependency_job_id":null,"html_url":"https://github.com/LambdaTest/UnitTest-tunnel","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/LambdaTest/UnitTest-tunnel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LambdaTest%2FUnitTest-tunnel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LambdaTest%2FUnitTest-tunnel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LambdaTest%2FUnitTest-tunnel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LambdaTest%2FUnitTest-tunnel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LambdaTest","download_url":"https://codeload.github.com/LambdaTest/UnitTest-tunnel/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LambdaTest%2FUnitTest-tunnel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32329463,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["lambdatest","selenium","testing","unittest"],"created_at":"2024-12-04T17:12:40.381Z","updated_at":"2026-04-27T08:31:34.828Z","avatar_url":"https://github.com/LambdaTest.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# How to start tunnel for automation test in UnitTest on [LambdaTest](https://www.lambdatest.com/?utm_source=github\u0026utm_medium=repo\u0026utm_campaign=UnitTest-tunnel)\n\nIf you want to run your an automation test in Pytest on LambdaTest using the tunnel and want to start the tunnel automatically in the script, you can use the follwing steps. You can refer to sample test repo [here](https://github.com/LambdaTest/Python-UnitTest-Selenium).\n\n## Steps\n\n### Step 1: Download the LT tunnel binary from LT Dashboard\n\nGo to your LambdaTest dashboard and click the configure tunnel button on the top right corner and use the download link to download the binary file. \n\n### Step 2: Code to run LT tunnel before test\n\nThe tunnel should be started before test case execution and end after completion. To achieve this, tunnel can be started in the main function like so: \n\n\n```python\nimport subprocess\n\nif __name__ == \"__main__\":\n\n    #start tunnel process\n    tunnel_process = subprocess.Popen([\"./LT\",\"--user\",username,\"--key\",access_key],stdout=subprocess.DEVNULL,stderr=subprocess.STDOUT)\n    \n    #run testcases\n    unittest.main()\n\n    #end tunnel\n    tunnel_process.terminate()\n```\n### Step 3: Set tunnel capability to True\n\nAdd the `\"tunnel\": True`  capability in your test file:\n\n```python\ndesired_caps = {\n            'LT:Options': {\n                \"build\": \"Python Demo\",  # Change your build name here\n                \"name\": \"Python Demo Test\",  # Change your test name here\n                \"platformName\": \"Windows 11\",\n                \"selenium_version\": \"4.0.0\",\n                \"tunnel\": True\n            },\n            \"browserName\": \"Chrome\",\n            \"browserVersion\": \"98.0\",\n        }\n\n```\n\n### Step 4: Run your test\n\n```bash\npython lambdatest_test.py\n```\n\n\n# Links:\n\n[LambdaTest Community](http://community.lambdatest.com/)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flambdatest%2Funittest-tunnel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flambdatest%2Funittest-tunnel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flambdatest%2Funittest-tunnel/lists"}