anavas57
unread,Sep 20, 2010, 4:36:08 PM9/20/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to testng-users
Hi Cedric,
Thanks for your answer. I've reviewed the code and have noticed I was
treating "data" as a String. "Data" - now an Object - is returning as
a "new" Object[] (data) and it's bringing back the expected
information to @Test
Problem now is how to use the same data returned in each iteration in
different tests that will be running sequencially?
As you can see below, Address and ZipCode will be used in the Landing
page. Then, once I move to the next page, called Dispatch page, I will
use phone information (NPA, NXX and Suffix) and/or City, State
(depending on what's showing up.
I would like to use the same data in different @Test (or at least in
different Methods) as a way to isolate the tests and to improve my
reporting.
What's happening now is that, once enterAddressPhone is executed, the
iterator is bringing back the second set of date without waiting until
the other methods are executed.
See below an example from my code:
@Test(description="Navigate Digital Commerce", dataProvider =
"runner")
public void enterAddressPhone(Object[] obj) throws
InterruptedException{
String Address = (String) obj[0];
String Apartment = (String) obj[1];
String City = (String) obj[2];
String State = (String) obj[3];
String ZipCode = (String) obj[4];
String NPA = (String) obj[5];
String NXX = (String) obj[6];
String Suffix = (String) obj[7];
for (int second = 0;; second++) {
if (second >= 60) break;
try { if (selenium.isVisible("dl_addressInput")) {
selenium.type("dl_addressInput", Address);
selenium.type("dl_zipCodeInput", ZipCode);
selenium.click("compareNow");
selenium.waitForPageToLoad("240000");
break; }
}
catch (Exception e) {};}
Thread.sleep(1000);
}
public void phoneEntrySubmit(String NPA, String NXX, String Suffix)
throws InterruptedException{
// Verify if phone_entry_submit pop-up is present
for (int second = 0;; second++) {
if (second >= 30) break;
try { if (selenium.isVisible("phone_entry_submit"))
{
boolean ldata = true;
if ((NPA.length()!= 3)) ldata = false;
if ((NXX.length()!= 3)) ldata = false;
if ((Suffix.length()!= 4)) ldata = false;
if (ldata){
selenium.type("npa", NPA);
selenium.type("nxx", NXX);
selenium.type("suffix", Suffix);}
selenium.click("phone_entry_submit");
break; }
} catch (Exception e) {}
Thread.sleep(1000);
}
}