New answers tagged

1

You can catch the assert True, if you read the documentation of asserttrue: https://www.javadoc.io/doc/org.testng/testng/6.8.17/org/testng/Assert.html#assertEquals(boolean,%20boolean,%20java.lang.String) you can see that asserttrue throws an error and not an exception. So you have to capture the Throwable. ANd you can print it to console or use logger as ...


1

Java has a logging feature built-in. You would probably log a Severe or Warning message. Example: Logger logger = Logger.getLogger(MyClass.class.getName()); logger.log(Level.SEVERE, "My message"); Naturally, you may want to wrap this logging alongside assertions. class Verifier { ... public void verifyEquals(Object obj1, Object obj2) { try{ ...


0

You can do it with @Factory annotation and group-by-instances parameter in TestNG; @Factory(dataProvider="dp") public Object[] createDataProviderInstances(int id) { return new Object[] {new TestClass(id)}; } And in the testng xml file; < !DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > <suite name="LocalSuite" verbose="1"> &...


0

Another way is adding the apostrophe before number in Excel cell --> Excel will treat it as text. '123456


0

in your code at the @BeforeTest section change : WebDriver driver = new ChromeDriver(); this to driver = new ChromeDriver(); This will solve the problem.enter code here //////////////// public class Login_SF { public static WebDriver driver; String text; @BeforeTest public void Login() { System.setProperty("webdriver.chrome....


0

As evidenced by NiNa's answer above: Answer, Priority always takes precedence and it overrides the group mechanism (and as such, dependencies). If there are two methods with the same priority, the first one that goes is in alphabetical order. Additionally, and a little off topic, is that preserve-order in your TestNG.xml file seems to be the last of all ...


2

You haven't loaded your file to properties object hence you get null when try to obtain a property value. Your code should look like public TestBase() { try { prop = new Properties(); FileInputStream ip = new FileInputStream("/Users/rasha011/Dev/Parabankparasoft/src/main/java/com/parabank/qa/config/config.properties"); ...


Top 50 recent answers are included