Skip to content

browserstack/serenity-browserstack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

serenity-browserstack

Serenity Integration with BrowserStack SDK.

BrowserStack Logo

Run Sample build

Setup

  • Clone the repo
  • Replace YOUR_USERNAME and YOUR_ACCESS_KEY with your BrowserStack access credentials in browserstack.yml.
  • Install dependencies mvn install
  • You can setup environment variables for all sample repos (see Notes) or update serenity.conf file with your BrowserStack Username and Access Key

Running your tests

  • To run a sample test, run mvn verify -P sample-test
  • To run local tests, run mvn verify -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>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>${maven.failsafe-plugin.version}</version>
                <configuration>
                    <includes>
                        <include>your_test_filename.java</include>
                    </includes>
                    <reuseForks>true</reuseForks>
                    <argLine>
                        -javaagent:${com.browserstack:browserstack-java-sdk:jar}
                    </argLine>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
  • Install dependencies mvn compile

Notes

  • You can view your test results on the BrowserStack Automate dashboard

  • You can export the environment variables for the Username and Access Key of your BrowserStack account

    export BROWSERSTACK_USERNAME=<browserstack-username> &&
    export BROWSERSTACK_ACCESS_KEY=<browserstack-access-key>
    

About

Selenium examples for Serenity and BrowserStack Automate

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published