Test cases of different class are not executing, one after other


I am new to Appium. I have started Appium scripting.
I have created 2 classes. In one class there is desired capability added and a simple test. while in second class there are some UI tests.
Now when i am executing both class via testng.xml, only first is executing second is not executing.
if i am copying all tests from second class and using in first class then all test cases are executed.
please help me , it shows only java.lang.NullPointerException and test case is skipped.

Desired capabilities are mandatory to execute each class. You need to enter in all classes

Use generic framework like

public BaseClass{

static AndroidDriver [WebElement];

public void setUP(){
// Initialize android driver with caps

public void setcapabilities(){
// create caps here

public void tearDown(){ // Quit android driver instance here}

public TestCaseClass1 extends BaseClass {
public void Method1() {}
public void Method2() {}

public TestCaseClass2 extends BaseClass {
public void Method3() {}
public void Method4() {}

with this all methods will run and u r driver instance will be accessible in all test case classes

Yes i have created same architecture, but the problem is test cases are executing easily in base class but if i use same @Test in another class they are not executing, Junit just shows that test cases are skipped and null pointer exception is shown. please suggest

But if i am doing this for every class my app will be closed every time and will be installed again.
can u plz guide me which specific capability needs to be bind together and put in every class

The place where u r setting capability and creating Android Driver instance
put that code or method in below annotation. It will work and it will run only once for u r all classes

public void initMethod()

Did you ever solve this issue? I’m having a baseclass with all setCapability information but @Test in other classes doesnt execute and get null pointer exception.

Appreciate help