|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
Data Driven test with SeleniumHow to do data driven test using selenium..?
can I give the data in excel sheet/file and retrieve it with my scripts? If so how? If not, what type of does Selenium support...? Pls give a clear idea..? I new to Selenium.. Thanks, Jagan J --------------------------------------------------------------------- Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5300&messageID=14738#14738 --------------------------------------------------------------------- To unsubscribe, e-mail: selenium-users-unsubscribe@... For additional commands, e-mail: selenium-users-help@... |
|
|
|
|
|
Re: Data Driven test with Seleniumhi friend,
I implemented data driven testing for one of the application in our company. i read the external file as a input and read the script. Follwing is the code. package com.example.tests; import com.thoughtworks.selenium.*; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.InputStreamReader; import java.util.regex.Pattern; public class Create extends SeleneseTestCase { public void setUp() throws Exception { setUp("http://user your ip address or application link"); Create(); } public void Create() { selenium.open("/SVManager/welcome.do"); selenium.type("username", "admin"); selenium.type("password", "test"); selenium.click("ImageField"); selenium.waitForPageToLoad("30000"); selenium.click("//img[@id='imglogout' and @onclick=\"fnClick('3')\"]"); BufferedReader in = null; InputStreamReader inputStream = null; try{ //int flag; inputStream = new InputStreamReader(new FileInputStream("C:"+File.separator+"user.txt")); in = new BufferedReader(inputStream); String line = null; String user = ""; String pwd = ""; while((line = in.readLine()) != null){ String[] data = line.split(" "); if(data.length >= 1){ user = data[0]; pwd = data[1]; System.out.println("user : "+user); System.out.println("pwd : "+pwd); //for(int i=0;i<10;i++){ selenium.waitForPageToLoad("30000"); selenium.click("//a/font"); selenium.waitForPageToLoad("30000"); selenium.type("username", user); selenium.type("password", pwd); selenium.type("fullName", "joneywalse"); selenium.select("role", "label=Broker"); selenium.type("emailList", "jon@smt.com"); selenium.click("isMultipleLogin"); selenium.addSelection("strDeskId", "label=ASIA"); selenium.addSelection("strDeskId", "label=Mex Derivatives"); selenium.click("button"); selenium.select("primaryPlatform", "label=ASIA"); selenium.click("Image1"); selenium.waitForPageToLoad("30000"); try{ selenium.type("custId", "1040"); selenium.select("role", "label=Broker"); selenium.type("strmaxCommandAmount", "1"); selenium.type("strmaxcommandPeriod", "1"); selenium.type("strinstitutionid", "14"); selenium.click("canViewInstitution"); selenium.type("location", "14"); selenium.click("Image1"); selenium.waitForPageToLoad("30000"); selenium.type("custId", "1040"); selenium.select("role", "label=Broker"); selenium.type("strmaxCommandAmount", "100"); selenium.type("strmaxcommandPeriod", "100"); selenium.type("strinstitutionid", "14"); selenium.click("canViewInstitution"); selenium.type("location", "14"); selenium.click("Image1"); selenium.waitForPageToLoad("30000"); }catch(Exception ex){ ex.printStackTrace(); selenium.open("/SVManager/listUser.do"); selenium.waitForPageToLoad("30000"); } } } }catch(Exception ex){ ex.printStackTrace(); }finally{ try{ if(in != null) in.close(); if(inputStream != null) inputStream.close(); }catch(Exception ex){ ex.printStackTrace(); } } } public static void main(String[] args) { Create newTest = new Create(); try { newTest.setUp(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } } with thanks balamurugan jayabalan
|
|
|
RE: Data Driven test with SeleniumHi All,
I am new to selenium. I need to do datadriven testing using selenium RC. I have generated script by recording in IDE, saved and exported as java script. Can any one explain how to use the script in RC/eclipse/java and run the test by feeding data from xls/text file and get the results back to xls/text file... Thanks in advance, Mahesh
|
|
|
RE: Data Driven test with SeleniumHi Mahesh,
You can use ADODB for data driven testing. I am using Ruby and Selenium RC. I developed scripts in ruby using ADODB for Data Driven testing. Its working fine. You try to create ADODB connection using Java Script. Regards, Boomi.
|
|
|
RE: Data Driven test with SeleniumHi Boomi,
Thanks for your response. I could do datadriven testing using Selenium RC and eclipse in java. Its working now. But the thing is I need to test this for multiple websites parallely. (e.g. by running test, selenium should open two IE browsers parallely as against existing test opening only one browser) Can this be possible with RC?? anyone can help me... Thanks, Mahesh
|
|
|
Re: Data Driven test with Seleniumthanks for sharing this.
thanks. |
|
|
Re: Data Driven test with SeleniumHi All, I have created a tutorial on Data Driven testing using Selenium & TestNG in the Eclipse environment on my blog. I have described a very simple but very powerful way of storing & retrieving test data from excel files and and linking them to the test logic in your java test class file. The example given is self containing and very easy to follow. I have used this approach to automate close to 1000 test cases so far. Cheers |
| Free embeddable forum powered by Nabble | Forum Help |