Note that there are some explanatory texts on larger screens.

plurals
  1. POJava passing value
    primarykey
    data
    text
    <p>I have three programs,</p> <p>first does a selenium test </p> <pre><code>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(); } </code></pre> <p>}</p> <p>then a sendmail gettin the values from the selenium test</p> <pre><code> 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"); } </code></pre> <p>} }</p> <p>main class calling both</p> <pre><code> 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(); } } </code></pre> <p>how do i pass the flag value from MyTest to SendMail</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload