Giter Site home page Giter Site logo

browserstack-auto's Introduction

testng-browserstack

TestNG Integration with BrowserStack.

BrowserStack Logo

Using Maven

Run sample build

  • Clone the repository
  • Replace YOUR_USERNAME and YOUR_ACCESS_KEY with your BrowserStack access credentials in browserstack.yml.
  • Install dependencies mvn compile
  • To run the test suite having cross-platform with parallelization, run mvn test -P sample-test
  • To run local tests, run mvn test -P sample-local-test

Understand how many parallel sessions you need by using our Parallel Test Calculator

Integrate your test suite

This repository uses the BrowserStack SDK to run tests on BrowserStack. Follow the steps below to install the SDK in your test suite and run tests on BrowserStack:

  • Create sample browserstack.yml file with the browserstack related capabilities with your BrowserStack Username and Access Key and place it in your root folder.
  • Add maven dependency of browserstack-java-sdk in your pom.xml file
<dependency>
    <groupId>com.browserstack</groupId>
    <artifactId>browserstack-java-sdk</artifactId>
    <version>LATEST</version>
    <scope>compile</scope>
</dependency>
  • Modify your build plugin to run tests by adding argLine -javaagent:${com.browserstack:browserstack-java-sdk:jar} and maven-dependency-plugin for resolving dependencies in the profiles sample-test and sample-local-test.
            <plugin>
               <artifactId>maven-dependency-plugin</artifactId>
                 <executions>
                   <execution>
                     <id>getClasspathFilenames</id>
                       <goals>
                         <goal>properties</goal>
                       </goals>
                   </execution>
                 </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M5</version>
                <configuration>
                    <suiteXmlFiles>
                        <suiteXmlFile>config/sample-local-test.testng.xml</suiteXmlFile>
                    </suiteXmlFiles>
                    <argLine>
                        -javaagent:${com.browserstack:browserstack-java-sdk:jar}
                    </argLine>
                </configuration>
            </plugin>
  • Install dependencies mvn compile

Using Gradle

Prerequisites

  • If using Gradle, Java v9+ is required.

Run sample build

  • Clone the repository
  • Install dependencies gradle build
  • To run the test suite having cross-platform with parallelization, run gradle sampleTest
  • To run local tests, run gradle sampleLocalTest

Understand how many parallel sessions you need by using our Parallel Test Calculator

Integrate your test suite

This repository uses the BrowserStack SDK to run tests on BrowserStack. Follow the steps below to install the SDK in your test suite and run tests on BrowserStack:

  • Following are the changes required in gradle.build -

    • Add compileOnly 'com.browserstack:browserstack-java-sdk:latest.release' in dependencies
    • Fetch Artifact Information and add jvmArgs property in tasks SampleTest and SampleLocalTest :
    def browserstackSDKArtifact = configurations.compileClasspath.resolvedConfiguration.resolvedArtifacts.find { it.name == 'browserstack-java-sdk' }
    
    task sampleTest(type: Test) {
      useTestNG() {
        dependsOn cleanTest
        useDefaultListeners = true
        suites "config/sample-test.testng.xml"
        jvmArgs "-javaagent:${browserstackSDKArtifact.file}"
      }
    }
    
  • Install dependencies gradle build

Notes

browserstack-auto's People

Contributors

agarneha1331 avatar alliv8 avatar amaanbs avatar ankit098 avatar bstack-security-github avatar francisf avatar kamal-kaur04 avatar karanshah-browserstack avatar mattonem avatar mukulgupta1 avatar nidhimj22 avatar nidhisha-shetty avatar rhlbhatnagar avatar rohanimmanuel avatar rutvikchandla avatar shwetashetye avatar sinstein avatar sourav-kundu avatar swapnilagarwwal avatar syuq avatar tayal1996 avatar tr4n2uil avatar varun-garg avatar vedharish avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.