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 6240995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:40:32+00:00 2026-05-24T11:40:32+00:00

@BeforeTest @Parameters({selenium.host, selenium.port, selenium.browser, selenium.url }) public void startServer(String host, String port, String browser,

  • 0
@BeforeTest
@Parameters({"selenium.host", "selenium.port", "selenium.browser", "selenium.url" })
public void startServer(String host, String port, String browser, String url) throws Exception {      
        selenium = new DefaultSelenium(host, Integer.parseInt(port), browser, url);
        selenium.start();
    }

testng.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="SL-Grid" parallel="false">

    <parameter name="username" value="test" />
    <parameter name="password" value="test1" /> 

<test name="SL-Chrome" preserve-order="true"> 
    <parameter name="selenium.host" value="localhost"></parameter> 
        <parameter name="selenium.port" value="5555"></parameter> 
        <parameter name="selenium.browser" value="*googlechrome"></parameter> 
        <parameter name="selenium.url" value="http://properurl:8080/"></parameter> 
        <classes>
            <class name="com.TestBase" /> // Base class where all generic methods, setUp and tearDown methods present
            <class name="com.Login"> // Login related methods and inherit TestBase
                <methods>
                    <include name="loginPage" />
                    <include name="signIn" />
                </methods>
            </class>
            <class name="com.Page1">
                <methods>               
                    <include name="clickLinkA" />
                    <include name="isTextBoxXXXPresent" />
</methods> </class></classes></test>

<test name="SL-Firefox" preserve-order="true"> 
    <parameter name="selenium.host" value="172.16.4.21"></parameter> 
        <parameter name="selenium.port" value="5556"></parameter> 
        <parameter name="selenium.browser" value="*firefox"></parameter> 
        <parameter name="selenium.url" value="http://properurl:8080/"></parameter> 
        <classes>
            <class name="com.TestBase" /> // Base class where all generic methods, setUp and tearDown methods present
            <class name="com.Login"> // Login related methods and inherit TestBase
                <methods>
                    <include name="loginPage" />
                    <include name="signIn" />
                </methods>
            </class>
            <class name="com.Page2">
                <methods>               
                    <include name="clickLinkB" />
                    <include name="isListBoxXXXPresent" />
</methods> </class></classes></test>

</suite>

When i run the suite it should invoke startServer() from TestBase -> loginPage() and SignIn() from Login -> clickLinkA() and isTextBoxXXXPresent() from Page1. But manytimes system first invokes mathods from Page1 class and so gets failed (since signIn is not invoked).

Can any one please tell me where i am wrong here. Or any other better way to design. or any alternate for preserve-order

  • 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-05-24T11:40:33+00:00Added an answer on May 24, 2026 at 11:40 am

    I think this may be issue in TestNG which you can report to TestNg guys. But to overcome your issue, you can include your login & Signin method in your BeforeTest or call it in your test Method in this case clickLinkA.
    Hope this solves your prblm.

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

Sidebar

Related Questions

My JUnit test is as follows: public class Toto { @BeforeClass public static void
BACKGROUND: My goal is to code a TestNG-Selenium system that runs self-contained (no strings
I'm trying to append a url with an id (just as a test) in
I'm new in Ext and I have a problem: I'm trying to fill extjs-grid
I'm using the ajax to load a div content, but the div content is
I have a base class that represents a database test in TestNG, and I
I just wanna ask what would be better approach to supply these objects in
first of all thank you all for reading this. i want to populate my
I am writing integration tests.Now, before tests are run I want to setup the
Hey, I'm writing my first Rails app, and I'm trying to replace the underscores

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.