Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7868119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:54:08+00:00 2026-06-03T00:54:08+00:00

i have started with selenium few weeks back. i have designed my test this

  • 0

i have started with selenium few weeks back. i have designed my test this way

  1. using @BeforeClass i am creating a object and calling a method of class which is opening the browser and performing a login operation.
  2. i have another method which has the selenium code for the test operation i want to perform, in my case boundary value analysis
  3. now i have created a @Test method which calls this previous method and passes values to it required for the test

The problem i am facing is
1. the browser is launched and the loging operation takes pace, after this the browser tries to open the the home page again.
2. I wanted to know if this is correct way to write selenium tests scripts

also if i remove the step 1 and include login method in step 2 my test runs fine
I am using selenium-rc and STS on groovy on grails

Code in one class

void candidatelogin() {
        selenium.open("/jeepnee/")
        selenium.click("link=Login")
        selenium.type("id=username", "csv_candidate4@trashmail.net")
        selenium.type("id=j_password", "kanishka1")
        selenium.click("id=submit")
        selenium.waitForPageToLoad("60000")
    }

the above part i am calling from the code bellow

class CandidateEditProfileInfoFunctionalTests extends GroovyTestCase{

public String addressone="nejshdgfbvxczaqwer1y2io3lkjh7dg*lakiqwerjshag"
    @BeforeClass
    static void setUp() {
        GeneralTests candidate= new GeneralTests()
        candidate.candidatelogin()
    }


void EditProfileInfoFail(String streeta, String streetb, String city, String state, String zip, String mobilecountry, String mobilearea, String mobilephone, String landlinecountry, String landlinearea, String landlinenumber) {
        selenium.waitForPageToLoad("60000")
        selenium.click("link=My Profile")
        selenium.waitForPageToLoad("80000")
        selenium.click("id=editProfile")
        selenium.waitForPageToLoad("80000")
        selenium.type("id=street1", streeta)
        selenium.type("id=street2", streetb)
        selenium.type("id=city", city)
        selenium.type("id=state", state)
        selenium.type("id=zip", zip)
        selenium.select("id=country", "label=Philippines")
        selenium.type("id=mobileCountryCode", mobilecountry)
        selenium.type("id=mobileAreaCode", mobilearea)
        selenium.type("id=mobilePhoneNumber", mobilephone)
        selenium.type("id=landlineCountryCode", landlinecountry)
        selenium.type("id=landlineAreaCode", landlinearea)
        selenium.type("id=landlinePhoneNumber", landlinenumber)
        selenium.click("id=submit")
        selenium.waitForPageToLoad("80000")
        assertTrue(selenium.isTextPresent("Please complete the required fields"))
        assertEquals("Candidate Creation - Step 2", selenium.getTitle())
    }
    @Test
    void homeCountryOnFailureShowsErrorMessage(){
        EditProfileInfoFail(addressone, "aaa", "bangalote", "karnataka", "1234", "11", "222", "12345", "11", "22", "5432")

    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T00:54:09+00:00Added an answer on June 3, 2026 at 12:54 am

    Is any of your logic duplicated in your @BeforeClass method? That method is run one time to setup any dependencies all of your test methods will need. It sounds like the logic in this method is somewhat duplicated in Step 2. It seems that the code in step 2 to open the home page could be removed, as it has taken place inside of your @BeforeClass method. If your subsequent tests need to go back to the HomePage it would be better to change to the @Before annotation, which will then run that code prior to every test run.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have started using Selenium IDE. I am recording my actions to create tests.
I have started using the selenium plugin for firefox for web automated testing. Is
I have started using Jython as it seems to be a excellent language, and
I have started using Linq to SQL in a (bit DDD like) system which
I have started using aspects for parameter validation in our development framework. It works
I have started having problems with my VPS in the way that it would
I have started using Linq to SQL for a project im working on and
I have started writing a Macro in Visual Studio 2005 like this: Public Sub
I have started developing a new Rails app on my server using RVM, Rails
I have started a new app a few days ago and began working with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.