I would like to use the same instance of @BeforeMethod for my tests from different classes but It just wont work
package com.code.theCode public class theConfiguration{ @BeforeMethod(groups = {"example"}, alwaysRun = true) public void setupMethod(){ System.out.println("inside setupMethod"); } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
package com.code.test public class theTest{ @Test(groups = {"example"}, alwaysRun = true) public void setupMethod(){ System.out.println("inside test"); } } testng.xml
<suite name="AllTests" verbose="1"> <test name="AllTests"> <groups> <run> <include name="example"> </run> </groups> <packages> <package name="com.code.*" /> </packages> </test> When run my tests I get blank sys outs
Any help greatly appreciated
BeforeMethodas well as your test are not being executed, so the problem isn't only theBeforeMethod. How are you running the tests? IDE? console? with which arguments?