SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 2 of 2
  1. #1
    Member
    Join Date
    May 2004
    Location
    Boston,MA
    Posts
    69
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    not identifying objects or driver if the test is splitted into two tests

    I am using selenium + test ng

    @Before test:
    webdriver driver initialised

    @test1
    ...
    driver.findelement0.click //works fine
    driver.findelement1.click // new page will come
    driver.find element2.click //element2 is identified in new page correctly

    but if I use like this in @test2 ( splitting tests into two tests from above test1 ) as below... objects are not identified:

    @test1
    ...
    driver.findelement0.click //works fine

    @test2
    driver.findelement1.click // new page should come.. but not able to identify objects
    driver.find element2.click // because above step fails, control never goes...



    So not sure , how to split these tests, or who driver is passed to context of each test ?

    thank you in advance..
    Thanks
    Lottery Tester

  2. #2
    SQA Knight
    Join Date
    May 2006
    Location
    Playa Del Rey, California, United States
    Posts
    2,594
    Post Thanks / Like
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0
    You'll have to do @BeforeClass,

    TestNG

    The @before test will get called before every test. But if you have test1 and test2 share the same class variables.

    Generally I think this is a bad practice for the following reasons: not scaleable, not realiable, harder to maintain, flaky, etc... Tests ideally should be independent of each other and not rely on each other.
    Last edited by dlai; 08-07-2013 at 04:41 PM.
    David Lai
    SDET / Consultant
    LinkedIn profile

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 06:01 AM.

Copyright BetaSoft Inc.