tag:blogger.com,1999:blog-31095500500420447832024-03-27T21:19:44.446-07:00Selenium resourceMake Selenium simplifiedAnonymoushttp://www.blogger.com/profile/06139552061114183892noreply@blogger.comBlogger13125tag:blogger.com,1999:blog-3109550050042044783.post-29897825546695838972012-10-05T06:16:00.001-07:002012-10-05T06:16:35.677-07:00Sending Attachment Mail using Java<div dir="ltr" style="text-align: left;" trbidi="on">
import java.util.Properties;<br /><br />import javax.activation.DataHandler;<br />import javax.activation.DataSource;<br />import javax.activation.FileDataSource;<br />import javax.mail.BodyPart;<br />import javax.mail.Message;<br />import javax.mail.MessagingException;<br />import javax.mail.Multipart;<br />import javax.mail.SendFailedException;<br />import javax.mail.Session;<br />import javax.mail.Transport;<br />import javax.mail.internet.InternetAddress;<br />import javax.mail.internet.MimeBodyPart;<br />import javax.mail.internet.MimeMessage;<br />import javax.mail.internet.MimeMultipart;<br /><br /><br />public class SendAttachMail {<br /> public static void main(String[] args) throws MessagingException {<br /> SendAttachMail s = new SendAttachMail();<br /> <br /> }<br /><br /> public SendAttachMail() throws MessagingException {<br /><br /> String host = "smtp.gmail.com";<br /> /***<br /> * Here you need to give password<br /> */<br /> String Password = "xxxxxxxxxxx";<br /> <br /> <br /> String from = "xxxxxxxxxxxxxxxxxxxxxxx";<br /> String toAddress = "xxxxxxxxxxxxxxxxxxxxx";<br /> //Need to give file path<br /> String filename = "F:/ex/RealUsage/build.xml";<br /> // Get system properties<br /> Properties props = System.getProperties();<br /> props.put("mail.smtp.host", host);<br /> props.put("mail.smtps.auth", "true");<br /> props.put("mail.smtp.starttls.enable", "true");<br /> Session session = Session.getInstance(props, null);<br /><br /> MimeMessage message = new MimeMessage(session);<br /><br /> message.setFrom(new InternetAddress(from));<br /><br /> message.setRecipients(Message.RecipientType.TO, toAddress);<br /><br /> message.setSubject("JavaMail Attachment");<br /><br /> BodyPart messageBodyPart = new MimeBodyPart();<br /><br /> messageBodyPart.setText("Here's the file");<br /><br /> Multipart multipart = new MimeMultipart();<br /><br /> multipart.addBodyPart(messageBodyPart);<br /><br /> messageBodyPart = new MimeBodyPart();<br /><br /> DataSource source = new FileDataSource(filename);<br /><br /> messageBodyPart.setDataHandler(new DataHandler(source));<br /><br /> messageBodyPart.setFileName(filename);<br /><br /> multipart.addBodyPart(messageBodyPart);<br /><br /> message.setContent(multipart);<br /><br /> try {<br /> Transport tr = session.getTransport("smtps");<br /> tr.connect(host, from, Password);<br /> tr.sendMessage(message, message.getAllRecipients());<br /> System.out.println("Mail Sent Successfully");<br /> tr.close();<br /><br /> } catch (SendFailedException sfe) {<br /><br /> System.out.println(sfe);<br /> }<br /> }<br /><br />}</div>
Anonymoushttp://www.blogger.com/profile/06139552061114183892noreply@blogger.com39tag:blogger.com,1999:blog-3109550050042044783.post-46106750425156169132012-10-05T06:15:00.000-07:002012-10-05T06:15:06.135-07:00SendingMail using Java<div dir="ltr" style="text-align: left;" trbidi="on">
import javax.mail.*;<br />import javax.mail.internet.InternetAddress;<br />import javax.mail.internet.MimeMessage;<br />import java.util.Date;<br />import java.util.Properties;<br /><br />public class GmailSendEmailSSL {<br /> public static final String USERNAME = "xxxxxxxxxxxxxxxx";<br /> public static final String PASSWORD = "xxxxxxxxxxxxxxxx";<br /><br /> public static void main(String[] args) throws Exception {<br /> //<br /> // Email information such as from, to, subject and contents.<br /> //<br /> String mailFrom = "xxxxxxxxxxxxxxxxxxxxxx";<br /> String mailTo = "xxxxxxxxxxxxxxxxxxxxxxxxxxx";<br /> String mailSubject = "TestReport";<br /> String mailText = "Please check enclosed TestReport";<br /><br /> GmailSendEmailSSL gmail = new GmailSendEmailSSL();<br /> gmail.sendMail(mailFrom, mailTo, mailSubject, mailText);<br /> }<br /><br /> private void sendMail(String mailFrom, String mailTo,<br /> String mailSubject, String mailText)<br /> throws Exception {<br /><br /> Properties config = createConfiguration();<br /><br /> //<br /> // Creates a mail session. We need to supply username and<br /> // password for Gmail authentication.<br /> //<br /> Session session = Session.getInstance(config, new Authenticator() {<br /> @Override<br /> protected PasswordAuthentication getPasswordAuthentication() {<br /> return new PasswordAuthentication(<br /> GmailSendEmailSSL.USERNAME,<br /> GmailSendEmailSSL.PASSWORD<br /> );<br /> }<br /> });<br /><br /> //<br /> // Creates email message<br /> //<br /> Message message = new MimeMessage(session);<br /> message.setSentDate(new Date());<br /> message.setFrom(new InternetAddress(mailFrom));<br /> message.setRecipient(Message.RecipientType.TO, new InternetAddress(mailTo));<br /> message.setSubject(mailSubject);<br /> message.setText(mailText);<br /><br /> //<br /> // Send a message<br /> //<br /> Transport.send(message);<br /> }<br /><br /> private Properties createConfiguration() {<br /> return new Properties() {{<br /> put("mail.smtp.host", "smtp.gmail.com");<br /> put("mail.smtp.auth", "true");<br /> put("mail.smtp.port", "465");<br /> put("mail.smtp.socketFactory.port", "465");<br /> put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");<br /> }};<br /> }<br />}<br /></div>
Anonymoushttp://www.blogger.com/profile/06139552061114183892noreply@blogger.com7tag:blogger.com,1999:blog-3109550050042044783.post-44777731705129468172012-09-28T23:51:00.000-07:002012-09-28T23:51:18.714-07:00Selenium Frameworks<div dir="ltr" style="text-align: left;" trbidi="on">
<h3 class="post-title entry-title" itemprop="name">
Types of Framework
</h3>
<div class="post-header">
</div>
Any framework is made up of a number of reusable modules & function
libraries that are developed with the following characteristics in mind:<br /><br /><span style="color: #3366ff;"><strong>Maintainable<br />Reusable<br />Manageable<br />Accessible<br />Robust<br />Flexibility<br />Measurable</strong></span><br />
<br />
<span style="color: #3366ff;"><strong>Frame work has several types and most popular are the below :<br /> </strong></span><br />
<span style="color: #3366ff;"><strong>Frame work has several types and most popular are the below :<br /><br />a.Keyword driven frame work<br />b.Data driven driven frame work<br />c.Hybrid framework<br /><br /><strong><span style="color: #3366ff;">Key word Driven Frame work :</span></strong><br /><br />Keyword driven framework is an action based test method used in planing and implementation of automation.<br /><br /><span style="color: #3366ff;"><strong>Data Driven Framework : </strong></span><br /><br />Data driven is the design of possible inputs what may be given by the end user.<br />This would cover maximum probabilities of an input data.<br />It can either be Spread sheet(excel)/sql/CSV.<br />We have to connect and pass the values to the respective field or element.<br />The
data should be designed by the experienced person on the project. It
may be a client or even non technical person but should be more familiar
from an end users prospective.<br />We have to map the file path properly.<br /><br /><strong><span style="color: #3366ff;">Hybrid Framework:</span></strong><br /><br />The Hybrid Automation Framework is otherwise referred to in the industry as a "Hybrid Keyword Data Driven Automation Framework".
</strong></span><br />
<br />
<span style="color: #3366ff;"><strong>Referal Sites</strong></span><br />
<br />
<span style="color: #3366ff;"><strong>http://www.gcrit.com/forums/viewtopic.php?f=29&t=109</strong></span><br />
<span style="color: #3366ff;"><strong><br />http://zomobo.net/keyword-driven<br /> </strong></span><br />
<span style="color: #3366ff;"><strong>http://www.youtube.com/watch?v=KL4Y7cWiK4g&feature=player_embedded <br /> </strong></span><br />
<span style="color: #3366ff;"><strong>http://www.youtube.com/watch?v=JMZeaF0ST4w&feature=channel<br /> </strong></span><br />
<span style="color: #3366ff;"><strong>http://www.youtube.com/watch?v=1ZV8pZAKkDQ&NR=1<br /> </strong></span><br />
<span style="color: #3366ff;"><strong>http://www.youtube.com/watch?v=A6ND9pRRBY8&NR=1<br /> </strong></span><br />
<span style="color: #3366ff;"><strong>http://www.whatsontv.co.uk/video/youtube/search/keyword-driven<br /> </strong> </span></div>
Anonymoushttp://www.blogger.com/profile/06139552061114183892noreply@blogger.com6tag:blogger.com,1999:blog-3109550050042044783.post-14691802407709381622012-09-28T21:07:00.000-07:002012-09-28T23:55:04.629-07:00Selenium Refereal sites<div dir="ltr" style="text-align: left;" trbidi="on">
<h3 style="text-align: left;">
<a href="http://www.mkyong.com/java/how-to-store-properties-into-xml-file/" target="_blank">http://www.mkyong.com/</a></h3>
<h3 style="text-align: left;">
<br /><br />http://whytotest.blogspot.in/2010/05/selenium-test-framework.html<br /><br />http://anoopjshetty.wordpress.com/2012/04/19/behaviour-driven-development-bdd-in-net-using-specflow-selenium-and-nunit/<br /><br />http://codedetective.blogspot.in/2011/11/setting-up-selenium-webdriver-using-c.html<br /><br />http://help.utest.com/testers/crash-courses/functional/automation-tools--selenium-102<br /><br />http://www.savevid.com/video/selenium-video-training-datadriven-framework-and-hybrid-framework-comparison.html<br /><br />http://testng.org/doc/index.html<br /><br />http://selenium-tutorial.blogspot.in/2012/04/uploading-file.html<br /><br />http://oxpedia.org/wiki/index.php?title=Automated_GUI_Tests<br /><br />http://xebee.xebia.in/2012/05/29/creating-automation-framework-using-selenium-and-test-ng-2/<br /><br />http://www.way2automation.com/selenium_tutorial/selenium-hybrid-datadriven-keyword-framework<br /><br />-tutorial.html<br /><br />http://www.seleniumwiki.com/selenium-rc/selenium-keyword-driven-framework/<br /><br /><br />http://executeautomation.com/blog/blog_mod/data-driven-testing-in-selenium-using-jxl-part-2/<br /><br />http://code.google.com/p/selenium/wiki/AdvancedUserInteractions<br /><br />http://www.kavinschool.com/content/selenium-tuition-bayarea/39-selenium-course/54-advanced-s<br /><br />elenium-using-java-language<br /><br />http://www.ijcst.com/vol23/1/prasanth.pdf<br /><br />http://code.google.com/p/selenium/wiki/PageFactory<br /><br />http://learnseleniumautomation.blogspot.in/2012/03/window-handle-example-with-selenium.html<br /><br />http://www.ibm.com/developerworks/web/library/wa-seleniumgrid/index.html<br /><br />http://www.8bitavenue.com/2012/03/gui-testing-using-sikuli-and-java/<br /><br />http://eureka.ykyuen.info/2010/06/26/selenium-integrate-the-selenium-tests-into-maven-build/<br /><br />http://www.way2automation.com/<br /><br />http://mearra.com/blogs/jani-palsamaki/creating-and-running-simple-selenium-webdriver-test<br /><br />http://code.google.com/p/selenium/wiki/SeleniumEmulation<br /><br />http://automation.youplayoff.com/category/selenium/<br /><br /><br />http://qaselenium.blogspot.in/2011/01/selenium-automation-framework-design.html<br /><br />http://seleniumexamples.com/blog/examples/selenium2-in-net-framework/<br /><br />http://robotframework-seleniumlibrary.googlecode.com/hg/doc/SeleniumLibrary.html?r=2.8<br /><br />https://blogs.oracle.com/rajeshthekkadath/<br /><br />http://en.wikipedia.org/wiki/Selenium_%28software%29<br /><br />http://www.f14testing.com/archives/1532<br /><br />http://functionaltestautomation.blogspot.in/2009/10/dataprovider-data-driven-testing-with.html<br /><br />http://www.javacodegeeks.com/2012/04/integration-testing-with-selenium.html<br /><br />http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/html5/package-summary.html<br /><br />http://sauceio.com/index.php/2011/12/selenium-testing-framework-part-3-putting-it-all-togeth<br /><br />er/<br /><br />http://selftechy.com/2011/06/02/parameterization-of-selenium-tests-with-microsoft-excel<br /><br />http://sauceio.com/index.php/2011/11/selenium-testing-framework-pt-2-base-classes/<br /><br />http://www.kavinschool.com/content/selenium-tuition-bayarea/39-selenium-course/54-advanced-s<br /><br />elenium-using-java-language<br /><br />http://hop2croft.wordpress.com/2011/09/17/spring-mvc-basic-example-with-maven/<br /><br />http://www.seleniumwiki.com/selenium-rc/selenium-rc-test-framework-using-xml-data-structure/<br /><br />http://marcovaltas.com/2009/02/19/running-selenium-with-testng.html<br /><br />http://blog.varunin.com/<br /><br />http://en.wikipedia.org/wiki/Data-driven_testing<br /><br />http://thangselenium.blogspot.in/<br /><br /><br />http://sqahome.blogspot.in/2010/06/selenium-framework-structure-java.html<br /><br />http://www.wallix.org/2011/07/26/how-to-use-robotframework-with-the-selenium-library/<br /><br />http://qtpselenium.com/selenium-tutorial/selenium-training-hybrid-framework/<br /><br />http://automationtestingsimplified.wordpress.com/2011/08/18/how-to-do-data-driven-testing-us<br /><br />ing-selenium-2-webdriver/<br /><br />http://wiki.zimbra.com/wiki/Testing:_Selenium:_ZimbraSelenium_SampleTestCase<br /><br />http://code.google.com/p/selenium/wiki/PageObjects<br /><br />http://marakana.com/bookshelf/selenium_tutorial/project.html<br /><br />http://in.linkedin.com/pub/selenium-rc-webdriver-tutorial/51/b7/49<br /><br />http://code.google.com/p/robotframework-seleniumlibrary/<br /><br />http://blog.codecentric.de/en/2010/07/file-downloads-with-selenium-mission-impossible/<br /><br />http://www.pushtotest.com/testing-with-selenium#tutorial<br /><br />http://seleniumrc.wordpress.com/<br /><br />http://qtp-help.blogspot.in/p/selenium-training.html<br /><br />http://www.seleniumtests.com/2012/01/selenium-2-methods-are-no-more-weird.html?utm_source=BP_recent<br /><br />http://candidjava.com/keyword-this-in-java-with-example-program<br /><br />https://github.com/Ardesco/Ebselen/blob/master/ebselen-core/src/main/java/com/lazerycode/ebselen/customhandlers/ExcelHandler.java<br /><br />http://shanmugavelc.blogspot.in/2010/09/datadriven-test-using-selenium-nunit.html<br /><br />http://vimeo.com/46412735<br /><br />http://computer.motiontopic.net/s/Selenium-Data-driven-framework<br /><br />Selenium Grid<br /><br />http://code.google.com/p/selenium/wiki/Grid2<br />http://deors.wordpress.com/2012/02/02/selenium-webdriver-grid-2/<br />http://technologyandleadership.com/30-feet-view-of-test-automation-framework-with-selenium/<br /><br />selenium with flash<br /><br />http://code.google.com/p/flash-selenium/<br /><br /><br />http://www.softwaretestingtutorials.org/packages/<br /><br /><br />selenium with ant<br /><br />http://hedleyproctor.com/2011/07/automating-selenium-testing-with-testng-ant-and-cruisecontrol/<br /><br /><br />selenium Index<br /><br />http://www.sqaforums.com/showflat.php?Cat=0&Number=716574&Main=714887<br /><br />http://www.citehr.com/374186-best-institute-learning-selenium-testing.html<br /><br />http://forum.softwaretestinghelp.com/index.php?topic=446.0<br /><br />http://grokbase.com/p/gg/selenium-users/125bve6d3m/is-anyone-provide-me-code-for-data-driven-testing-in-selenium-webdriver-in-java-junit-framework-plz-it-is-urgent<br /><br />http://ahmedabad.olx.in/selenium-training-in-ahmedabad-iid-249982843<br /><br /><br />http://www.automation.lifegoeasy.com/Selenium-Webdriver-Java-Syllabus<br /><br />http://seleniumtraining.weebly.com/selenium-automation.html<br /><br />http://www.360logica.com/test-automation-services/functional-automation-framework<br /><br /><br />Testng<br /><br />http://ravisha-selenium.blogspot.in/<br /><br />DataDriven framework<br /><br />http://executeautomation.com/blog/tag/data-driven-testing/<br /><br />http://functionaltestautomation.blogspot.in/2009/10/dataprovider-data-driven-testing-with.html<br /><br />http://qtpselenium.com/selenium-tutorial/selenium-training-data-driven-framework/<br /><br />http://automationtestingsimplified.wordpress.com/2011/08/18/how-to-do-data-driven-testing-using-selenium-2-webdriver/<br /><br />http://automationtestingsimplified.wordpress.com/2011/05/31/hybrid-testing-data-keyword-driven-using-selenium/<br /><br />http://www.softwaretestingclub.com/video/selenium-data-driven-automation-framework-selenium-rc-junit<br /><br />http://testerinyou.blogspot.in/2010/10/how-to-do-data-driven-testing-using.html<br /><br />http://www.seleniumelearn.com/free-selenium-training-tutorial-videos<br /><br />http://www.seleniumwebdriver.com/webdriver-tutorials/advance-selenium-rc-webdriver-tutorials-with-frameworks/msg16333/?PHPSESSID=b0af0d93c11942fedcc8c26d0ac04ec0#msg16333<br /><br />http://lrnselenium.com/?category_name=automation-framework<br /><br />http://selenium-suresh.blogspot.in/2012/07/data-driven-testing-using-selenium-rc_24.html<br /><br />http://hedleyproctor.com/2011/07/automating-selenium-testing-with-testng-ant-and-cruisecontrol/<br /><br />http://testingchronicle.blogspot.in/2012/05/selenium-keyword-driven-and-data-driven.html<br /><br />https://sites.google.com/site/joinqahub/Selenium-tutorial-for-beginners<br /><br />http://executeautomation.com/blog/blog_mod/data-driven-testing-in-selenium-using-jxl-part-2/<br /><br />http://www.gcrit.com/forums/viewtopic.php?f=29&t=109<br />http://zomobo.net/keyword-driven<br />http://www.youtube.com/watch?v=KL4Y7cWiK4g&feature=player_embedded <br />http://www.youtube.com/watch?v=JMZeaF0ST4w&feature=channel<br />http://www.youtube.com/watch?v=1ZV8pZAKkDQ&NR=1<br />http://www.youtube.com/watch?v=A6ND9pRRBY8&NR=1<br />http://www.whatsontv.co.uk/video/youtube/search/keyword-driven<br /> </h3>
</div>
Anonymoushttp://www.blogger.com/profile/06139552061114183892noreply@blogger.com122tag:blogger.com,1999:blog-3109550050042044783.post-71423029593428169972012-09-20T22:06:00.001-07:002012-09-20T23:07:17.570-07:00Reading and Writing CSV Formated Data<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
Reading/Writing an excel document like you requested, you can use the CSV format </h2>
<pre class="lang-java prettyprint"><code><span class="kwd">
</span><span class="pun"></span><span style="font-family: Times,"Times New Roman",serif;"><span class="pln"></span></span></code></pre>
<h4 class="lang-java prettyprint" style="text-align: left;">
<code><span style="font-family: Verdana,sans-serif;"><span class="kwd">import</span><span class="pln"> java</span><span class="pun">.</span><span class="pln">io</span><span class="pun">.</span><span class="typ">BufferedReader</span><span class="pun">;</span><span class="pln"><br /></span><span class="kwd">import</span><span class="pln"> java</span><span class="pun">.</span><span class="pln">io</span><span class="pun">.</span><span class="typ">FileReader</span><span class="pun">;</span><span class="pln"><br /></span><span class="kwd">import</span><span class="pln"> java</span><span class="pun">.</span><span class="pln">io</span><span class="pun">.</span><span class="typ">FileWriter</span><span class="pun">;</span><span class="pln"><br /></span><span class="kwd">import</span><span class="pln"> java</span><span class="pun">.</span><span class="pln">io</span><span class="pun">.</span><span class="typ">IOException</span><span class="pun">;</span><span class="pln"><br /></span><span class="kwd">import</span><span class="pln"> java</span><span class="pun">.</span><span class="pln">io</span><span class="pun">.</span><span class="typ">PrintWriter</span><span class="pun">;</span><span class="pln"><br /></span><span class="kwd">import</span><span class="pln"> java</span><span class="pun">.</span><span class="pln">util</span><span class="pun">.</span><span class="typ">Scanner</span><span class="pun">;</span><span class="pln"><br /></span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">class</span><span class="pln"> </span><span class="typ">CsvWriter</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br /> </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">static</span><span class="pln"> </span><span class="kwd">void</span><span class="pln"> main</span><span class="pun">(</span><span class="typ">String</span><span class="pln"> args</span><span class="pun">[])</span><span class="pln"> </span><span class="kwd">throws</span><span class="pln"> </span><span class="typ">IOException</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br /><br /> </span><span class="typ">String</span><span class="pln"> fileName </span><span class="pun">=</span><span class="pln"> </span><span class="str">"test.xls"</span><span class="pun">;</span><span class="pln"><br /><br /> </span><span class="typ">PrintWriter</span><span class="pln"> out </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">PrintWriter</span><span class="pun">(</span><span class="kwd">new</span><span class="pln"> </span><span class="typ">FileWriter</span><span class="pun">(</span><span class="pln">fileName</span><span class="pun">));</span><span class="pln"><br /> out</span><span class="pun">.</span><span class="pln">println</span><span class="pun">(</span><span class="str">"a,b,c,d"</span><span class="pun">);</span><span class="pln"><br /> out</span><span class="pun">.</span><span class="pln">println</span><span class="pun">(</span><span class="str">"e,f,g,h"</span><span class="pun">);</span><span class="pln"><br /> out</span><span class="pun">.</span><span class="pln">println</span><span class="pun">(</span><span class="str">"i,j,k,l"</span><span class="pun">);</span><span class="pln"><br /> out</span><span class="pun">.</span><span class="pln">close</span><span class="pun">();</span><span class="pln"><br /><br /> </span><span class="typ">BufferedReader</span><span class="pln"> in </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">BufferedReader</span><span class="pun">(</span><span class="kwd">new</span><span class="pln"> </span><span class="typ">FileReader</span><span class="pun">(</span><span class="pln">fileName</span><span class="pun">));</span><span class="pln"><br /> </span><span class="typ">String</span><span class="pln"> line </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">null</span><span class="pun">;</span><span class="pln"><br /> </span><span class="kwd">while</span><span class="pln"> </span><span class="pun">((</span><span class="pln">line </span><span class="pun">=</span><span class="pln"> in</span><span class="pun">.</span><span class="pln">readLine</span><span class="pun">())</span><span class="pln"> </span><span class="pun">!=</span><span class="pln"> </span><span class="kwd">null</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br /><br /> </span><span class="typ">Scanner</span><span class="pln"> scanner </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Scanner</span><span class="pun">(</span><span class="pln">line</span><span class="pun">);</span><span class="pln"><br /> </span><span class="typ">String</span><span class="pln"> sep </span><span class="pun">=</span><span class="pln"> </span><span class="str">""</span><span class="pun">;</span><span class="pln"><br /> </span><span class="kwd">while</span><span class="pln"> </span><span class="pun">(</span><span class="pln">scanner</span><span class="pun">.</span><span class="pln">hasNext</span><span class="pun">())</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br /> </span><span class="typ">System</span><span class="pun">.</span><span class="pln">out</span><span class="pun">.</span><span class="pln">println</span><span class="pun">(</span><span class="pln">sep </span><span class="pun">+</span><span class="pln"> scanner</span><span class="pun">.</span><span class="pln">next</span><span class="pun">());</span><span class="pln"><br /> sep </span><span class="pun">=</span><span class="pln"> </span><span class="str">","</span><span class="pun">;</span><span class="pln"><br /> </span><span class="pun">}</span><span class="pln"><br /> </span><span class="pun">}</span><span class="pln"><br /> in</span><span class="pun">.</span><span class="pln">close</span><span class="pun">();</span><span class="pln"><br /> </span><span class="pun">}</span><span class="pln"><br /></span><span class="pun">}</span></span><span class="pln"><br /></span></code></h4>
</div>
Anonymoushttp://www.blogger.com/profile/06139552061114183892noreply@blogger.com2tag:blogger.com,1999:blog-3109550050042044783.post-39705255418509380612012-09-19T21:14:00.001-07:002012-09-19T21:17:18.350-07:00Testing Interview Questions<div dir="ltr" style="text-align: left;" trbidi="on">
<h2>
Difference between Performance Testing, Load Testing and Stress Testing</h2>
<h4 style="text-align: left;">
<strong>Performance testing -</strong> It is performed to evaluate the
performance of components of a particular system in a specific
situation. It very wide term. It includes: Load Testing, Stress Testing,
capacity testing, volume testing, endurance testing, spike testing,
scalability testing and reliability testing etc. This type of testing
generally does not give pass or fail. It is basically done to set the
benchmark & standard of the application against Concurrency /
Throughput, Server response time, Latency, Render response time etc. In
other words, you can say it is technical & formal evaluation for
responsiveness, speed, scalability and stability characteristics.</h4>
<h4 style="text-align: left;">
</h4>
<h4>
<strong>Load Testing</strong> is subset of performance testing. It is
done by constantly increasing the load on the application under test
till the time it reaches the threshold limit. The main goal of load
testing is to identify the upper limit of the system in terms of
database, hardware and network etc. The common goal of doing the load
testing is to set the SLAs for the application. Example of load testing
can be:</h4>
<h4>
Running multiple applications on a computer simultaneously -
starting with one application, then start second application, then
third and so on....Now see the performance of your computer.</h4>
<h4 style="text-align: left;">
Endurance
test is also a part of load testing which used to calculate metrics
like Mean Time Between Failure and Mean Time to Failure.</h4>
<h4>
Load Testing helps to determine:</h4>
<h4>
Throughput</h4>
<h4>
Peak Production Load</h4>
<h4>
Adequacy of H/W environment</h4>
<h4>
Load balancing requirements</h4>
<h4>
How many users application can handle with optimal performance results</h4>
<h4>
How many users hardware can handle with optimal performance results</h4>
<h4>
<strong>Stress testing -</strong> It is done to evaluate the
application's behaviour beyond normal or peak load conditions. It is
basically testing the functionality of the application under high loads.
Normally these are related to synchronization issues, memory leaks or
race conditions etc. Some testing experts also call it as fatigue
testing. Sometimes, it becomes difficult to set up a controlled
environment before running the test. Example of Stress testing is:</h4>
<h4>
</h4>
<h4>
A banking application can take a maximum user load of 20000
concurrent users. Increase the load to 21000 and do some transaction
like deposit or withdraw. As soon as you did the transaction, banking
application server database will sync with ATM database server. Now
check with the user load of 21000 does this sync happened successfully.
Now repeat the same test with 22000 thousand concurrent users and so on.</h4>
<h4 style="text-align: left;">
Spike
test is also a part of stress testing which is performed when
application is loaded with heavy loads repeatedly and increase beyond
production operations for short duration.</h4>
<h4>
Stress Testing helps to determine:</h4>
<h4>
Errors in slowness & at peak user loads</h4>
<h4>
Any security loop holes with over loads</h4>
<h4>
How the hardware reacts with over loads</h4>
<h4>
Data corruption issues at over loads</h4>
<h4 style="text-align: left;">
</h4>
</div>
Anonymoushttp://www.blogger.com/profile/06139552061114183892noreply@blogger.com4tag:blogger.com,1999:blog-3109550050042044783.post-1464194022540524402012-09-19T21:10:00.001-07:002012-09-20T22:21:23.439-07:00Reading Data from excel file<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
How to read data from Excel file using Java</h2>
<h2 style="text-align: left;">
</h2>
<h3 style="text-align: left;">
</h3>
<h3>
<pre style="text-align: left;">import java.io.*;
import java.sql.*;
public class ExcelReadTest{
public static void main(String[] args){ </pre>
<pre style="text-align: left;"> Connection connection = null;
try{</pre>
<pre style="text-align: left;"> Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection( "jdbc:odbc:exceltest" );</pre>
<pre style="text-align: left;"> Statement st = con.createStatement();
ResultSet rs = st.executeQuery( "Select * from [Sheet1$]" );
ResultSetMetaData rsmd = rs.getMetaData();
int numberOfColumns = rsmd.getColumnCount();
while (rs.next()) {
for (int i = 1; i <= numberOfColumns; i++) {
if (i > 1) System.out.print(", ");
String columnValue = rs.getString(i);
System.out.print(columnValue);
} </pre>
<pre style="text-align: left;"> </pre>
<pre style="text-align: left;">System.out.println("");
}
st.close();
con.close();
}</pre>
<pre style="text-align: left;">catch(Exception ex) {
System.err.print("Exception: ");
System.err.println(ex.getMessage());
}
}
}</pre>
<pre style="text-align: left;"> </pre>
<pre style="text-align: left;"> </pre>
</h3>
<h3 style="text-align: left;">
OR </h3>
<h4 style="text-align: left;">
WorkbookSettings ws = <span class="keyword">new</span> WorkbookSettings(); </h4>
<h4 style="text-align: left;">
ws.setLocale(<span class="keyword">new</span> Locale(<span class="string">"en"</span>,<span class="string">"EN"</span>)); </h4>
<h4 style="text-align: left;">
Workbook workbook = Workbook.getWorkbook(file); </h4>
<h4 style="text-align: left;">
Sheet s = workbook.getSheet(<span class="number">0</span>); </h4>
<h4 style="text-align: left;">
LabelCell lcdate = s.findLabelCell(<span class="string">"Date"</span>); </h4>
<h4 style="text-align: left;">
LabelCell lcitem = s.findLabelCell(<span class="string">"Item"</span>); </h4>
<h4 style="text-align: left;">
LabelCell lcamount = s.findLabelCell(<span class="string">"Amount"</span>); </h4>
<h4 style="text-align: left;">
LabelCell lctype = s.findLabelCell(<span class="string">"Type"</span>); <span class="keyword"> </span></h4>
<h4 style="text-align: left;">
<span class="keyword">int</span> columns = s.getColumns(); </h4>
<h4 style="text-align: left;">
<span class="keyword">int</span> rows = s.getRows(); </h4>
<h4 style="text-align: left;">
System.out.println(<span class="string">"col -->>> "</span>+columns+<span class="string">" rows -->>> "</span>+rows); </h4>
<h4 style="text-align: left;">
<br /><span class="postbody"></span></h4>
<h4 style="text-align: left;">
To print the data</h4>
<h4 style="text-align: left;">
<br /><span class="postbody"></span></h4>
<h4 style="text-align: left;">
String data; </h4>
<h4 style="text-align: left;">
<span class="keyword">for</span>(<span class="keyword">int</span> col = <span class="number">0</span>;col < columns;col++) { <span class="keyword">for</span>(<span class="keyword">int</span> row = <span class="number">0</span>;row < rows;row++) { data = s.getCell(col, row).getContents(); </h4>
<h4 style="text-align: left;">
<span class="comment">// Code to display ....</span> </h4>
<h4 style="text-align: left;">
} </h4>
<h4 style="text-align: left;">
</h4>
<h4 style="text-align: left;">
</h4>
<h4 style="text-align: left;">
</h4>
<h4 style="text-align: left;">
</h4>
<h4 style="text-align: left;">
<span class="postbody">(OR)</span></h4>
<h4 style="text-align: left;">
<span class="postbody"> </span></h4>
<h4 style="text-align: left;">
<span class="postbody"> </span></h4>
<h4 style="text-align: left;">
<span class="postbody">Navigate to this url's</span></h4>
<h4 style="text-align: left;">
<a href="http://poi.apache.org/index.html" target="_blank"><span class="postbody">http://poi.apache.org/index.html </span></a></h4>
<h4 style="text-align: left;">
<span class="postbody"> </span><a href="http://www.coderanch.com/t/465901/JDBC/databases/insert-data-excel-file-java" target="_blank">http://www.coderanch.com/t/465901/JDBC/databases/insert-data-excel-file-java</a></h4>
<h4 style="text-align: left;">
<span class="postbody"><a href="http://www.ibm.com/developerworks/library/x-jxmlexl/index.html">http://www.ibm.com/developerworks/library/x-jxmlexl/index.html</a> </span></h4>
<h4 style="text-align: left;">
<span class="postbody"><a href="http://www.avajava.com/tutorials/lessons/how-do-i-read-from-an-excel-file-using-poi.html?page=1" target="_blank">http://www.avajava.com/tutorials/lessons/how-do-i-read-from-an-excel-file-using-poi.html?page=1</a> </span></h4>
<h4 style="text-align: left;">
<span class="postbody"><a href="http://mrbool.com/reading-excel-file-with-java/24562" target="_blank">http://mrbool.com/reading-excel-file-with-java/24562</a> </span></h4>
<h4 style="text-align: left;">
<span class="postbody"></span></h4>
<h3 style="text-align: left;">
</h3>
</div>
Anonymoushttp://www.blogger.com/profile/06139552061114183892noreply@blogger.com14tag:blogger.com,1999:blog-3109550050042044783.post-87454518047219233272012-09-13T00:14:00.000-07:002012-10-12T11:01:49.349-07:00<div dir="ltr" style="text-align: left;" trbidi="on">
<h3 style="text-align: left;">
How do you make Selenium wait for the page to load in Selenium 2.0?</h3>
<h4>
<code><span class="com">// Sleep until the div we want is visible or 5 seconds is over</span><span class="pln"></span></code></h4>
<h4 style="text-align: left;">
<code><span class="pln"></span></code></h4>
<h4 class="lang-java prettyprint" style="text-align: left;">
<code><span class="kwd">long</span><span class="pln"> end </span><span class="pun">=</span><span class="pln"> </span><span class="typ">System</span><span class="pun">.</span><span class="pln">currentTimeMillis</span><span class="pun">()</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> </span><span class="lit">5000</span><span class="pun">;</span><span class="pln"><br /></span><span class="kwd">while</span><span class="pln"> </span><span class="pun">(</span><span class="typ">System</span><span class="pun">.</span><span class="pln">currentTimeMillis</span><span class="pun">()</span><span class="pln"> </span><span class="pun"><</span><span class="pln"> end</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br /> </span><span class="com">// Browsers which render content (such as Firefox and IE) return "RenderedWebElements"</span><span class="pln"><br /> </span><span class="typ">RenderedWebElement</span><span class="pln"> resultsDiv </span><span class="pun">=</span><span class="pln"> </span><span class="pun">(</span><span class="typ">RenderedWebElement</span><span class="pun">)</span><span class="pln"> driver</span><span class="pun">.</span><span class="pln">findElement</span><span class="pun">(</span><span class="typ">By</span><span class="pun">.</span><span class="pln">className</span><span class="pun">(</span><span class="str">"gac_m"</span><span class="pun">));</span><span class="pln"><br /><br /> </span><span class="com">// If results have been returned, the results are displayed in a drop down.</span><span class="pln"><br /> </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">resultsDiv</span><span class="pun">.</span><span class="pln">isDisplayed</span><span class="pun">())</span><span class="pln"> </span><span class="pun">{</span><span class="pln"><br /> </span><span class="kwd">break</span><span class="pun">;</span><span class="pln"><br /> </span><span class="pun">}</span><span class="pln"><br /></span><span class="pun">}</span><span class="pln"><br /></span></code></h4>
<h3 style="text-align: left;">
</h3>
<h3 style="text-align: left;">
(or)</h3>
<h3 class="lang-java prettyprint" style="text-align: left;">
<code><span class="pln">driver</span><span class="pun">.</span><span class="pln">manage</span><span class="pun">().</span><span class="pln">timeouts</span><span class="pun">().</span><span class="pln">implicitlyWait</span><span class="pun">(</span><span class="lit">10</span><span class="pun">,</span><span class="pln"> </span><span class="typ">TimeUnit</span><span class="pun">.</span><span class="pln">SECONDS</span><span class="pun">);</span></code></h3>
<h3 class="lang-java prettyprint" style="text-align: left;">
<code><span class="pun"> </span></code></h3>
<h3 class="lang-java prettyprint" style="text-align: left;">
<code><span class="pun">How to Take a screenshot using Selenium WebDriver?</span></code></h3>
<h3 class="lang-java prettyprint" style="text-align: left;">
<code><span class="typ">WebDriver</span><span class="pln"> driver </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">FirefoxDriver</span><span class="pun">();</span><span class="pln"><br />driver</span><span class="pun">.</span><span class="pln">get</span><span class="pun">(</span><span class="str">"http://www.google.com/"</span><span class="pun">);</span><span class="pln"><br /></span><span class="typ">File</span><span class="pln"> scrFile </span><span class="pun">=</span><span class="pln"> </span><span class="pun">((</span><span class="typ">TakesScreenshot</span><span class="pun">)</span><span class="pln">driver</span><span class="pun">).</span><span class="pln">getScreenshotAs</span><span class="pun">(</span><span class="typ">OutputType</span><span class="pun">.</span><span class="pln">FILE</span><span class="pun">);</span><span class="pln"><br /></span><span class="com">// Now you can do whatever you need to do with it, for example copy somewhere</span><span class="pln"><br /></span><span class="typ">FileUtils</span><span class="pun">.</span><span class="pln">copyFile</span><span class="pun">(</span><span class="pln">scrFile</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">File</span><span class="pun">(</span><span class="str">"c:\\tmp\\screenshot.png"</span><span class="pun">));</span></code></h3>
<h3 style="text-align: left;">
</h3>
<h3 style="text-align: left;">
How to stop the selenium server until a popup opens? </h3>
<h3 style="text-align: left;">
<code>selenium.WaitForPopUp("id=popup_container", "30000");</code></h3>
<h3 style="text-align: left;">
<code> </code></h3>
<h3 style="text-align: left;">
<code>How to fetch data from table using Selenium WebDriver ?</code></h3>
<h3 style="text-align: left;">
<code><table>
<tbody>
<tr><td>data</td><th>data</th><td>data</td><td>data</td></tr>
<tr><td>data</td><th>data</th><td>data</td><td>data</td></tr>
<tr><td>data</td><th>data</th><td>data</td><td>data</td></tr>
</tbody>
</table></code></h3>
<h2 style="text-align: left;">
<code>// Grab the table </code></h2>
<h3 style="text-align: left;">
<code>WebElement table = driver.findElement(By.id(searchResultsGrid)); </code></h3>
<h2 style="text-align: left;">
<code> // Now get all the TR elements from the table</code></h2>
<h3 style="text-align: left;">
<code> List<WebElement> allRows = table.findElements(By.tagName("tr"));</code></h3>
<h2 style="text-align: left;">
<code> // And iterate over them, getting the cells </code></h2>
<h3 style="text-align: left;">
<code>for (WebElement row : allRows) { </code></h3>
<h3 style="text-align: left;">
<code> List<WebElement> cells = row.findElements(By.tagName("td")); </code></h3>
<h3 style="text-align: left;">
<code> for (WebElement cell : cells) { </code></h3>
<h3 style="text-align: left;">
<code> // so on </code></h3>
<h3 style="text-align: left;">
<code> } </code></h3>
<h3 style="text-align: left;">
<code>}</code></h3>
<h3 style="text-align: left;">
<code> </code></h3>
<h3 style="text-align: left;">
<code>// </code><code>List<WebElement> cells = row.findElements(By.xpath("./*"));</code></h3>
<h3 style="text-align: left;">
<code> </code></h3>
<h3 style="text-align: left;">
<code> </code></h3>
<h3 style="text-align: left;">
<code>Q) how to find out a text is available in current webpage using WebDriver ?</code></h3>
<h3 style="text-align: left;">
<code>import org.openqa.selenium.firefox.FirefoxDriver;<br />import com.thoughtworks.selenium.*; </code></h3>
<h3 style="text-align: left;">
<code>import org.openqa.selenium.WebDriver;<br />import org.openqa.selenium.WebDriverBackedSelenium; </code></h3>
<h3 style="text-align: left;">
<code>public class SearchingText {<br /><br /> static WebDriver driver = new FirefoxDriver();<br /> static Selenium selenium = new WebDriverBackedSelenium(driver, "http://");</code></h3>
<h3 style="text-align: left;">
<code><br /> public static void find(){</code></h3>
<h3 style="text-align: left;">
<code><br /> driver.get("http://google.com");<br /> boolean b =driver.getPageSource().contains("Telugu");<br /> System.out.println(b);<br /> driver.quit();<br /> </code></h3>
<h3 style="text-align: left;">
<code> }<br /> </code></h3>
<h3 style="text-align: left;">
<code> public static void main(String[] args) {<br /> </code></h3>
<h3 style="text-align: left;">
<code> find();<br /> }<br /> } </code></h3>
<h3 style="text-align: left;">
<code> </code></h3>
<h3 class="post-title entry-title">
How to automate onblur through selenium RC </h3>
<div class="post-title entry-title" style="text-align: left;">
How to automate onblur through selenium RC .<br />
How to automate lost focus through selenium.<br />
<br />
<br />
I faced the problem while automating the form submit. All of the form fields are having some action on their lost focus. <br />
The onblur event occurs when an object loses focus. <br />
For example : I have two fields First Name and Last Name. When i enter
first name and press tab then it loses its focus and onblur function
gets called.<br />
and its calls upperCase and it changes the first name in Upper case.<br />
the same case with Last Name. When i enter last name and press tab it
calls blur function lowerCase and changes the letters in lower case.<br />
<br />
But the problem in automation is i cant automate lost focus. when we
type in first name and last name it simply types in first name and last
name text box.<br />
It does not call onblur function upper case and lower case and does not change the letter respectively.<br />
<br />
so, <b>fireEvent</b> is a special command in selenium which helps in automating onblur function.<br />
<br />
this is html of the element and blur javascript functions </div>
<div class="post-title entry-title" style="text-align: left;">
<br /></div>
<h3 style="text-align: left;">
<code> <html><br /><head><br /><script type="text/javascript"><br />function upperCase()<br />{<br />var x=document.getElementById("fname").value;<br />document.getElementById("fname").value=x.toUpperCase();<br />}<br />function lowerCase()<br />{<br />var x=document.getElementById("lname").value;<br />document.getElementById("lname").value=x.toLowerCase();<br />}<br /></script><br /></head><br /><body><br />Enter your First Name: <input type="text" id="fname" onblur="upperCase()" /><br /><br /><br />Enter your Last Nast: <input type="text" id="lname" onblur="lowerCase()" /><br /></body><br /></html></code></h3>
<h3 style="text-align: left;">
<code> </code></h3>
<h3 style="text-align: left;">
<code> selenium.type("fname", "ramesh");<br /> selenium.fireEvent("fname", "blur");<br /> selenium.type("lname", "reddy");<br /> selenium.fireEvent("lname", "blur");</code></h3>
<h3 style="text-align: left;">
<code>How this works is :<br />
<br />
First this will type "ramesh" in First Name and then
selenium.fireEvent("fname", "blur"); this will call the onblur fuction
"upperCase()" which changes the First Name in upper case "ramesh".<br />
then it types in Last Name and then selenium.fireEvent("lname", "blur");
which means it will press tab and lost the function and on the lost
focus it calls <br />
blur function lowerCase which changes the Last Name in lower case. </code></h3>
<h3 style="text-align: left;">
<code> </code></h3>
<h3 style="text-align: left;">
</h3>
<h2 class="post-title entry-title" style="text-align: left;">
<span style="color: #999999;">Running test case in multiple browsers parallely in WebDriver</span></h2>
<div class="post-title entry-title" style="text-align: left;">
<span style="color: #999999;"> </span>we can run test script in different browsers parallely using web driver. <span class="IL_AD" id="IL_AD9">Write one</span> test script and <span class="IL_AD" id="IL_AD7">configure</span> in testng xml to run that test case in IE, firefox and chrome parallely.</div>
<div class="post-title entry-title" style="text-align: left;">
<br /></div>
<div class="post-title entry-title" style="text-align: left;">
<br />import org.openqa.selenium.By;<br />import org.openqa.selenium.WebDriver;<br />import org.openqa.selenium.WebElement;<br />import org.openqa.selenium.chrome.ChromeDriver;<br />import org.openqa.selenium.firefox.FirefoxDriver;<br />import org.openqa.selenium.htmlunit.HtmlUnitDriver;<br />import org.openqa.selenium.ie.InternetExplorerDriver;<br />import org.testng.Assert;<br />import org.testng.annotations.BeforeTest;<br />import org.testng.annotations.Parameters;<br />import org.testng.annotations.Test;<br /><br />public class ParallelRunning {<br /><br /> private WebDriver driver=null;<br /> @BeforeTest<br /> @Parameters ({"BROWSER"})<br /> public void setup(String BROWSER){<br /> System.out.println("Browser: " + BROWSER);<br /><br /> if (BROWSER.equals("FF")) {<br /> System.out.println("FF is selected");<br /> driver = new FirefoxDriver();<br /> } else if (BROWSER.equals("IE")) {<br /> System.out.println("IE is selected");<br /> driver = new InternetExplorerDriver();<br /> } else if (BROWSER.equals("HU")) {<br /> System.out.println("HU is selected");<br /> driver = new HtmlUnitDriver();<br /> } else if (BROWSER.equals("CH")){<br /> System.out.println("Google chrome is selected");<br /> driver = new ChromeDriver();<br /> }<br /> }<br /><br /> @Test<br /> public void testParallel()throws Exception{<br /><br /> driver.get("http://www.google.com");<br /> Thread.sleep(5000);<br /> WebElement search = driver.findElement(By.name("q"));<br /> search.sendKeys("automation by ramesh");<br /> search.submit();<br /> Thread.sleep(5000);<br /> Assert.assertTrue(driver.getPageSource().contains("xxxxxxxxxxxxxxxxxxxxxxxxxxxx"));<br /> driver.findElement(By.xpath("//a[contains(@href,'seleniumresource.blogspot.com')]")).click();<br /> Thread.sleep(15000);<br /> Assert.assertTrue(driver.getPageSource().contains("working as Associate Manager @freelancher"));<br /> driver.quit();<br /><br /> }<br />}</div>
<div class="post-title entry-title" style="text-align: left;">
</div>
<div class="post-title entry-title" style="text-align: left;">
</div>
<div class="post-title entry-title" style="text-align: left;">
In the above <span class="IL_AD" id="IL_AD4">sample program</span> BROWSER is a variable which value would be passed from TestNG.xml and TestNG.xml will run the test multiple time each time BROWSER value would be set with different browser name and test will check the BROWSER value and decide which browser test will run.<br />
<b></b></div>
<div class="post-title entry-title" style="text-align: left;">
<b></b></div>
<div class="post-title entry-title" style="text-align: left;">
<b></b></div>
<div class="post-title entry-title" style="text-align: left;">
<b></b></div>
<div class="post-title entry-title" style="text-align: left;">
<b></b></div>
<div class="post-title entry-title" style="text-align: left;">
<br /><b>TestNG.xml</b></div>
<div class="post-title entry-title" style="text-align: left;">
<br /></div>
<div class="post-title entry-title" style="text-align: left;">
<b><?xml version="1.0" encoding="UTF-8"?><br /><suite name="webDriver" parallel="tests"><br /> <test name="WebDriverDemo Witn FF" preserve-order="true"><br /> <parameter name="BROWSER" value="FF" /><br /> <classes><br /> <class name="com.freelancher.ParallelRunning" /><br /> </classes><br /> </test><br /> <test name="WebDriverDemo with IE" preserve-order="ture"><br /> <parameter name="BROWSER" value="IE"></parameter><br /> <classes><br /> <class name="com.freelancher.ParallelRunning"></class><br /> </classes><br /> </test><br /><br /> <test name="WebDriverDemo with HTML unit" preserve-order="true"><br /> <parameter name="BROWSER" value="HU"></parameter><br /> <classes><br /> <class name="com.freelancher.ParallelRunning"></class><br /> </classes><br /> </test><br /><br /> <test name="WebDriverDemo with HTML unit" preserve-order="true"><br /> <parameter name="BROWSER" value="CH"></parameter><br /> <classes><br /> <class name="com.freelancher.ParallelRunning"></class><br /> </classes><br /> </test><br /></suite></b> </div>
<div class="post-title entry-title" style="text-align: left;">
<b><br /> </b></div>
<h3 style="text-align: left;">
</h3>
<h2 class="date-header">
<span></span></h2>
<div class="date-posts">
<div class="post-outer">
<div class="post hentry">
<b><a href="http://www.blogger.com/blogger.g?blogID=3109550050042044783" name="6665707503065744653"></a></b>
<h3 class="post-title entry-title">
<a href="http://www.blogger.com/blogger.g?blogID=3109550050042044783#editor/target=post;postID=8745451804721923327" target="_blank">How to verify the text ignoring cases sensitivity in selenium ?</a></h3>
</div>
</div>
</div>
<h3 class="lang-java prettyprint" style="text-align: left;">
<code><span class="pun">How to verify the text ignoring cases sensitivity in selenium ?<br />
<br />
Some times we need to verify the text on the webpage no matter is upper cases or lower cases or proper.<br />
We just need to verify the text on the web page ignoring their cases sensitivity. <br />
REGEXPI is used to avoid cases sensitive to verify the text on the page.<br />
<br />
Lets say i want to verify the text "seleniumresource is good blog for selenium" No matter its in upper cases or lower case or proper case.<br />
<br />
Then use REGEXPI in selenium command selenium.isTextPresent or verifyTextPres</span></code></h3>
<h3 class="lang-java prettyprint" style="text-align: left;">
<code><span class="pun">verifyTrue(selenium.isTextPresent("regexpi:SELENIUMRESOURCE IS GOOD BLOG FOR SELENIUM"));<br /><br />verifyTrue(selenium.isTextPresent("regexpi:</span></code></h3>
<h3 class="lang-java prettyprint" style="text-align: left;">
<code><span class="pun">SELENIUMRESOURCE is good blog for selenium"));<br /><br />verifyTrue(selenium.isTextPresent("regexpi:SELENIUMRESOURCE Is GoOd Blog for SELENIUM"));<br /><br />verifyTrue(selenium.isTextPresent("regexpi:SELENIUMRESOURCE is good blog for selenium")); </span></code></h3>
<h3 class="lang-java prettyprint" style="text-align: left;">
<code><span class="pun"> </span><span class="pln"><br /></span></code></h3>
<h3 class="lang-java prettyprint" style="text-align: left;">
<code><span class="pun"> </span><span class="pln"></span></code></h3>
<h3 style="text-align: left;">
</h3>
<h3 style="text-align: left;">
</h3>
</div>
Anonymoushttp://www.blogger.com/profile/06139552061114183892noreply@blogger.com0tag:blogger.com,1999:blog-3109550050042044783.post-50632533201795723092012-09-12T04:56:00.001-07:002012-09-12T04:56:32.082-07:00Designing Test Automation Framework with Selenium<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 class="entry-title" style="text-align: left;">
Designing Test Automation Framework with Selenium</h2>
<h2 class="entry-title" style="text-align: left;">
</h2>
<h3 style="text-align: left;">
Do we need to go for Test Automation? If yes, then which is the tool?
If we straight away start automating test cases what are all the
technical challenges we might face? Do we need a framework for
Automation? How we go about designing a framework?</h3>
<h3 style="text-align: left;">
These are all the questions popup when we want to start Test
Automation. Okay, let us start exploring answers for the above
questions.</h3>
<h3 style="text-align: left;">
If there are hundreds of test scenarios which needs to be executed on
each build then it will be a tedious task and error prone. Because a
Test Engineer might make mistakes while entering the test data and
output might be wrong. We can avoid such situations by automating the
test cases.</h3>
<h3 style="text-align: left;">
Before selecting a tool for Test Automation, we need to analyze the
technologies used for different UI components. For example, Java Swing
components, Telerik controls, ExtJS tables, Ajax, Silver light, Flex /
Flash controls, etc. If we want to use Selenium as Test Automation tool
then the first and foremost thing needs to be checked is whether the
application is a Web Application. If so, then check whether most of the
UI controls are identified by the Selenium. If more than 70% of the test
cases can be automated then definitely we can go ahead and automate the
test cases.</h3>
<h3 style="text-align: left;">
In order to handle large number of test cases we need to have a clear
cut strategy for designing the framework. Some of the framework functionalists can be mentioned as follows:</h3>
<ol style="text-align: left;">
<li><h3>
If there is any unhandled exception, then the execution should not
stop. Particular test scenario should be stopped and continue with the
next scenario.</h3>
</li>
<li><h3>
Screen shots must be taken for each error so that analyzing the failures should be easy.</h3>
</li>
<li><h3>
Proper exception handling should be done in the framework.</h3>
</li>
<li><h3>
Proper naming convention should be used</h3>
</li>
<li><h3>
Avoid hard coding test data</h3>
</li>
<li><h3>
Test Data should be parametrized using external means such as XML s, Database, Spreadsheet, etc. </h3>
</li>
<li><h3>
Logs should be created that makes life easier while analyzing the Test Execution</h3>
</li>
<li><h3>
Proper folder structure should be created.</h3>
</li>
</ol>
<br />
<br />
<h3 style="text-align: left;">
Datadriven framework is used when there are test cases which run for
multiple sets of test data. Follow the below steps to create Data Driven
framework:</h3>
<h3 style="text-align: left;">
1. Create a folder structure inside the eclipse workspace. i.e. source files, test data, results, logs, error screenshots, etc<br />
2. Use J Unit / TestNG to write test scripts (automated test case) or
write your own Java code (run as Java application – need to have main
method)<br />
3. Parametrize the automated test cases and iterate them for all the test data sets.</h3>
</div>
Anonymoushttp://www.blogger.com/profile/06139552061114183892noreply@blogger.com3tag:blogger.com,1999:blog-3109550050042044783.post-4709654697564271332012-09-11T23:27:00.000-07:002012-09-11T23:27:06.587-07:00Selenium WebDriver – Handling JavaScript Popups<div dir="ltr" style="text-align: left;" trbidi="on">
Selenium WebDriver – Handling JavaScript Popups<br />
<br />
public class HandlingPopup {<br />
<br />
static WebDriver driver = new FirefoxDriver();<br />
<br />
public static void Handle(){<br />
<br />
//switching focus to alert box<br />
Alert alert =driver.switchTo().alert();<br />
<br />
//Get text from the alert box<br />
System.out.println(alert.getText());<br />
<br />
//click on Ok<br />
<br />
alert.accept();<br />
<br />
//cancel the popup<br />
<br />
driver.quit();<br />
<br />
public static void main(String args[]){<br />
<br />
Handle();<br />
<br />
}<br />
} </div>
Anonymoushttp://www.blogger.com/profile/06139552061114183892noreply@blogger.com0tag:blogger.com,1999:blog-3109550050042044783.post-22172878284595167902012-09-11T13:21:00.001-07:002012-09-11T13:22:53.971-07:00selenium Interview Questions<div dir="ltr" style="text-align: left;" trbidi="on">
<h4 style="text-align: left;">
Q1. What is Selenium?</h4>
<h3 style="text-align: left;">
Ans. Selenium is a set of tools that supports rapid development of test automation scripts for web based applications. Selenium testing tools provides a rich set of testing functions specifically designed to fulfill needs of testing of a web based application.</h3>
<br />
<h4 style="text-align: left;">
Q2. What are the main components of Selenium testing tools?</h4>
<h3 style="text-align: left;">
Ans. Selenium IDE, Selenium RC and Selenium Grid</h3>
<h4 style="text-align: left;">
Q3. What is Selenium IDE?</h4>
<h3 style="text-align: left;">
Ans. Selenium IDE is for building Selenium test cases. It operates as a Mozilla Firefox add on and provides an easy to use interface for developing and running individual test cases or entire testsuites. Selenium-IDE has a recording feature, which will keep account of user actions as they are performed and store them as a reusable script to play back.</h3>
<h3 style="text-align: left;">
<br />Q4. What is the use of context menu in Selenium IDE?<br />Ans. It allows the user to pick from a list of assertions and verifications for the selected location.<br /> </h3>
<h3 style="text-align: left;">
Q5. Can tests recorded using Selenium IDE be run in other browsers?<br />Ans. Yes. Although Selenium IDE is a Firefox add on, however, tests created in it can also be runin other browsers by using Selenium RC (Selenium Remote Control) and specifying the name of the test suite in command line.<br /> </h3>
<h3 style="text-align: left;">
Q6. What are the advantage and features of Selenium IDE?<br /> Ans. 1. Intelligent field selection will use IDs, names, or X Path as needed2. It is a record & playback tool and the script format can be written in various languages including: C#, Java, PERL, Python, PHP, HTML3. Auto complete for all common Selenium commands4. Debug and set breakpoints5. Option to automatically assert the title of every page6. Support for Selenium user-extensions.js file<br /> </h3>
<h3 style="text-align: left;">
Q7. What are the disadvantage of Selenium IDE tool?<br />Ans. 1. Selenium IDE tool can only be used in Mozilla Firefox browser.2. It is not playing multiple windows when we record it.<br /> </h3>
<h3 style="text-align: left;">
Q8. What is Selenium RC (Remote Control)?<br />Ans. Selenium RC allows the test automation expert to use a programming language for maximum flexibility and extensibility in developing test logic. For example, if the application under test returns a result set and the automated test program needs to run tests on each element in the result set, the iteration / loop support of programming language can be used to iterate through the result set, calling Selenium commands to run tests on each item. Selenium RC provides an API and library for each of its supported languages. This ability to use Selenium RC with a high level programming language to develop test cases also allows the automated testing to be integrated with the projects automated build environment.<br /> </h3>
<h3 style="text-align: left;">
</h3>
<h3 style="text-align: left;">
Q9. What is Selenium Grid?<br /> Ans. Selenium Grid in the selenium testing suit allows the Selenium RC solution to scale for testsuites that must be run in multiple environments. Selenium Grid can be used to run multipleinstances of Selenium RC on various operating system and browser configurations.<br /> </h3>
<h3 style="text-align: left;">
. How Selenium Grid works?<br /> Ans. Selenium Grid sent the tests to the hub. Then tests are redirected to an available Selenium RC, which launch the browser and run the test. Thus, it allows for running tests in parallel with the-entire test suite.<br /> </h3>
<h3 style="text-align: left;">
Q 11. What you say about the flexibility of Selenium test suite?<br />[/b]Ans. Selenium testing suite is highly flexible. There are multiple ways to add functionality to Selenium framework to customize test automation. As compared to other test automation tools, itis Selenium¶s strongest characteristic. Selenium Remote Control support for multiple programming and scripting languages allows the test automation engineer to build any logic they need into their automated testing and to use a preferred programming or scripting language of one¶s choice. Also,the Selenium testing suite is an open source project where code can be modified and enhancements can be submitted for contribution.<br /> </h3>
<h3 style="text-align: left;">
Q12. What test can Selenium do?<br />Ans. Selenium is basically used for the functional testing of web based applications. It can be used for testing in the continuous integration environment. It is also useful for agile testing<br /> </h3>
<h3 style="text-align: left;">
Q13. What is the cost of Selenium test suite?<br />Ans. Selenium test suite a set of open source software tool, it is free of cost.<br /> </h3>
<h3 style="text-align: left;">
Q14. What browsers are supported by Selenium Remote Control?<br />Ans. The test automation expert can use Firefox, IE 7/8, Safari and Opera browsers to run tests in Selenium Remote Control.<br /> </h3>
<h3 style="text-align: left;">
Q15. What programming languages can you use in Selenium RC?<br />Ans. C#, Java, Perl, PHP, Python, Ruby</h3>
<h3 style="text-align: left;">
</h3>
<h3 style="text-align: left;">
Q16.What are the advantages and disadvantages of using Selenium as testing tool?<br />Ans. Advantages: Free, Simple and powerful DOM (document object model) level testing, can beused for continuous integration; great fit with Agile projects.Disadvantages: Tricky setup; dreary errors diagnosis; can not test client server applications.</h3>
<h3 style="text-align: left;">
</h3>
<h3 style="text-align: left;">
</h3>
<h3 style="text-align: left;">
Q17.What is difference between QTP and Selenium?<br />Ans. Only web applications can be testing using Selenium testing suite. However,<br />QTP can be used for testing client server applications. Selenium supports following web browsers: Internet Explorer,Firefox, Safari, Opera or Conqueror on Windows, Mac OS X and Linux. However,<br />QTP is limited to Internet Explorer on Windows.<br /> </h3>
<h3 style="text-align: left;">
QTP uses scripting language implemented on top of VB script. However, Selenium test suite haste flexibility to use many languages like Java, .Net, Perl, PHP, Python, and Ruby.<br /> </h3>
<h3 style="text-align: left;">
Q18. What is difference between Borderland Silk test and Selenium?<br />Ans. Selenium is completely free test automation tool, while Silk Test is not. Only web application scan be testing using Selenium testing suite. However, Silk Test can be used for testing client server applications. Selenium supports following web browsers: Internet Explorer, Firefox, Safari,Opera or Conqueror on Windows, Mac OS X and Linux. However, Silk Test is limited to Internet Explorer and Firefox.Silk Test uses 4Test scripting language. However, Selenium test suite has the flexibility to use many languages like Java, .Net, Perl, PHP, Python, and Ruby.</h3>
<h3 style="text-align: left;">
What makes Automated Software Testing important in the companies?</h3>
<h3 style="text-align: left;">
Tests are repeated quite often during the development cycle as to ensure the quality of the software.</h3>
<h3>
So, whenever the source code is modified tests should be repeated,where in it has to be tested on all supporting operating system and hardware. Doingthis manually would be costly and time consuming, Therefore, automation testing canbe done over and over again at no additional cost and would also save time ascompared to manual testing.</h3>
<h3 style="text-align: left;">
Secondly, automation testing would improve theaccuracy.</h3>
<h3 style="text-align: left;">
Below are some main reasons, why automation testing is crucical in the companies.Firstly automated software testing helps to save time as well money. Every timesource code is modified software tests should be repeated. For each release of thesoftware it may be tested on all supported operating systems and hardwareconfigurations.</h3>
<h3 style="text-align: left;">
Manually repeating these tests is costly and time consuming. Oncecreated, automated tests can be run over and over again at no additional cost and theyare much faster than manual tests.</h3>
<h3 style="text-align: left;">
Secondly, Automated</h3>
<h3 style="text-align: left;">
Software Testing</h3>
<h3 style="text-align: left;">
ImprovesAccuracy as compared to monotonous manual testing. Thirdly, automated softwaretesting can increase the depth and scope of the test to help improve software quality.</h3>
Lastly,<br /><h3 style="text-align: left;">
Shared automated tests can be used by developers to catch problems quickly before sending to QA. Tests can run automatically whenever source code changes rechecked in and notify the team or the developer if they fail. Features like these save developers time and increase their confidence.Automation test scripts will be used as a way of storing domain/project/task Knowledge gained by the Test Engineers.</h3>
<h3 style="text-align: left;">
Say for example, if a Tester works in project for one year, he might have spent more time for learning the domain, purpose of the project, modules in the project, flow of all functionalists.</h3>
<h3 style="text-align: left;">
He will be familiar with known issues and challenges.</h3>
<h3 style="text-align: left;">
If this Tester leaves from the project, the knowledge gained by him also will leave.</h3>
<h3 style="text-align: left;">
It is very difficult for the newly joining Tester to understand everything from the Test Case document.</h3>
I<br /><h3 style="text-align: left;">
f automation test scripts are already available then the new Tester can just start the testing by running the automation scripts, without gaining much knowledge about the project.</h3>
<h3 style="text-align: left;">
He can understand the flow/data by seeing the execution of the automation test scripts.</h3>
<h3 style="text-align: left;">
But anyway, he should gain project/domain knowledge to enhance/update the automation scripts further.</h3>
<h3 style="text-align: left;">
So we can say that test automation is a way of storing knowledge.</h3>
</div>
Anonymoushttp://www.blogger.com/profile/06139552061114183892noreply@blogger.com0tag:blogger.com,1999:blog-3109550050042044783.post-11011539242384020562012-09-07T11:39:00.000-07:002012-09-07T12:11:02.551-07:00<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
<span style="color: #45818e;"><b>Selenium IDE</b></span></h2>
<div style="text-align: left;">
1) This is add-on for Mozilla firefox</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
2) It has record and playback future .</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
3) Using IDE we can create , update , delete, insert the testcases</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
4) we can insert comments using Selenium IDE</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
5) we play all the testcases at one instance ( Test Suite - No's testcases )</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
6) Debugging also possible</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
7)Html is default language</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
8)we can minize or maximize execution testcases speed</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
9)Export our testcase to other languages is also possible ( like Java with Junit , C# , Python , PHP , </div>
<div style="text-align: left;">
Ruby,Perl) </div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
10)we can Extend the Selenium IDE functionality By adding external JavaScript file.<br />
<br />
Drawback of Selenium IDE<br />
<br />
1) Database testing is not possible<br />
<br />
2) Working with external files is not possible<br />
<br />
3) Detailed Report is not possible<br />
<br />
4) By default IDE is not supporting loops , conditional statements<br />
<br />
5) It is Add-on to the Mozilla Firefox only <br />
<br /></div>
<div style="text-align: left;">
<br /></div>
</div>
Anonymoushttp://www.blogger.com/profile/06139552061114183892noreply@blogger.com1tag:blogger.com,1999:blog-3109550050042044783.post-4340024542395331742012-09-06T19:49:00.000-07:002012-09-06T22:30:55.359-07:00Selenium interview questions<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
<span style="color: #6fa8dc;">Selenium Interview Questions with Answers</span></h2>
<h4 style="text-align: left;">
</h4>
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZZrfygdRQtgmDmk28WZfar973SIsZV9hVDFlX7dceDyObHdBU8KHraVZmMRYiEkAJhJLwF5fczjemsSjiYtlYassTwjrn-1be_pdPRiXOXtjXe1jsq96zxgWf9Isb0Y0GYAsxpXn0up47/s1600/big-logo.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZZrfygdRQtgmDmk28WZfar973SIsZV9hVDFlX7dceDyObHdBU8KHraVZmMRYiEkAJhJLwF5fczjemsSjiYtlYassTwjrn-1be_pdPRiXOXtjXe1jsq96zxgWf9Isb0Y0GYAsxpXn0up47/s200/big-logo.png" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><h2>
<span style="color: #cccccc;">Selenium Resource</span></h2>
</td></tr>
</tbody></table>
<h4 style="text-align: left;">
1) what do you know about selenium ?</h4>
<h4 style="text-align: left;">
2) what are features and drawbacks Selenium ?</h4>
<h4 style="text-align: left;">
3) what is Selenium-IDE ?</h4>
<h4 style="text-align: left;">
4) what do you know Selenium-RC ?</h4>
<h4 style="text-align: left;">
5) what are the Drawbacks of Selenium-IDE ?</h4>
<h4 style="text-align: left;">
6) what are the advantages of Selenium ?</h4>
<h4 style="text-align: left;">
7) what is WebDriver ?</h4>
<h4 style="text-align: left;">
8) what are the Advantages of WebDriver ?</h4>
<h4 style="text-align: left;">
9)What are the DrawBacks of WebDriver ?</h4>
<h4 style="text-align: left;">
10)what is mean by Selenium - Grid ?</h4>
<h4 style="text-align: left;">
11) what are advantages and dis advantages of Selenium Grid ?</h4>
<h4 style="text-align: left;">
</h4>
</div>
Anonymoushttp://www.blogger.com/profile/06139552061114183892noreply@blogger.com30