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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:16:09+00:00 2026-05-13T16:16:09+00:00

I have three programs, first does a selenium test import com.thoughtworks.selenium.*; import java.util.regex.Pattern; import

  • 0

I have three programs,

first does a selenium test

import com.thoughtworks.selenium.*;
import java.util.regex.Pattern;
import junit.framework.*;

public class MyTest extends SeleneseTestCase {

int flag_eco;

public void setUp() throws Exception {
    setUp("http://www.mysite.com/", "*iexplore");
}
public void testMyTest() throws Exception {
    selenium.open("/pages/static/homepage_logout.html");
    selenium.type("username", "myuser");
    selenium.type("password", "password");
    selenium.click("//input[@value='LOGIN']");
    selenium.waitForPageToLoad("30000");
    selenium.click("Confirm");
    selenium.waitForPageToLoad("30000");
    selenium.click("link=Applications");
    selenium.waitForPageToLoad("30000");
    selenium.click("link=Journey");
    selenium.waitForPageToLoad("30000");
    selenium.click("link=Launch Application (MUST BE LOGGED IN)");
    selenium.waitForPageToLoad("30000");
    if((selenium.isTextPresent("Please enter one of the following:")))
    {
        System.out.println("Journey Working Fine");
        flag_test= 0;
    }
    else
    {
        System.out.println("Journey Failed");
        flag_test = 1;
    }
    selenium.selectFrame("topmenu");
    selenium.click("link=Home");
}
public static Test suite() {
//method added
return new TestSuite(MyTest.class);
}
public void tearDown(){
//Added . Will be called when the test will complete
selenium.stop();
}

}

then a sendmail gettin the values from the selenium test

      import java.util.*;


         public class SendMail
         {
         public void send()
         {


        MyTest Test = new MyTest();
        if (Test.flag_test==1)
          {
            System.out.println("Journey Failed");
        }
        else if(Test.flag_test==0)
          {
            System.out.println("Journey Working Fine");
          }

}
}

main class calling both

        import java.io.*;
     import javax.servlet.*;

 public class Test 
   {
public static void main(String args[]) 
{


    MyTest tes = new MyTest();
            junit.textui.TestRunner.run(tes.suite());

    SendMail se = new SendMail();
    se.send();

}
   }

how do i pass the flag value from MyTest to SendMail

  • 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-13T16:16:09+00:00Added an answer on May 13, 2026 at 4:16 pm
    • The flag should be public static (I don’t see it defined in the code you provided) – i.e.

      public class MyTest {
           public static int flag;
           // the rest of the code
      }
      
    • in send() you can refer to it with MyTest.flag_test

    Note, that this is not a good way of passing data, but in your case there isn’t anything better.

    I think you are doing something that shouldn’t be done at all. Here’s what I propose:

    • move the code that is changing the flag outside the test
    • include it in the test, in the appropriate place (as if it is there)
    • include it in SendMail as well.

    Thus you won’t need to invoke the test in order to obtain a flag.

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

Sidebar

Related Questions

Let me first say that I have quite a lot of Java experience, but
I have three different development machines. Do I need three different iPhone Developer Program
I have declared three variables namely TemplateData tData; TaskInstance tInstance;int tID; in my program.
I have a program with three threads. I call them like this: if __name__
I have a program that uses three JTextField fields as the main data entry
I have a school project to program multilayer perceptron that classify data into three
I'm working on a program to store and manage test results. Tests have properties
I have one problem with semaphores, I though you could help me.. Okay first
I have two programs written in C++ that use Winsock. They both accept TCP
At school we have been using a bootstrap program to run stand-alone programs without

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.