- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 593 Articles for Java Programming

Updated on 11-Jun-2020 12:41:02
We can run a particular set of test cases by including a group of test cases
in the execution.ExampleTestng xml files with groups.
To run a group of test cases from the set of test cases, we have to define in the testng xml file. Here the testNG xml contains group Smoke to be included in execution.Example@Test(groups={"Smoke"})
public void Payment(){
System.out.println(“Payment is successful”);
}In the Java class file only the test method with group as Smoke will be run out of the entire regression suite. 
Updated on 11-Jun-2020 12:34:29
The parameterization in execution in TestNG can be done by the following ways −data parameterization with @Parameters annotation.data parameterization with @DataProvider annotation.ExampleTestng xml file with @Parameter annotation. We can pass values at runtime to the test methods by defining in the testng xml file.Exampleimport org.testng.annotations.Parameters; import org.testng.annotations.Test; public class TestParameter { @Test @Parameters("Url") public void loginwithUrl(String urlname) { System.out.println("The value of url is : " + urlname);} }Java class files have @Parameters with (“Url”).ExampleWith ... Read More 
Updated on 11-Jun-2020 12:31:45
To overlook a particular test method from execution in TestNG enabled
helper attribute is used. This attribute has to be set to false to overlook a test
method from execution.ExampleJava class file.@Test(enabled=false)
public void verifyRepay(){
System.out.println("Repayment successful");
}
@Test
public void Login(){
System.out.println("Login is successful ");
}
@Test
public verifyHistory(){
System.out.println ("History verification is successful");
}Here the verifyRepay() method shall be overlooked during execution. 
Updated on 11-Jun-2020 12:29:24
The execution of a particular test method can be made dependent on
another test method with the help of dependsOnMethods helper attribute.Example@Test(dependsOnMethods={"Payment"})
public void verifyLoan(){
System.out.println("Loan payment successful");
}
@Test
public void Payment(){
System.out.println("Payment successful ");
}
@Test
public verifyTransaction(){
System.out.println ("Transaction verification");
}Here in the Java class file, verifyLoan() method will only be executed after the Payment() method is run successfully. But verifyTransaction() method runs independently without having a precondition test method to be executed. 
Updated on 11-Jun-2020 12:25:18
The testng.xml file has the numerous uses as listed below −Test cases are executed in groups.Test methods can be included or excluded in the execution.The execution of multiple test cases from multiple java class files can be triggered.Comprises names of the folder, class, method.Capable of triggering parallel execution.Test methods belonging to groups can be included or excluded in the execution.ExampleTestNG.xml file Here as per the xml file, ... Read More 
Updated on 11-Jun-2020 12:23:48
The various annotations available in TestNG are listed below −@Test − This is used before every test method in the java class file.@BeforeSuite − This is used to run a particular test method before all the test methods.@AfterSuite − This is used to run a particular test method after all the test methods.@BeforeClass − This is used to run a particular test method only once before the first test method.@AfterClass − This is used to run a particular test method only once after all the test methods in the present java class file are done with execution.@BeforeTest − This is ... Read More 
Updated on 10-Jun-2020 13:52:48
Implicit is the default waiting time for each test step in our execution. Thus if we keep an implicit wait of ten seconds, each test step will wait for that amount of time for an action to take place and then move to the next step.Implicit wait is a dynamic wait which means if the wait time is ten seconds and the web element on which the next action is to be taken is available at the fifth second, then control will immediately move to the next test step rather than waiting for the full ten seconds.However if the element ... Read More 
Updated on 10-Jun-2020 13:32:34
The differences between get() and navigate() methods are listed below.sl.no.get()navigate()1It is responsible for loading the page and waits until the page has finished loading.It is only responsible for redirecting the page and then returning immediately.2It cannot track the history of the browser.It tracks the browser history and can perform back and forth in the browser.ExampleWith get().import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; import java.util.List; public class LaunchBrw { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); WebDriver driver = new ChromeDriver(); String url = "https://www.tutorialspoint.com/index.htm"; ... Read More 
Updated on 10-Jun-2020 13:19:00
findElement() and findElements() method tries to search an element in DOM.The differences between them are listed below −sl.no.findElement()findElements()1It returns the first web element which matches with the locator.It returns all the web elements which match with the locator.2Syntax − WebElement button = webdriver.findElement(By.name(""));Syntax − List buttons = webdriver.findElements(By.name(""));3NoSuchElementException is thrown if there are no matching web elementsEmpty list is returned if there are no matching elements.ExampleUsing findElements ().import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class RowFindElements { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); WebDriver driver ... Read More 
Updated on 05-Jan-2021 06:38:26
The .NET centric applications are meant to windows operating system up till now, but now Microsoft has introduced a new cross-platform application called Mono which enables the execution of the application developed under the .NET platform in Linux environment by giving an impression in such a way that as if we are running Linux package rather than executing .exe file.MonoMono is an open-source utility that allows the developer to execute .NET centric applications on other platforms such as Mac or Linux as it provides an installation package for Windows platform to compile and execute .NET assemblies on Windows OS without ever ... Read More Advertisements