The Sauce Labs Cookbook

Sauce Headless

Front End Performance Testing

Analytics

External Resources

More Info


Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Go to the Platform Configurator.
  2. Under API, select Selenium.

    Tip
    titleSelecting Desired Capabilities for Mobile Native Browser Tests

    To run a test against a mobile native browser, select Appium, select the mobile device you want to test with, and then select Web Testing.

  3. Select the operating system and browser you want to test against
  4. Under Copy Code, select the language you are using
    The Platform Configurator will generate the code snippet for the desired capabilities
  5. Click Copy.
  6. Paste the code into your Selenium test script, or into one of the example test scripts, and then run the test to see how the web app performs on that platform/OS/browser combination. If you use one of the example test In our example scripts, our demo test will open the selected browser, load the Sauce Labs sample web app, and then close the browser. 
Tabs Container
directionhorizontal
Tabs Page
titleJava Example
Expand
titleClick here to view the Java example

View Git file
pathon-boarding-modules/junit/src/test/java/Module3JunitTest.java
repository-id33
languagejava
branchrefs/remotes/origin/master

Tabs Page
titleC# Example
Expand
titleClick here to view the C# example

View Git file
pathSauceExamples/Web.Tests/OnboardingTests/InstantSauceTest3.cs
repository-id34
languagec#
branchrefs/remotes/origin/master

Tabs Page
titlePython Example
Expand
titleClick here to view the Python example

View Git file
pathon-boarding-modules/pytest-examples/test_module3_pytest.py
repository-id36
languagepy
branchrefs/remotes/origin/master

Tabs Page
titleRuby Example
Expand
titleClick here to view the Ruby example

View Git file
pathspec/spec_helper.rb
lastline83
repository-id48
languageruby
firstline15
branchrefs/remotes/origin/master

Tabs Page
titleJavaScript Example
Expand
titleClick here to view the JavaScript example

View Git file
pathon-boarding-modules/mocha-examples/test/module3-mocha-test.js
repository-id38
languagejs
branchrefs/remotes/origin/master

Set the Web App to Test

The final step to get your Selenium test running on Sauce is setting Finally, you'll need to set the URL of the web app you want to test with driver.get. The example tests scripts are all set to run against the Sauce Labs demo app, so you can paste the URL for your web app in place of the saucedemo URL to ensure that the Sauce Labs browser cloud can connect to your app. Use Sauce Connect Proxy can launch a secure tunnel to establish connections for apps to establish a connection to an app hosted on your local machine or behind a firewall.

...

Now that you've been able to get a test running on Sauce, there are a few other modifications you can make to your scripts to report Pass/Fail results to your dashboard and incorporate other best practices. You can find more information under Best Practices for Running Tests and Setting Test Status to Pass or Fail. tests. These example scripts show how to:

  • Implement timeouts to control text execution times
  • Add annotations
  • Setidentifying information for your tests
  • Send Pass/Fail results to the Sauce Labs dashboard

You can find more information under Best Practices for Running Tests and Setting Test Status to Pass or Fail.

Tabs Container
directionhorizontal
Tabs Page
titleJava Example
Expand
titleClick here to view the Java example

View Git file
pathon-boarding-modules/junit/src/test/java/Module4JunitTest.java
repository-id33
languagejava
branchrefs/remotes/origin/master

Tabs Page
titleC# Example
Expand
titleClick here to view the C# example

View Git file
pathSauceExamples/Web.Tests/OnboardingTests/InstantSauceTest4.cs
repository-id34
languagec#
branchrefs/remotes/origin/master

Tabs Page
titlePython Example
Expand
titleClick here to view the Python example

View Git file
pathon-boarding-modules/pytest-examples/test_module4_pytest.py
repository-id36
languagepy
branchrefs/remotes/origin/master

Tabs Page
titleRuby Example
Expand
titleClick here to view the Ruby example

View Git file
pathspec/instant_sauce_test4_spec.rb
repository-id37
languageruby
branchrefs/remotes/origin/master

Tabs Page
titleJavaScript Example
Expand
titleClick here to view the JavaScript example

View Git file
pathon-boarding-modules/mocha-examples/test/module4-mocha-test.js
repository-id38
languagejs
branchrefs/remotes/origin/master

Video Demo

Widget Connector
urlhttps://www.youtube.com/watch?v=Pqu4tY5XbIs&feature=youtu.be