# Problems related to designing automation script

**URL:** <https://forumautomation.com/t/problems-related-to-designing-automation-script/9510>\
**Category:** Industrial Automation\
**Created:** [June 17, 2021, 5:12am UTC](https://forumautomation.com/t/problems-related-to-designing-automation-script/9510 "2021-06-17T05:12:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![instrumentationtechi](https://forumautomation.com/letter_avatar_proxy/v4/letter/i/50afbb/32.png) [@instrumentationtechi](https://forumautomation.com/u/instrumentationtechi)\
**Post date:** [June 17, 2021, 5:12am UTC](https://forumautomation.com/t/problems-related-to-designing-automation-script/9510/1 "2021-06-17T05:12:11Z")

</div>

I am currently designing automation script for my project using Page object model with pagefactory. I am using Testing version 7.4.0 which is running individual test case. However, when I try running the suit, it runs the first test and knocks off the rest with the exception below.

 ![image](https://cdn.forumautomation.com/original/2X/5/54239181684f3084b3fec1a5d6d1e3d226833ec2.jpeg)

---

<div class="post-metadata">

**Author:** ![ashlin](https://forumautomation.com/user_avatar/forumautomation.com/ashlin/32/3775_2.png) [@ashlin](https://forumautomation.com/u/ashlin)\
**Post date:** [June 17, 2021, 5:17am UTC](https://forumautomation.com/t/problems-related-to-designing-automation-script/9510/2 "2021-06-17T05:17:34Z")

</div>

Are you initializing any variable in @beforeclass/@beforemethod annotations, if so Can you try beforemethod and aftermethod annotations instead of beforetest and aftertest. Make sure page factory InitElement correctly placed in page classes - PageFactory.initElements(driver, this )

If you’re webdriver reference value is local you will get nullPointerException once it completed one test case , And that reference value will work onetime only . and you’re test cases are dependent or independent , if you’re test casese are independent you will launch the browser in @BeforeMethod will work, if your test casses are common to all the test casses (like login , or selecting the items then proceed to another tasks ) dependent in this scenario you will launch the browser in @BeforeClass
