Questions tagged [testng]

TestNG is a testing framework, inspired by the JUnit/NUnit unit testing frameworks. TestNG is intended to support more than just unit testing, allowing functional, end-to-end, integration, etc.

Filter by
Sorted by
Tagged with
0
votes
1answer
24 views

run tests in a sequence given a dataProvider object

I'm implementing selenium tests. In the scenario, there are same tests in different pages. So I tried to use 'DataProvider'. It works, but I think there could be a better way. I need to run 'mostView'...
-1
votes
1answer
40 views

What should be Assert for below code, tried for assertTrue,assertFalse,assertNull and assertNotNull

I have written below code to verify web table data headers and value of rows and columns but when I am adding different assertion for it, its not working and throwing compilation error. Can any one ...
0
votes
1answer
26 views

Compilation error when iterating through While loop, compilation error at line no. 10, start of While loop

I am getting compilation error when trying to store list size value into an int. public class HandleWebTable { private static WebDriver driver; public HandleWebTable(){ super(); } public ...
-1
votes
1answer
32 views

How to assert links count on web page through selenium webdriver

I have written below code in a separate class to count links on a particular webpage, How to assert this in a test case class: public static void navigateToLinkInHomePage() throws Exception { ...
1
vote
1answer
44 views

Is there a way to disable the logs created by the pagefactory

Could someone please let me know if there is any way we can disable the logs generated by the page factory for Chrome and Firefox I did try the below options for chrome and firefox and I had also ...
0
votes
1answer
36 views

Unable to install the TestNG plugin in eclipse

Getting below error while installing TestNG: Can someone help me on this?
0
votes
1answer
37 views

How to handle multiple tests in same webdriver instance without closing and opening browser again?

Below is my testscript, have called other class methods to it. I would like to divide the testcases to different tests. Now running all in one that would increase my count again more. @Listeners(...
0
votes
1answer
48 views

How to write meaningful test case title in TestNG+Selenium

When writing manual test cases, the test case title used to be something like TC1: Verify that the user is able to login to facebook and react using heart. When trying to automate the scenario ...
0
votes
6answers
102 views

Is using “Selenium & Test NG” the best approach to Automate Regression Test Cases for Web based Application? [closed]

We have a requirement to automate Test Cases for a Web based application. We have to use only open source tools. Total Test Cases would be around 600-700.
0
votes
1answer
34 views

Null PointerException on TESTNG ,pagefactory

LoginPage.Java package TestCases; import org.openqa.selenium.WebDriver; import org.openqa.selenium.support.PageFactory; import org.testng.annotations.Test; import ObjectRepository....
0
votes
2answers
51 views

Test cases stop execution for next test cases after using soft assertion

I have used soft assertion in my test cases, but it stops the execution of all the next test cases. what I know if we are adding soft assertion then particular test case should fail and it should jump ...
0
votes
0answers
23 views

Using maven to create a standalone jar file that executes in any OS

I am trying to create a standalone selenium-TestNG tests Jar file that can be executed in any OS as part of CI/CD. My POM.xml is as follows: <project xmlns="http://maven.apache.org/POM/4.0.0" ...
0
votes
2answers
65 views

assertequals() returns true but make my test case failed

I have added assertion(Assert.assertEquals(condition,"expected","message")), it returns true then also it gives an error and make my testcase failed, with Assertion error and message? Can any one help ...
1
vote
1answer
48 views

Can I create an executable TestNG Selenium jar with my tests using maven

##### My POM file pom.xml http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 company.myproj myproj 0.0.1 jar <properties> <project.build.sourceEncoding>UTF-8</project....
0
votes
2answers
44 views

I have added Assertion in my tc and make the login tc failed but I am not getting any output on console provided in assertion

I have added Assertion(Assert.asserttrue(true,"login failed")) in my every tc and conditions are according to that but when login tc failed I am not getting any output on console provided in ...
0
votes
1answer
44 views

Unable to execute single tc, login then run other application features, right now its running as a suite

I have to execute my test cases as a single as well as a suite, right now its running as a suite but not as a single test case in selenium webdriver: Below is my test which are calling methods present ...
-1
votes
2answers
33 views

Should you test regression tests or just verify/check?

When conducting regression tests, the goal is to find out if the new release affects existing functionalities of the application. Is it enough just to check/verify the application or should one test ...
0
votes
1answer
23 views

TestNG with multiple datadriven

My code structure logic is this: I have to fill three sequential forms to add a entry in a list whose data is from Excel. I need each form to have entries from different Excel sheet, i.e first form's ...
0
votes
0answers
21 views

Extent Report : [TestNG] Reporter x.x.ExtentReportListener.ExtentReport@afc191 failed java.lang.NullPointerException

Getting nullPointer exception in extent report . Help me on this issue unable to trace the root cause Using extent report 2.41.0 Here is the my log: [TestNG] Reporter com.psiexams.base....
0
votes
1answer
71 views

Selenium WebDriver “Cannot instantiate class ” error is coming

Below is my Base Class: package com.mercury.qa.base; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Properties; import java.util....
0
votes
2answers
43 views

How can we run only selected testcases from extent.html report in selenium webdriver?

I'am running testng suite and then extent.html report is being generated. Now I want to customize my report like; i should be able to select only failed testcases in my report and then should be able ...
0
votes
2answers
24 views

How to use assertion to compare both different size of the rows?

I want both size of the rows shouldn't be matched. int firstnum = 0; List<WebElement> preRoutlList = driver.findElements(By.xpath("//*[@id='txBottomTable']/table/tbody/tr")); ...
2
votes
1answer
45 views

Unable to pass dynamic xpath in repository file?

My code is : for (int z = 0; z < rows.size(); z++) { rows.get(z).findElement(By.xpath("//*[@class='ng-scope'][" + (z + 1) + "]//*[@placeholder='Stop Name']")).sendKeys(shuttleObj.getStopArea()); ...
0
votes
2answers
59 views

Getting nullpointer exception for 2nd test case working fine for login

Driver set to null for 2nd test case, working fine for login. Driver class: public class Driver { private static WebDriver driver;; /** * * @return * @throws Exception */ public static ...
1
vote
2answers
49 views

Chrome Driver - testNG parallel issue

I am trying to run selenium test classes parallel using testNG like this thread-count="3" parallel="classes" . But the issue is at closing the chrome driver and everything else works fine. while ...
0
votes
1answer
49 views

Unable to find the correct xpath for input field?

Unable to locate the element. <div class="col-md-4"> <label class="radio-inline"> <input type="radio" name="routing_option" data-ng-model="generateRoutes" data-ng-value="'...
0
votes
1answer
49 views

Getting 'java.lang.NullPointerException' on executing test Cases

import org.openqa.selenium.WebDriver; import org.testng.Assert; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations....
-2
votes
1answer
66 views

How to assert that particular element is not displayed? [duplicate]

Can someone help me fixing NoSuchElementException. Let me explain what I am trying to do. I am trying to login into an application with multiple sets of data. Lets say, 1) Valid username and ...
0
votes
1answer
38 views

Getting error message on webpage but test cases get passed -using testng with selenium

Driver class: package com.deere.gmsr; import java.util.Properties; import java.util.concurrent.TimeUnit; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; ...
-1
votes
1answer
46 views

Getting “java.lang.NullPointerException” exception when i try to run my POM test [duplicate]

I have 2 classes in my project First class contains all the webelements Second one for method where i am using this elements package facebook; import org.openqa.selenium.By; import org.openqa....
-1
votes
2answers
45 views

What is the best implementation strategy of Driver creation in Selenium Webdriver with Java?

As in my framework, I am creating the driver object by collecting the info from the test suite itself. We are passing the driver name through the testng suite and at runtime, we are collecting the ...
0
votes
1answer
67 views

Is there any possibility to open a new tab in existing window in selenium? [duplicate]

I have tried to open new tab in existing browser but it opens in new browser.
0
votes
0answers
243 views

Cucumber and TestNG, how to pass parameter?

Could you please tell, how to pass parameter in Cucumber using TestNG? I have following code, but it does not work. Error in stepDefinition.java on the line @Parameters({"environment"}) testng.xml &...
-1
votes
2answers
49 views

How locate dynamic text field element inside dialog box?

I tried to using absolute xpath to locate the dynamic text field element after search but it fails. <div class="pzbtn-rgt" data-click="..."> <div class="pzbtn-mid" data-click="...."> <...
-1
votes
3answers
85 views

Getting Null pointer expections “ java.lang.NullPointerException ”

[RemoteTestNG] detected TestNG version 6.14.3 1553664942228 mozrunner::runner INFO Running command: "C:\Program Files\Mozilla Firefox\firefox.exe" "-marionette" "-foreground" "-no-remote" "-...
1
vote
0answers
77 views

How to launch 10 browser instances using Selenium Grid in the same machine

I'm trying to launch 10 browser instances (IE) in a virtual machine and execute same script 10 times parallelly on those browsers. I updated the IE node to have maxInstances=10" -maxSession 10 and ...
0
votes
2answers
89 views

Using TestNG framework : How to call other class of the methods

Using TestNG framework : How to call other class of the methods I have created one class for login and another class for add customer details. My scenario is: Once user login after add customer ...
0
votes
1answer
28 views

the Gecko path is not working

package firsttestngpackage; import org.openqa.selenium.*; import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.Assert; import org.testng.annotations.*; public class FirstTextNGFile { ...
1
vote
2answers
72 views

TestNG @Test can have a testID?

I'm trying to adapt testrail api. I want to set a integer testID value for a @Test and get the value at iTestListener. In testNG, is there a way to specify a test id for each @Test? I tried ...
0
votes
1answer
33 views

TestNG Listener from one xml file is applied to another

I have two xml files to run tests - api.xml and ui.xml In ui.xml I have TestNG Listener, but this Listener also is applied when API tests run. I run tests using testng.xml ui.xml <!DOCTYPE suite ...
0
votes
1answer
83 views

How to read multiple test data files in same script?

I'm trying to use data in multiple test data files in the same script here. Suppose there are 2 data files with login credentials (Login1.csv and Login2.csv). I need to use credentials in Login1.csv ...
1
vote
2answers
67 views

How to run same Selenium/testNG project in a different environment with different credentials?

Currently, I'm running a selenium script in one environment (on-premise) with separate login credentials. There are 5 different users and they have separate login credentials. Suppose there are 50 ...
2
votes
2answers
127 views

How to execute just 50 test cases out of 500 test cases in testNG

There are 500 test cases in my suite. I want to select only 50 test cases and execute them. Is there a way to do it using testNG
1
vote
1answer
27 views

Do Test Runner and Testing Framework exists separately in Java?

As per my knowledge, test runner is any software that takes testing code and as per the configuration, executes the code and collate the results while the testing framework is basically the name given ...
2
votes
2answers
66 views

Getting Nullpointer Exception

While i run this below code i am getting Null pointer exception. import java.util.concurrent.TimeUnit; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import ...
1
vote
1answer
201 views

How to pass the data provider data when page factory method is applied

I have created a sample project using the page factory. Now I want to use the data provider in the code and this is how I have done below. Is the approach correct? I have defined CommonElements class ...
0
votes
1answer
31 views

after click on submit button record will added to the table, so how to verify that record is added or not in the table

There is add employee form, so how to verify the record, should I match the all fields of form which display on table or just match the name, also table is dynamic with pagination.
0
votes
2answers
574 views

How to use TestNG (ITestContext context, Method)?

I found the below code snippet from a real-time project and tried to understand the use of TestData(ITestContext context, Method m) but I was not able to do this. I would like to know how to use ...
0
votes
2answers
252 views

returning values in hash map

I'm trying to return values stored in a hashmap using data provider but it's not working. I'm getting the below error. Thanks in advance. @DataProvider(name="DP") public HashMap<String, String&...
1
vote
1answer
153 views

Where to initialize TestNG TestContext

I have a TestRunner class that starts my TestNG like this: TestRunConfigs configs = TestRunConfigs.parseCommandLine(args); TestNG testRunner=new TestNG(); testRunner.setXmlSuites(getXmlSuites(...