Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
794 views
by The go-to Tester (324 points)
retagged by
It is working fine with simple modal but showing configuration issue with POM.

It is showing issue because of testNG.

Base class is executing but drived class is not executing.

I have add JSON dependency in project and also the testng code which is provided by browser stack.
by The go-to Tester (181 points)
can you post your pom.xml file? Also, post your testng.xml file.
by The go-to Tester (324 points)
edited by
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <artifactId>Food_niche_projest</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.3</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>
  <dependency>
    <groupId>com.googlecode.json-simple</groupId>
    <artifactId>json-simple</artifactId>
    <version>1.1</version>
</dependency>
      <dependency>
          <groupId>org.apache.poi</groupId>
          <artifactId>poi</artifactId>
          <version>3.10-FINAL</version>
      </dependency>
      <dependency>
    <groupId>com.browserstack</groupId>
    <artifactId>browserstack-local-java</artifactId>
    <version>0.1.0</version>
</dependency>
      <dependency>
          <groupId>org.testng</groupId>
          <artifactId>testng</artifactId>
          <version>6.9.10</version>
          <scope>test</scope>
      </dependency>
      <dependency>
          <groupId>org.seleniumhq.selenium</groupId>
          <artifactId>selenium-java</artifactId>
          <version>2.53.1</version>
      </dependency>
      <dependency>
          <groupId>org.apache.poi</groupId>
          <artifactId>poi-ooxml</artifactId>
          <version>3.9</version>
      </dependency>
  </dependencies>
  <properties>
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <name>project_name</name>
  <url>http://maven.apache.org</url>
  <groupId>project</groupId>
</project>
by The go-to Tester (324 points)
edited by
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite">
  <test name="Test">
  
   <parameter name="config" value="single.conf.json.json"/>
   <parameter name="environment" value="chrome"/>
   
    <classes>
      <class name="project_name.SingleTest"/>
    </classes>
  </test> <!-- Test -->
</suite> <!-- Suite -->
by The go-to Tester (181 points)
Is SingleTest your base class? What's your derived class name?
by The go-to Tester (324 points)
edited by
base class name is 'browser_stack_login' and drived class name is 'SingleTest'
by The go-to Tester (181 points)
Post your class files as well. Also, tell us how you're initiating your execution.

1 Answer

0 like 0 dislike
by The go-to Tester (181 points)
selected by
 
Best answer
It looks like you are invoking BaseClass into your testng.xml file. You need to use derived class name into your testng.xml file.

Hope that answers your question.
by The go-to Tester (324 points)
edited by
'SingleTest' is my drived class.
This is working fine with eclipse but not with browserstack.
by The go-to Tester (181 points)
Can you post your singletest.java file?
by The go-to Tester (324 points)
package foodniche_project;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.Assert;
import org.testng.annotations.Test;

import Reusable.BrowserStackTestNGTest;

public class SingleTest extends BrowserStackTestNGTest {

    @Test
    public void test() throws Exception {
        driver.get("https://www.google.com/ncr");
        WebElement element = driver.findElement(By.name("q"));
        element.sendKeys("BrowserStack");
        element.submit();
        Thread.sleep(5000);

        Assert.assertEquals("BrowserStack - Google Search", driver.getTitle());
    }
}
by The go-to Tester (324 points)
This problem is solved. I have combined both base and drived classes.
Now it's working.
by The go-to Tester (181 points)
Thank you for posting your solution here.


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

...