IOSDrive becomes null and Appium TestNG tests restarts the app in between

The main question is posted on StackOverflow with detailed descriptions.

I am facing issues with Test cases execution. When I write multiple tests, app restarts and executes second test while the same thing works on Android device.

Please take a close look at the main question.

@mobihunterz remove:

        <classes>
            <class name="login.googleLogin.AppiumTest" />
        </classes>

from XML. both two copies. it is not needed. all tests should be taken automatically by group name.

also add your testNG version. did you try with latest?

Thanks @Aleksei for the help.

I tried to remove the tag but it is not working.

When I remove the tag from both places, it does not execute any test and prints the log as,

[RemoteTestNG] detected TestNG version 6.12.0

===============================================
Suite
Total tests run: 0, Failures: 0, Skips: 0
===============================================

And in whatever group I add tag, test with that files only are being executed. So, I think is mandatory.

As seen in the log, TestNG version is 6.12.0. I also updated TestNG to the latest which is 6.12.0. I am using TestNG Eclipse Plugin.

@mobihunterz you are correct! it is per doc. i tried your case with testNG 6.10 and xml:

    <test name="Do_Test_1" preserve-order="true">
         .... again some mine parameters staff
        <groups>
            <run>
                <include name="test1"/>
                <include name="test2"/>
            </run>
        </groups>
        <classes>
            <class name="com.xxxx.tests.android.temp_to_test">
            </class>
        </classes>
    </test>

and tests like:

    @Test(groups = {"test1"}, priority = 150)
    public void someTest1_1() {

    }

    @Test(groups = {"test1"}, priority = 50)
    public void someTest1_2() {

    }

    @Test(groups = {"test2"}, priority = 10)
    public void someTest2_1() {

    }

    @Test(groups = {"test2"}, priority = 50)
    public void someTest2_2() {

    }

and got result of order execution is total mess :slight_smile: :

temp_to_test
temp_to_test.someTest1_1
temp_to_test.someTest2_2
temp_to_test.someTest1_2
temp_to_test.someTest2_1

after changed xml to:

    <test name="Do_Test_1" preserve-order="true">
        <groups>
            <run>
                <include name="test1"/>
            </run>
        </groups>
        <classes>
            <class name="com.xxxx.tests.android.temp_to_test">
            </class>
        </classes>
    </test>

    <test name="Do_Test_2" preserve-order="true">
        <groups>
            <run>
                <include name="test2"/>
            </run>
        </groups>
        <classes>
            <class name="com.xxxx.tests.android.temp_to_test">
            </class>
        </classes>
    </test>

and got more correct order :

Do_Test_1
temp_to_test
temp_to_test.someTest1_1
temp_to_test.someTest1_2
Do_Test_2
temp_to_test
temp_to_test.someTest2_2
temp_to_test.someTest2_1

mine tests are using maven.

Oh That’s cool.

However, Today I tried creating 2 classes, 1) GoogleFlow and 2) FacebookFlow

Each of these classes does is, Login → Password Enter → Logout for their corresponding Social Providers. Also modified the XML file as given below:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite">
	<test name="TestGoogle">
		<groups>
			<run>
				<include name="google" />
				<!-- <include name="facebook" /> -->
			</run>
		</groups>

		<classes>
			<class name="login.googleLogin.GoogleFlow" />
			<!-- <class name="login.googleLogin.LoginWithFacebook"/> -->
		</classes>
	</test> <!-- Test -->
	<test name="TestFB">
		<groups>
			<run>
				<include name="facebook" />
			</run>
		</groups>

		<classes>
			<class name="login.googleLogin.FacebookFlow" />
		</classes>
	</test> <!-- Test -->
</suite> <!-- Suite -->

And to my surprise. It’s working correctly now. App is not being restarted. Working fine and in sequence.

Thanks for the help.

Blockquote