Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execution order alternates between diferent classes #438

Open
ricardorlg opened this issue Sep 3, 2013 · 5 comments
Open

Execution order alternates between diferent classes #438

ricardorlg opened this issue Sep 3, 2013 · 5 comments

Comments

@ricardorlg
Copy link

I have two classe that inherited from a abstracc superclass, in class 1 i have some methosds that depends between them, this is just for make execution orden in that class, the other class only has one method, when i run a single class my test pass, but if i run all the class the execution orden alternates, i mean firs it executes some methods of class 1 and then the one of class 2, i need that if it starts executin class1 or class 2 firs ends of execute that class and after that executes the other.

code of the classes:

public abstract class Base {

   //fields

    @BeforeClass()
    public void setUpMethod() throws Exception {

    }

    @AfterClass
    public void tearDownMethod() throws Exception {

    }

    private void createData() {

    }

    @BeforeMethod
    protected void cleanStatus() {

    }
public class Class2 extends Base {


    @Test
    public void testSearchCitiesByCountry() throws Exception {

    }
}
public class Class1 extends Base {




    @Test(groups = "Database-read")
    public void testGetApplicationStatus() throws Exception {

    }


    @Test(groups = "Database-write", dependsOnGroups = "Database-read")
    public void testUpdateApplicationStatusFromClosingConvocatory() throws SQLException {

    }


    @Test(groups = "Database-write", dependsOnMethods = "testUpdateApplicationStatusFromClosingConvocatory")
    public void testUpdateApplicationStatusFromConvocatory() {


    }


    @Test(groups = "Database-read", dependsOnMethods = "testGetApplicationStatus")
    public void testCheckIfStudentHasApplied() throws Exception {

    }


    @Test(groups = "Database-read", dependsOnMethods = "testGetApplicationStatus")
    public void testGetApplicationStatusByStudent() throws Exception {

    }


    @Test(groups = "Database-read", dependsOnMethods = "testGetApplicationStatus")
    public void testSearchApplicationStatusForStudentNotification() throws Exception {

    }


    @Test(groups = "Database-write", dependsOnGroups = "Database-read")
    public void testDeleteConvocatoryApplications() {

    }


    @Test(dependsOnGroups = "Database-write")
    public void testSetCurricularProgramTotal() {

    }
@matthauck
Copy link

I am experiencing this same problem. I posted on the user group, but received no reply...

https://groups.google.com/forum/#!topic/testng-users/tRJNxB-eihc

@ricardorlg
Copy link
Author

I think the problem in my case is with the dependsOnGroups, it looks like when a tes depends on a group testng start to run the test in the other class that doesn't depends. Cause i remove the dependsOnGroups and now the test run fine.

@ilynaf
Copy link

ilynaf commented Sep 5, 2013

Experienced exactly the same issue after upgrading from TestNG 6.1.1 to 6.8
@ricardorlg it also happens with dependsOnMethods since I don't use dependsOnGroups in my case
Someone, pls consider a fix for this issue ASAP. It's so annoying and blocking my work

@ilynaf
Copy link

ilynaf commented Sep 5, 2013

It looks like TestNG executes those test methods (from different test classes) which don't depend on any method first and then executes those with dependency

@ricardorlg
Copy link
Author

Using different test tags to run my tests, fix my problem but i dont like that i have to do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants