Hot answers tagged

3

You don't actually initialize the driver before you call it. Your SeleniumDriver.openPage() call happens without any of the initialization code for the driver being called. Your code: public static SeleniumDriver seleniumDriver; //initialize webdriver public static WebDriver driver; does not actually initialize the driver - it merely declares the variable. ...


3

make sure you are importing org.testng.annotations.Test and not org.junit.Test


2

The initElements method second argument should be a page class, you feed it the driver. I think you should change the constructor of Homepage_ReCheck_Search to: PageFactory.initElements(driver, this); The search_box never gets initialized, because you do not init a page. Thus the search_box stays NULL its default value. Meaning you cannot interact with it.


2

Data Providers are use to pass the Test-Data into the @test .Please create a java member function to write the excel and call directly to your @test instead of using it in /as data provider


1

The id attribute of the <div> tag is dynamic which will change each time the webpage is accessed. In these cases you need to construct dynamic locator strategies as follows: xpath //div[starts-with(@id, 'post-body-')]/div/form/input Note: The second <div> is the first/only child of it's parent, the <form> is the first/only child of it's ...


1

Short answer: Selenium is a testing framework to test specifically the UI of the application how it behaves on browser. TestNG is a testing framework to test the unit, functional, E2E, integration testing of the application. Point of confusion (long answer): Most of the time, we find use of TestNG with Selenium (mostly in JAVA world). This coupling raises ...


1

Your machine will most likely not be able to handle 100 chrome browsers at the same time. I would suggest saving your excel file in CSV format and using jmeter instead. A simple testplan like this should be sufficient. User defined variables = URL and server info CSV Data Set Config = point at your CSV file Thread Group = controls the number of threads ...


1

If you extend a class having driver field where that field is initialized do not add filed of the same name to child class. Doing that you're hiding a field of base class. Here is the example: Your base: public class TestBase { public Object object; @BeforeTest public void doBefore(){ object = new Object(); } } Your test that WILL ...


1

you can execute using testng not extendreport. There will be a testng-failed.xml getting created at "test-output" folder you can use this to rerun code. you can run scripts from java as : // Create object of TestNG Class TestNG testng = new TestNG(); // Create a list of String List<String> suitefiles = new ArrayList<String&...


1

Its an interesting observation if you change onlyforgroups to groups then everything works: but when there are multiple groups included in your testng.xml then all before and after method in mentioned group get executed before every test method . so in order to avoid this you have to mix groups and onlygroups together Explanation: If you don't specify group ...


1

This is onlyForGroups description from the javadocs: Causes this method to be invoked only if the test method belongs to a listed group. It can be used if different setups are needed for different groups. Omitting this or setting it to an empty list will cause this method to run before every test method, regardless of which group it belongs to. Otherwise, ...


1

For example using this way: class MyReporter implements IReporter { @Override public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites, String outputDirectory) { List<ITestContext> testContexts = suites .stream() .flatMap(iSuite -> iSuite.getResults().values().stream()) ...


1

You are using java jdk 8 , You should update it to jdk 11+ https://stackoverflow.com/q/9170832/6793637


1

Although the question is highly broad ("How to test"-ish) I would guess that a good first step would be to create automated checks in two aspects: 1 - (Main part) Consumer Contracts You may want to check if your application is generating messages in the format expected by your consumer application(s). In case you are not familiar, here and here you ...


1

Have you tried to implement Parallel execution for such a large testNG file. software testing solutions providing companies always recommend to break the file into bits and then try to execute using multiple threads. Parallel testing cane be implemented in following ways: Parallel- Single Machine - Multiple Processes Distributed Testing- Multiple Machines - ...


1

According to the Surefire configuration, I guess the file src/test/resources/testng.xml does not exist. Pls post the project on GitHub. It's hard to investigate like this. I believe this issue is similar to stackoverflow.


1

Check if you have correct sheet name. As you can see in stacktrace, error happens in ExcelUtil line 27. Debug/Print the sheet name to see if the value is correct.


1

driver.get().findElement(By.xpath("//div[@id='example_paginate']/span/a["+outerIndex+"]")).click(); Here when the page-load you are in index tab one already After the first iteration, you are again clicking the same tab as outerIndex is still 1 so it counts page one content twice So for fix, just keep the click action at the start ...


1

You don't use the Test Parameters when using Cucumber, you use the Scenario outlines. So, when you have: Scenario Outline: Login As User When I log in as '<user>' Examples: | user | | xyz@gmail.com | You would have your test step definition handle that by using an Excel reader. @When("^I log in as \"([^\"]*)\") ...


1

Register event handle: publisher.registerHandlerFor(EmbedEvent.class, this::stepEmbedded); Catch the event: private void stepEmbedded(EmbedEvent event) { byte[] a = event.getData(); String s = new String(a); try { step.log(Status.FAIL, "Test Failed" , MediaEntityBuilder....


1

Don't change input argument of custDataProvider method. Use custDataProvider without any input arguments. Just change the input arguments of createNewCustomer from String to Iterator. Exactly like whatever you return from custDataProvider. Then you can iterate through it in createNewCustomer. @DataProvider(name="data") public Iterator<...


1

You can't specify a number like you do, but you can use reflection and customize @DataProvider behavior depending on the method it runs. As per TestNG documentation: If you declare your @DataProvider as taking a java.lang.reflect.Method as first parameter, TestNG will pass the current test method for this first parameter. This is particularly useful when ...


Only top voted, non community-wiki answers of a minimum length are eligible