@Test from another class always getting skipped even with proper usage of dependsOnGroups and alwaysRun. Why are they skipped?

127
April 07, 2018, at 6:33 PM
public class FirstClass extends Constants{
public class login(){
@BeforeTest
public void setUp(){
//set up the driver
}
@AfterTest(dependsOnGroups = "Commerce")
public void tearDown(){
//quits the driver
}
@AfterSuite(dependsOnGroups = "Commerce")
public void extentTearDown(){
//flushes extent
}
@Test(groups = "Login")
public void someTestCase(){
//
someObject obj = new someObject()
}
}
------------------------------------------------
public class SecondClass extends Constants{
public class secondTestCase(someObject obj){
@Test(groups = "Commerce", dependsOnGroups = "Login", alwaysRun = true)
public void someTestCase(){
//
}
-----------------------------------------
public class Constants{
//contains methods used frequently
}
-------------------------------
<test thread-count="5" name="Test">
<classes>
  <class name="Tests.FirstClass"/>
  <class name="Tests.SecondClass"/>
</classes>

If you notice there are two separate classes: FirstClass and SecondClass. And, the method under @BeforeTest starts the browser with all the driver.get(url) stuff.

What's happening is the @Test in SecondClass is always getting skipped/ignored. Because of this the ExtentReport is generating with only the result from FirstClass.

Also, @Test from the First Class is passing. So that means, @Test from the Second Class should also be working because @Test from SecondClass is "dependsOnGroups='login'" and "alwaysRun=true".

Why is my @Test from SecondClass always getting ignored?

I have checked by keeping a System.out.println() in the method/test from the SecondClass but it's ignore too.

I have also pasted a snippet from my TestNG.xml which shows that both my classes are being mentioned there within the class tags.

PS: Also notice that, I have passed an Object into the @Test method in the SecondClass. This same object was instantiated in the @Test method of the FirstClass. This seems to me like an issue. How should I be handling this? Because I want that same object both in FirstClass and SecondClass.

READ ALSO
Android Error : java.io.IOException: CreateProcess error=2, The system cannot find the file specified

Android Error : java.io.IOException: CreateProcess error=2, The system cannot find the file specified

I am getting following error while building one e-commerce application

168
How to save rich data into mongoDB for creating a blog?

How to save rich data into mongoDB for creating a blog?

I am trying to build my own blog using NodeJS and angular Cli, and I have a question on how to save rich blog data in my MongoDB

150
Displaying a 3D Cube with WebGL

Displaying a 3D Cube with WebGL

I'm building a 3D static cube with WebGLI wrote the shaders in the html file and the application program in the js file

31
Angularfire2 ng5.0 authentication signing out immediately after sign in

Angularfire2 ng5.0 authentication signing out immediately after sign in

I'm trying to migrate my Angular/Firebase application from angular 4 to 5Almost immediately after login using AngularFire

152