Code Monkey home page Code Monkey logo

cucumber-java-browserstack's Introduction

Cucumber Java Browserstack

Cucumber-TestNG Cucumber-JUnit4 Cucumber-JUnit5

BrowserStack Logo

Cucumber JVM Integration with BrowserStack.

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
  • To view Allure Reports, run allure serve target/allure-results

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

Integrate your test suite

  • Install dependencies mvn compile
  • 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>src/test/resources/testng.xml</suiteXmlFile>
                    </suiteXmlFiles>
                    <argLine>
                        -javaagent:${com.browserstack:browserstack-java-sdk:jar}
                    </argLine>
                </configuration>
            </plugin>

Migrate from Vanilla Cucumber to use Testng Runner

  • If you are using Vanilla Cucumber CLI, you can migrate to use TestNG Runner with BrowserStack using the below command :
mvn archetype:generate -DarchetypeGroupId=com.browserstack -DarchetypeArtifactId=cucumber-testng-archetype -DarchetypeVersion=1.0 -DgroupId=com.browserstack -DartifactId=cucumber-testng-archetype -Dversion=1.0 -DinteractiveMode=false

Using Gradle

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

  • Install dependencies gradle build
  • 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}"
      }
    }
    

Notes

cucumber-java-browserstack's People

Contributors

agarneha1331 avatar bopes avatar bstack-security-github avatar francisf avatar kamal-kaur04 avatar karanshah-browserstack avatar pulkitsharma07 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cucumber-java-browserstack's Issues

Remote Webdriver takes too long to launch

I am trying to run a simple test that opens google and does a search (One of the standard browser stack examples). But creating RemoteWebdriver session takes too long (around 8-13 seconds) which is not acceptable. Is this the expected behavior ? If not how can i reduce the execution time as i will be having tons of cucumber tests ?

Session ID: a08bf93911760469a1b1c062a35be0b6a2035353

screenshot from 2018-11-19 15-18-34
Network logs.docx
Selenium logs.docx

Launching Remote Webdriver takes too long

I am trying to run a simple test that opens google and does a search (One of the standard browser stack examples). But creating RemoteWebdriver session takes too long (around 8-13 seconds) which is not acceptable. Is this the expected behavior ? If not how can i reduce the execution time as i will be having tons of cucumber tests ?
screenshot from 2018-11-19 15-12-19

Network logs.docx
Selenium logs.docx

Please clarify the use of the property 'local'

Hi,

I'm using this on IntelliJ to see what the code is doing. I cannot see in the current setup at which point the 'if (System.getProperty("local") ...' statement in SearchSteps is being used - it is not used by the local test feature. If I run the tests with mvn install -Dlocal=true they fail. What is the purpose of this code block?

Secondary question: is there a way to set the browser in IntelliJ, or is this only possible through command line?

Please clarify how to execute in parallel

Hi can you please tell me how to execute the tests in parallel using this framework.
"To run parallel tests, run make run_all_in_parallel" where to make this change ?

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.