Skip to main content
Introducing the Automate SDK! Get your entire test suite running on BrowserStack in minutes! Learn More.

Test on Internal Networks

BrowserStack enables you to run your Lettuce automated tests on your internal development environments, on localhost, and from behind a corporate firewall. This feature is called “Local Testing”.

Local Testing establishes a secure connection between your machine and the BrowserStack cloud. Once you set up Local Testing, all URLs work out of the box, including HTTPS URLs and those behind a proxy or firewall.

Configuring your Lettuce tests for Local Testing takes just four steps:

Note: Code samples in this guide can be found in the lettuce-browserstack repo in GitHub
  1. Install local bindings:

     pip install browserstack-local
    
  2. Next, update your Lettuce config file, lettuce-browserstack/config/local.json, and set the browserstack.local capability to true:
    config/local.json
     {
       "server": "hub.browserstack.com",
       "user": "YOUR_USERNAME",
       "key": "YOUR_ACCESS_KEY",
    
       "capabilities": {
         "browserstack.local": true,
         "name": "Bstack-[Lettuce] Local Test"
       },
    
       "environments": [{
         "browser": "chrome"
       }]
     }
    
  3. Run a sample test case to check whether the Local test connection has been setup properly. You can use the following sample test case, which can be found in the repo under lettuce-browserstack/features/ directory:

    local.feature
     # Local Feature
     Feature: BrowserStack Local Testing
         Scenario: can check tunnel working
             Given I go to "http://bs-local.com:45691/check"
                 Then page contains "Up and running"
    
    lettuce-browserstack/features/steps.py
     # Local Steps
     @step(u'Then page contains "([^"]*)"')
     def then_page_contains(step, regex):
         source = world.browser.page_source
         assert True, (regex in source)
    
  4. You can now run your Lettuce test using BrowserStack Local with the following command:

     # Run using paver
     paver run local
    

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback!

Talk to an Expert
Talk to an Expert