I set up Maven and updated the dependencies to add Selenium and TestNG. When I use @Test, I get below errors :
"Annotations are not allowed here" and "Identifier or type expected " line against @Test
"; expected" and "Expression expected" against line public void login(){
Code :
package com.qtpselenium.hybrid;
import org.testng.annotations.Test;
public class LoginTest {
public static void main(String[] args) {
@Test
public void login(){
System.out.printf("Login");
}
}
}
Instructor
Ashish Thakur Replied on 21/02/2021
There is no main function in test ng
Your code should be
public class LoginTest {
@Test
public void login(){
System.out.printf("Login");
}
}