Groups in TestNG are not following the sequential order -


im trying use groups features in testng , , trying automate application .

i have written 3 tests .

package com.sonata.testng;

import org.openqa.selenium.by; //import org.openqa.selenium.webelement; //import org.openqa.selenium.interactions.actions; import org.openqa.selenium.support.ui.select; import org.testng.annotations.aftermethod; import org.testng.annotations.aftersuite; import org.testng.annotations.beforemethod; import org.testng.annotations.beforesuite; import org.testng.annotations.test;    public class bugzilla_groups extends bugzilla_baseclass{     @beforesuite(groups = {"functional test"})     public void initializetest() throws exception{         super.setup();     }      @test(groups = {"functional test"})     public void testlogin() throws exception {         driver.get(baseurl);         system.out.println("login test start");         driver.findelement(by.id("login_link_top")).click();         driver.findelement(by.id("bugzilla_login_top")).clear();         driver.findelement(by.id("bugzilla_login_top")).sendkeys("jeevan.anekal@gmail.com");         driver.findelement(by.id("bugzilla_password_top")).clear();         driver.findelement(by.id("bugzilla_password_top")).sendkeys("testuser@123");         driver.findelement(by.id("log_in_top")).click();          system.out.println("login test executed");        thread.sleep(5000);       }      @test(groups = {"functional test"})     public void bugreport() throws exception {          //driver.get(baseurl);         system.out.println("bugreport test start");         driver.findelement(by.id("enter_bug")).click();             driver.findelement(by.linktext("widgets")).click();             new select(driver.findelement(by.id("bug_severity"))).selectbyvisibletext("trivial");             new select(driver.findelement(by.id("cf_drop_down"))).selectbyvisibletext("---");             new select(driver.findelement(by.id("rep_platform"))).selectbyvisibletext("macintosh");             new select(driver.findelement(by.id("op_sys"))).selectbyvisibletext("mac os x 10.0");             driver.findelement(by.id("short_desc")).clear();             driver.findelement(by.id("short_desc")).sendkeys("os crashed");             driver.findelement(by.id("comment")).clear();             driver.findelement(by.id("comment")).sendkeys("os debugging issue");             driver.findelement(by.cssselector("#attachment_false>input")).click();             driver.findelement(by.id("data")).sendkeys("c:\\users\\jeevan.s\\downloads\\locators_groups_1_0_2.pdf");                system.out.println("bugreport test executed");     }      @test(groups = {"functional test"})     public void reports() throws exception {          driver.get(baseurl);         system.out.println("report test start");             //driver.findelement(by.cssselector("#account > span")).click();             driver.findelement(by.linktext("reports")).click();             driver.findelement(by.linktext("duplicates")).click();             driver.findelement(by.id("openonly")).click();             driver.findelement(by.id("visiblelist")).click();              system.out.println("reports test executed");     }      @aftersuite(groups = {"functional test"})     public void testcleanup(){         super.teardown();      }    } 

when try execute , test2 executed first ie bugreport() executing .

since test2 report bug , test1 should executed first .

have tried using "dependsongroups" , facing same problem.

you looking @ tests dependent on other tests. need use dependsonmethods in @test annotation instead of dependsongroups.


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -