Both annotations runs before the @test in testNG then what is the difference between two of them.
In TestNG
@BeforeMethod - BeforeMethod executes before each and every test method. All methods which uses @Test annotation. @BeforeMethod works on test defined in Java classes.
@BeforeTest - BeforeTest executes only before the tag given in testng.xml file. @BeforeTest works on test defined in testng.xml
Reference:- https://examples.javacodegeeks.com/enterprise-java/testng/testng-beforetest-example/ and http://howtesting.blogspot.com/2012/12/difference-between-beforetest-and.html