tag:blogger.com,1999:blog-41566287425770863202024-02-07T23:41:14.825-08:00Learn Selenium Step By StepThis Tutorial Guides learning Selenium RC in a Step by Step mannerKiranhttp://www.blogger.com/profile/02019143255160708858noreply@blogger.comBlogger56125tag:blogger.com,1999:blog-4156628742577086320.post-91189032676829689222019-06-11T10:30:00.002-07:002019-06-11T10:32:10.140-07:00Selenium Interview Questions<div dir="ltr" style="text-align: left;" trbidi="on">
Friends below are some interview questions you might be asked . If you get familiar with these you can crack interview<br />
<br />
<b>Java basics for Freshers - Just try to understand Highlighted In red Selenium related question I will update in this blog. These are the question are asked when I take an interview . Remenber if you can crack basic Java question you interview will be easy</b><br />
<br />
for experience All questions are relavent<br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: #38761d; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Q6 what is the difference between List and Set?</span></div>
<span id="docs-internal-guid-cb1fe243-7fff-1234-d1d9-0182f8cdbd64" style="color: black; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<br />
<div dir="ltr" style="margin-left: -5.4pt;">
<table style="border-collapse: collapse; border: none;"><colgroup><col width="301"></col><col width="301"></col></colgroup><tbody>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"><span style="color: red;">Set</span></span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"><span style="color: red;">List</span></span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Set allows only unique elements</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">List allows duplicate elements</span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Set is unordered while List is ordered</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">List maintains the order in which the objects are added</span></div>
</td></tr>
</tbody></table>
</div>
<span style="color: black; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: #38761d; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Q7 what is the difference between Map and Set?</span></div>
<div dir="ltr" style="margin-left: -5.4pt;">
<table style="border-collapse: collapse; border: none;"><colgroup><col width="301"></col><col width="301"></col></colgroup><tbody>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"><span style="color: red;">Set </span></span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: red;"><span style="font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Map</span><span style="font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span></span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Set contains unique keys but does not allow duplicate values</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Map contains unique key but allows duplicate values</span></div>
</td></tr>
</tbody></table>
</div>
<span style="color: black; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: #38761d; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Q8 what are the classes implementing List and Set interface?</span><span style="color: #2f2e2e; font-family: "arial"; font-size: 13.5pt; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div dir="ltr" style="margin-left: -5.4pt;">
<table style="border-collapse: collapse; border: none;"><colgroup><col width="301"></col><col width="301"></col></colgroup><tbody>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"><span style="color: red;">List</span></span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"><span style="color: red;">Set</span></span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">ArrayList, Vector, Linked List</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">HashSet, Tree Set</span></div>
</td></tr>
</tbody></table>
</div>
<span style="color: black; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: #38761d; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Q9 what is an iterator?</span><span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Iterator is an interface. It is found in java.util package. It provides methods to iterate over any Collection.</span></div>
<span style="color: black; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: #38761d; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Q10 what is the difference between Iterator and Enumeration?</span></div>
<div dir="ltr" style="margin-left: -5.4pt;">
<table style="border-collapse: collapse; border: none;"><colgroup><col width="301"></col><col width="301"></col></colgroup><tbody>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Iterator</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Enumeration</span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Iterator you can remove element(allows read/write operations)</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Doesn’t support remove(supports readonly operations)</span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><br /></td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><br /></td></tr>
</tbody></table>
</div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: white; color: #38761d; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Q12 which methods you need to override to use any object as key in HashMap?</span><span style="color: #2f2e2e; font-family: "arial"; font-size: 13.5pt; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="color: #2f2e2e; font-family: "arial"; font-size: 13.5pt; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">To use any object as key in HashMap, it needs to implement </span><span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">equals()</span><span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> and </span><span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">hashCode()</span><span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> method</span><span style="background-color: white; color: #2f2e2e; font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> </span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: #2f2e2e; font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><b><span style="color: red;">What it static key word : **this is important most interview this questions will be asked****</span></b></span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: #2f2e2e; font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: #2f2e2e; font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Answer</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: #2f2e2e; font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">1. the variable or method declared as static can be directly called using call name </span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: #2f2e2e; font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">2. Any block of code that needs to executed before main method you put that code in static block</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: #2f2e2e; font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: #2f2e2e; font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">static{</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: #2f2e2e; font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">your code goes here, this block of code will be exe used before main method starts execution</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: #2f2e2e; font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">}</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: #2f2e2e; font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">static main ()</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"><span style="color: red;">Q13 what is the difference between Queue and Stack?</span></span></div>
<div dir="ltr" style="margin-left: -5.4pt;">
<table style="border-collapse: collapse; border: none;"><colgroup><col width="301"></col><col width="301"></col></colgroup><tbody>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"><span style="color: red;">Queue</span></span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"><span style="color: red;">Stack</span></span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">First In First out</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Last In First Out</span></div>
</td></tr>
</tbody></table>
</div>
<span style="color: black; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"><span style="color: red;">Q14 How to reverse the List in Collections?</span></span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Collections.reverse(listobject);</span></div>
<span style="color: black; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: white; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"><span style="color: red;">Q15 How to convert the array of strings into the list?</span></span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">asList() </span></div>
<span style="color: black; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: white; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"><span style="color: red;">Q16 what is the difference between ArrayList and Vector?</span></span></div>
<div dir="ltr" style="margin-left: -5.4pt;">
<table style="border-collapse: collapse; border: none;"><colgroup><col width="301"></col><col width="301"></col></colgroup><tbody>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Vector</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">ArrayList</span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Vector is Synchronized</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Array List is not synchronized</span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Vector is slow</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">ArrayList is fast</span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Vector increases the capacity twice of its initial size</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">ArrayList increases its ArraySize by 50%</span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Vector supports both Enumeration and Iterator</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Array List support only Iterator for traversing</span></div>
</td></tr>
</tbody></table>
</div>
<span style="color: black; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: white; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-position: normal; vertical-align: baseline;"><span style="color: red;"><span style="font-family: inherit; font-size: medium;"><span style="font-weight: 700; white-space: pre-wrap;">Q17 what is the difference between HashMap and Hashtable? - This is </span></span><span style="font-size: medium;"><span style="white-space: pre-wrap;"><b>must</b></span></span></span></span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: white; font-variant-east-asian: normal; font-variant-ligatures: normal; font-variant-position: normal; vertical-align: baseline;"><span style="color: red;"><span style="font-size: medium;"><span style="white-space: pre-wrap;"><b>Commenly asked interview question</b></span></span></span></span></div>
<div dir="ltr" style="margin-left: -5.4pt;">
<table style="border-collapse: collapse; border: none;"><colgroup><col width="301"></col><col width="301"></col></colgroup><tbody>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">HashMap</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Hashtable</span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">HashMap allows null key value insertion </span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Hashtable does not allow null keys and null values.</span></div>
</td></tr>
<tr style="height: 4pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">HashMap is not synchronized or thread-safe </span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Hashtable is synchronized or thread-safe.</span></div>
</td></tr>
</tbody></table>
</div>
<span style="color: black; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<br />
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: white; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"><span style="color: red;">Q20 what is the difference between Array and ArrayList in Java? ** Very </span></span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: white; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"><span style="color: red;">important for sure you will be asked</span></span></div>
<div dir="ltr" style="margin-left: -5.4pt;">
<table style="border-collapse: collapse; border: none;"><colgroup><col width="301"></col><col width="301"></col></colgroup><tbody>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Array</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">ArrayList</span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Array is static in size </span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> ArrayList is dynamic in size.</span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Array can contain primitive data types </span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">ArrayList cannot contain primitive data types.</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">If declared primitive data type JVM through Auto boxing(converting primitives to equivalent objects internally)</span><span style="background-color: white; color: #2f2e2e; font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> </span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Fast performance</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Slow performance</span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">does not guarantee ordered elements.</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">does not guarantee ordered elements.</span></div>
</td></tr>
</tbody></table>
</div>
<span style="color: black; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<br />
<h1 dir="ltr" style="background-color: white; line-height: 1.295; margin-bottom: 11.25pt; margin-top: 18.75pt;">
<span style="color: #38761d; font-family: inherit; font-size: 13.5pt; vertical-align: baseline; white-space: pre-wrap;">Hashing: How Hash Map Works In Java Or How Get() Method Works Internally</span></h1>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">HashMap works on the principle of Hashing. To understand Hashing, we should understand the three terms first i.e Hash Function , Hash Value and Bucket .</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">HashMap get(Key k) method calls </span><span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">hashCode</span><span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> method on the key object and applies returned hashValue to its own static hash function to find a </span><span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">bucket</span><span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> location(backing array) where keys and values are stored in form of a nested class called Entry (Map.Entry)</span></div>
<span style="color: black; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<br />
<div dir="ltr" style="margin-left: -5.4pt;">
<table style="border-collapse: collapse; border: none;"><colgroup><col width="301"></col><col width="301"></col></colgroup><tbody>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">ArrayList</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Linked list</span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f6ffe1; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;">Manipulation with ArrayList is </span><span style="background-color: #f6ffe1; color: black; font-family: "verdana"; font-size: 10pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">slow</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f6ffe1; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;">Manipulation with LinkedList is </span><span style="background-color: #f6ffe1; color: black; font-family: "verdana"; font-size: 10pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">faster</span><span style="background-color: #f6ffe1; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;"> </span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f6ffe1; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;">Ddataccess is faster.Better performance becaue of Index based search</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f6ffe1; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;">Data access is slower. Performance is slower</span></div>
<div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f6ffe1; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;">As Linked list inherits Double Linked list </span><span style="background-color: white; color: black; font-family: "trebuchet ms"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">which requires the traversal through all the elements for searching an element.</span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f6ffe1; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;">One should go for Arraylist implemententation when there are more get calls</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><br /></td></tr>
</tbody></table>
</div>
<h1 dir="ltr" style="background-color: white; line-height: 1.295; margin-bottom: 11.25pt; margin-top: 18.75pt;">
<span style="color: #38761d; font-family: inherit; font-size: 13.5pt; vertical-align: baseline; white-space: pre-wrap;">Comparator </span></h1>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: #333333; font-family: "tahoma" , sans-serif; font-size: 11.5pt; vertical-align: baseline; white-space: pre-wrap;">Is an interface which is used for sorting objects in Java.</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: #333333; font-family: "tahoma" , sans-serif; font-size: 11.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Compare to</span><span style="background-color: white; color: #333333; font-family: "tahoma" , sans-serif; font-size: 11.5pt; vertical-align: baseline; white-space: pre-wrap;"> method</span></div>
<span style="color: black; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<br />
<div dir="ltr" style="margin-left: -5.4pt;">
<table style="border-collapse: collapse; border: none;"><colgroup><col width="259"></col><col width="342"></col></colgroup><tbody>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: yellow; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Comparable</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: yellow; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Comparator</span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: white; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;">Comparable provides </span><span style="background-color: white; color: black; font-family: "verdana"; font-size: 10pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">single sorting sequence</span><span style="background-color: white; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;">. In other words, we can sort the collection on the basis of single element such as id or name or price etc.</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: white; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;">Comparator provides </span><span style="background-color: white; color: black; font-family: "verdana"; font-size: 10pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">multiple sorting sequence</span><span style="background-color: white; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;">. In other words, we can sort the collection on the basis of multiple elements such as id, name and price etc.</span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f6ffe1; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;">Comparable</span><span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">affects the original class</span><span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #f6ffe1; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;">i.e. actual class is modified.</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f6ffe1; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;">Comparator </span><span style="background-color: #f6ffe1; color: black; font-family: "verdana"; font-size: 10pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">doesn't affect the original class</span><span style="background-color: #f6ffe1; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;"> i.e. actual class is not modified.</span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f6ffe1; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;">Comparable is found in </span><span style="background-color: #f6ffe1; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">java.lang</span><span style="background-color: #f6ffe1; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: #f6ffe1; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;">package.</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: #f6ffe1; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;">Comparator is found in </span><span style="background-color: #f6ffe1; color: black; font-family: "verdana"; font-size: 10pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">java.util</span><span style="background-color: #f6ffe1; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;"> package.</span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: white; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;">We can sort the list elements of Comparable type by</span><span style="background-color: white; color: black; font-family: "verdana"; font-size: 10pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Collections.sort(List)</span><span style="background-color: white; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;"> method.</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: white; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;">We can sort the list elements of Comparator type by</span><span style="background-color: white; color: black; font-family: "verdana"; font-size: 10pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Collections.sort(List,Comparator)</span><span style="background-color: white; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;"> method.</span></div>
</td></tr>
</tbody></table>
</div>
<h1 dir="ltr" style="background-color: white; line-height: 1.295; margin-bottom: 11.25pt; margin-top: 18.75pt;">
<span style="color: #38761d; font-family: inherit; font-size: 13.5pt; vertical-align: baseline; white-space: pre-wrap;">HashSet vs TreeSet</span></h1>
<div dir="ltr" style="margin-left: -5.4pt;">
<table style="border-collapse: collapse; border: none;"><colgroup><col width="301"></col><col width="301"></col></colgroup><tbody>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">HashSet</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">TreeSet</span></div>
</td></tr>
<tr style="height: 28pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Removes duplicates</span><span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Removes duplicates</span><span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Don’t sort element</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Sorts elements in Ascending order</span></div>
</td></tr>
</tbody></table>
</div>
<h1 dir="ltr" style="background-color: white; line-height: 1.295; margin-bottom: 11.25pt; margin-top: 18.75pt;">
<span style="color: #38761d; font-family: inherit; font-size: 13.5pt; vertical-align: baseline; white-space: pre-wrap;">Iterator vs List Iterator</span></h1>
<span style="color: black; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<br />
<div dir="ltr" style="margin-left: -5.4pt;">
<table style="border-collapse: collapse; border: none;"><colgroup><col width="301"></col><col width="301"></col></colgroup><tbody>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Iterator</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">List Iterator</span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: white; color: black; font-family: "trebuchet ms"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Iterator is used for traversing </span><span style="background-color: #efefef; color: black; font-family: "consolas" , sans-serif; font-size: 12pt; vertical-align: baseline; white-space: pre-wrap;">List</span><span style="background-color: white; color: black; font-family: "trebuchet ms"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> and </span><span style="background-color: #efefef; color: black; font-family: "consolas" , sans-serif; font-size: 12pt; vertical-align: baseline; white-space: pre-wrap;">Set</span><span style="background-color: white; color: black; font-family: "trebuchet ms"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> both.</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: white; color: black; font-family: "trebuchet ms"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">We can use List Iterator to traverse </span><span style="background-color: #efefef; color: black; font-family: "consolas" , sans-serif; font-size: 12pt; vertical-align: baseline; white-space: pre-wrap;">List</span><span style="background-color: white; color: black; font-family: "trebuchet ms"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> only, we cannot traverse </span><span style="background-color: #efefef; color: black; font-family: "consolas" , sans-serif; font-size: 12pt; vertical-align: baseline; white-space: pre-wrap;">Set</span><span style="background-color: white; color: black; font-family: "trebuchet ms"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> using ListIterator.</span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: white; color: black; font-family: "trebuchet ms"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">We can traverse in only forward direction using Iterator.</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: yellow; color: black; font-family: "trebuchet ms"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Using ListIterator, we can traverse a List in both the directions (forward and Backward)</span></div>
</td></tr>
</tbody></table>
</div>
<h1 dir="ltr" style="background-color: white; line-height: 1.295; margin-bottom: 11.25pt; margin-top: 18.75pt;">
<span style="color: #38761d; font-family: inherit; font-size: 13.5pt; vertical-align: baseline; white-space: pre-wrap;">HashMap vs TreeMap</span></h1>
<span style="color: black; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<br />
<div dir="ltr" style="margin-left: -5.4pt;">
<table style="border-collapse: collapse; border: none;"><colgroup><col width="301"></col><col width="301"></col></colgroup><tbody>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">HashMap</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Tree Map</span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: yellow; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Return elements as it on how they are added</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Return Sorted in Ascending order of Keys</span></div>
</td></tr>
</tbody></table>
</div>
<span style="color: black; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">HashMap vs tree map</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Binary tree</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Enums</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: #38761d; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Hash map usage</span></div>
<ul style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="font-family: "noto sans symbols", sans-serif; font-size: 11pt; list-style-type: disc; vertical-align: baseline; white-space: pre;"><div dir="ltr" style="line-height: 1.295; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Create an entry set</span></div>
</li>
<li dir="ltr" style="font-family: "noto sans symbols", sans-serif; font-size: 11pt; list-style-type: disc; vertical-align: baseline; white-space: pre;"><div dir="ltr" style="line-height: 1.295; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Create a iterator object over entry set</span></div>
</li>
<li dir="ltr" style="font-family: "noto sans symbols", sans-serif; font-size: 11pt; list-style-type: disc; vertical-align: baseline; white-space: pre;"><div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Then iterate</span></div>
</li>
</ul>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: #38761d; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">LinkedHashMap</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Same as HashMap just preserves the insertion order</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: #38761d; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">What are concurrentCollectionClasses?</span><span style="background-color: white; color: #2f2e2e; font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> </span></div>
<span style="color: black; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">In jdk1.5 , Java Api developers had introduced new package called</span><span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;"> java.util.concurrent</span><span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> that have thread-safe collection classes as they allow collections to be modified while iterating</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Ex : Concurrent Hash Map class</span></div>
<span style="color: black; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: #38761d; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">How will you make Collections readOnly ?</span></div>
<div dir="ltr" style="background-color: white; line-height: 1.295; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Collections.unmodifiableMap(Map m)</span></div>
<div dir="ltr" style="background-color: white; line-height: 1.295; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Collections.unmodifiableList(List l)</span></div>
<div dir="ltr" style="background-color: white; line-height: 1.295; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Collections.unmodifiableSet(Set s)</span></div>
<span style="color: black; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<br />
<h2 dir="ltr" style="background-color: white; line-height: 1.295; margin-bottom: 0pt; margin-top: 2pt;">
<span style="color: #38761d; font-family: inherit; font-size: 13.5pt; vertical-align: baseline; white-space: pre-wrap;">Difference between Stack vs Heap in Java</span></h2>
<span style="color: black; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<br />
<div dir="ltr" style="margin-left: -5.4pt;">
<table style="border-collapse: collapse; border: none;"><colgroup><col width="301"></col><col width="301"></col></colgroup><tbody>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Stack</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Heap</span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Stack memory is used to store variables and functions</span></div>
</td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.2; margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Heap memory is used to store Objects</span></div>
</td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><br /></td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><br /></td></tr>
<tr style="height: 0pt;"><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><br /></td><td style="border: 0.5pt solid rgb(0, 0, 0); padding: 0pt 5.4pt; vertical-align: top;"><br /></td></tr>
</tbody></table>
</div>
<span style="color: black; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="color: #38761d; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">What is reflection?</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">The ability to examine or modify the runtime behaviour of applications running in the Java virtual machine</span></div>
<ul style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="font-family: "noto sans symbols", sans-serif; font-size: 10pt; list-style-type: disc; margin-left: -13.5pt; vertical-align: baseline; white-space: pre;"><div dir="ltr" style="background-color: white; line-height: 1.295; margin-bottom: 3pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Examine an object's class at runtime</span></div>
</li>
<li dir="ltr" style="font-family: "noto sans symbols", sans-serif; font-size: 10pt; list-style-type: disc; margin-left: -13.5pt; vertical-align: baseline; white-space: pre;"><div dir="ltr" style="background-color: white; line-height: 1.295; margin-bottom: 3pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Construct an object for a class at runtime</span></div>
</li>
<li dir="ltr" style="font-family: "noto sans symbols", sans-serif; font-size: 10pt; list-style-type: disc; margin-left: -13.5pt; vertical-align: baseline; white-space: pre;"><div dir="ltr" style="background-color: white; line-height: 1.295; margin-bottom: 3pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Examine a class's field and method at runtime</span></div>
</li>
<li dir="ltr" style="font-family: "noto sans symbols", sans-serif; font-size: 10pt; list-style-type: disc; margin-left: -13.5pt; vertical-align: baseline; white-space: pre;"><div dir="ltr" style="background-color: white; line-height: 1.295; margin-bottom: 3pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Invoke any method of an object at runtime</span></div>
</li>
<li dir="ltr" style="font-family: "noto sans symbols", sans-serif; font-size: 10pt; list-style-type: disc; margin-left: -13.5pt; vertical-align: baseline; white-space: pre;"><div dir="ltr" style="background-color: white; line-height: 1.295; margin-bottom: 3pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Change accessibility flag of Constructor, Method and Field</span></div>
</li>
</ul>
<div dir="ltr" style="background-color: white; line-height: 1.295; margin-bottom: 3pt; margin-top: 0pt; padding: 0pt 0pt 0pt 22.5pt; text-indent: -22.5pt;">
<br /></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="color: #38761d; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Binary Tree</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">A binary tree is a </span><span style="background-color: white; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">tree data structure</span><span style="background-color: white; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> in which each node has at most two children, which are referred to as the left child and the right child</span><span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><br /></span><a href="http://www.java2blog.com/2014/07/binary-tree-preorder-traversal-in-java.html" style="text-decoration: none;"><span style="color: blue; font-family: "calibri" , sans-serif; font-size: 11pt; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">PreOrder traversal</span><span style="color: blue; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> </span></a><span style="background-color: white; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">- In PreOrder traversal, each node is processed before either of its sub-trees. In simpler words, Visit each node before its children.</span><span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><br /></span><a href="http://www.java2blog.com/2014/07/binary-tree-inorder-traversal-in-java.html" style="text-decoration: none;"><span style="color: blue; font-family: "calibri" , sans-serif; font-size: 11pt; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">InOrder traversal</span><span style="color: blue; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> </span></a><span style="background-color: white; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">: In In-Order traversal, each node is processed between subtrees.In simpler words,Visit left subtree, node and then right subtree.</span><span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><br /></span><a href="http://www.java2blog.com/2014/07/binary-tree-postorder-traversal-in-java.html" style="text-decoration: none;"><span style="color: blue; font-family: "calibri" , sans-serif; font-size: 11pt; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">PostOrder traversal</span></a><span style="background-color: white; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">: In PostOrder traversal,each node is processed after subtrees traversal. In simpler words, Visit left subtree, right subtree and then node.</span><span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><br /></span><a href="http://www.java2blog.com/2014/07/binary-tree-level-order-traversal-in.html" style="text-decoration: none;"><span style="color: blue; font-family: "calibri" , sans-serif; font-size: 11pt; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Level order traversal</span></a><span style="background-color: white; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> : In Level order traversal, tree is traversed by each level. It is same as breadth first search.</span><span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><br /></span><a href="http://www.java2blog.com/2014/08/spiralzigzag-level-order-traversal-of.html" style="text-decoration: none;"><span style="color: blue; font-family: "calibri" , sans-serif; font-size: 11pt; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Spiral/Zigzag order traversal</span><span style="color: blue; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> </span></a><span style="background-color: white; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">: In spiral order traversal, tree is traversed in spiral shape. </span><span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<span style="color: black; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="color: #38761d; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Binary Search</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Binary search is a fast search algorithm. This search algorithm works on the </span><span style="background-color: white; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">principle of divide and conquer.</span><span style="background-color: white; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> For this algorithm to work properly the data collection should be in sorted form.</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Binary search a particular item by comparing the middle most item of the collection. If match occurs then index of item is returned. If middle item is greater than item then item is searched in sub-array to the right of the middle</span><span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
<span style="color: black; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="color: #38761d; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">What is immutable class in Java?</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Immutable classes are those class, whose </span><a href="http://javarevisited.blogspot.com/2012/12/what-is-object-in-java-or-oops-example.html" style="text-decoration: none;"><span style="background-color: white; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">object</span></a><span style="background-color: white; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> cannot be modified once created. Immutable and mutable objects are, </span><a href="http://javarevisited.blogspot.com/2011/07/string-vs-stringbuffer-vs-stringbuilder.html" style="text-decoration: none;"><span style="background-color: white; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">String</span><span style="background-color: white; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> and StringBuffer</span></a><span style="background-color: white; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Class can be made immutable by making it Final.</span><span style="color: black; font-family: "trebuchet ms"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: white; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Benefits</span></div>
<ul style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: white; font-family: "noto sans symbols", sans-serif; font-size: 11pt; list-style-type: disc; vertical-align: baseline; white-space: pre;"><div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Thread Safe</span></div>
</li>
</ul>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="color: #38761d; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Stack</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Stack is a subclass of Vector collection</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Push pop</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="color: #38761d; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Sorting</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt; padding: 0pt 0pt 0pt 36pt; text-indent: -36pt;">
<span style="color: #38761d; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Bubble Sort</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt; padding: 0pt 0pt 0pt 36pt; text-indent: -36pt;">
<span style="background-color: white; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Comparing each pair of adjacent items and swapping them </span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt; padding: 0pt 0pt 0pt 36pt; text-indent: -36pt;">
<span style="color: #38761d; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Selection Sort</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt; padding: 0pt 0pt 0pt 36pt; text-indent: -36pt;">
<span style="background-color: white; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Tries to identify the smallest and the largest elements and swapping the positions</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt; padding: 0pt 0pt 0pt 36pt; text-indent: -36pt;">
<span style="color: #38761d; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Insertion Sortd</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt; text-indent: 36pt;">
<span style="color: #38761d; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Quick sort in java. </span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt; padding: 0pt 0pt 0pt 36pt; text-indent: -36pt;">
<span style="background-color: white; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Quicksort or partition-exchange sort, is a fast sorting algorithm, which is using divide and algorithm. Quicksort first divides a large list into two smaller </span><span style="background-color: white; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">sub-lists</span><span style="background-color: white; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">: the low elements and the high elements. Quicksort can then recursively sort the sub-lists. </span></div>
<span style="color: black; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt; text-indent: 36pt;">
<span style="color: #38761d; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Merge sort in java.</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt; text-indent: 36pt;">
<span style="background-color: white; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Divided into unsorted n no of patterns and </span></div>
<span style="color: black; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="color: #38761d; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">What is difference between Singly Linked List and Doubly Linked List data structure?</span><span style="color: black; font-family: "trebuchet ms"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: white; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Main difference between singly linked list and doubly linked list is ability to traverse. In a single linked list, node only points towards next node, and there is no pointer to previous node, which means you cannot traverse back on a singly linked list. On the other hand doubly linked list maintains two pointers, towards next and previous node, which allows you to navigate in both direction in any linked list.</span><span style="color: black; font-family: "trebuchet ms"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<h1 dir="ltr" style="line-height: 1.295; margin-bottom: 0pt; margin-top: 12pt;">
<span style="color: #2e75b5; font-family: "calibri" , sans-serif; font-size: 16pt; vertical-align: baseline; white-space: pre-wrap;">Difference between ArrayList and LinkedList: </span></h1>
<span style="color: black; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<br />
<div dir="ltr" style="margin-left: -3.75pt;">
<table style="border-collapse: collapse; border: none;"><colgroup><col width="343"></col><col width="330"></col></colgroup><tbody>
<tr style="height: 15pt;"><td style="background-color: #f6ffe1; border-bottom-color: rgb(255, 192, 203); border-bottom-style: solid; border-bottom-width: 0.75pt; border-left-color: rgb(255, 192, 203); border-left-style: solid; border-left-width: 0.75pt; border-top-color: rgb(255, 192, 203); border-top-style: solid; border-top-width: 0.75pt; padding: 3.75pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.295; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "times new roman"; font-size: 13pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">ArrayList</span></div>
</td><td style="background-color: #f6ffe1; border-bottom-color: rgb(255, 192, 203); border-bottom-style: solid; border-bottom-width: 0.75pt; border-right-color: rgb(255, 192, 203); border-right-style: solid; border-right-width: 0.75pt; border-top-color: rgb(255, 192, 203); border-top-style: solid; border-top-width: 0.75pt; padding: 3.75pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.295; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: "times new roman"; font-size: 13pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">LinkedList</span></div>
</td></tr>
<tr style="height: 31pt;"><td style="background-color: white; border: 0.75pt solid rgb(255, 192, 203); padding: 3.75pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.295; margin-bottom: 0pt; margin-top: 0pt; padding: 0pt 0pt 0pt 15pt; text-indent: -15pt;">
<span style="background-color: transparent; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;">1) ArrayList internally uses </span><span style="background-color: transparent; color: black; font-family: "verdana"; font-size: 10pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">dynamic array</span><span style="background-color: transparent; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;"> to store the elements.</span></div>
</td><td style="background-color: white; border: 0.75pt solid rgb(255, 192, 203); padding: 3.75pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.295; margin-bottom: 0pt; margin-top: 0pt; padding: 0pt 0pt 0pt 15pt; text-indent: -15pt;">
<span style="background-color: transparent; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;">LinkedList internally uses </span><span style="background-color: transparent; color: black; font-family: "verdana"; font-size: 10pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">doubly linked list</span><span style="background-color: transparent; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;"> to store the elements.</span></div>
</td></tr>
<tr style="height: 45pt;"><td style="background-color: #f6ffe1; border: 0.75pt solid rgb(255, 192, 203); padding: 3.75pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.295; margin-bottom: 0pt; margin-top: 0pt; padding: 0pt 0pt 0pt 15pt; text-indent: -15pt;">
<span style="background-color: transparent; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;">2) Manipulation with ArrayList is </span><span style="background-color: transparent; color: black; font-family: "verdana"; font-size: 10pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">slow</span><span style="background-color: transparent; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;"> because it internally uses array. If any element is removed from the array, all the bits are shifted in memory.</span></div>
</td><td style="background-color: #f6ffe1; border: 0.75pt solid rgb(255, 192, 203); padding: 3.75pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.295; margin-bottom: 0pt; margin-top: 0pt; padding: 0pt 0pt 0pt 15pt; text-indent: -15pt;">
<span style="background-color: transparent; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;">Manipulation with LinkedList is </span><span style="background-color: transparent; color: black; font-family: "verdana"; font-size: 10pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">faster</span><span style="background-color: transparent; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;"> than ArrayList because it uses doubly linked list so no bit shifting is required in memory.</span></div>
</td></tr>
<tr style="height: 30pt;"><td style="background-color: white; border: 0.75pt solid rgb(255, 192, 203); padding: 3.75pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.295; margin-bottom: 0pt; margin-top: 0pt; padding: 0pt 0pt 0pt 15pt; text-indent: -15pt;">
<span style="background-color: transparent; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;">3) ArrayList class can </span><span style="background-color: transparent; color: black; font-family: "verdana"; font-size: 10pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">act as a list</span><span style="background-color: transparent; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;"> only because it implements List only.</span></div>
</td><td style="background-color: white; border: 0.75pt solid rgb(255, 192, 203); padding: 3.75pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.295; margin-bottom: 0pt; margin-top: 0pt; padding: 0pt 0pt 0pt 15pt; text-indent: -15pt;">
<span style="background-color: transparent; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;">LinkedList class can </span><span style="background-color: transparent; color: black; font-family: "verdana"; font-size: 10pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">act as a list and queue</span><span style="background-color: transparent; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;"> both because it implements List and Deque interfaces.</span></div>
</td></tr>
<tr style="height: 15pt;"><td style="background-color: #f6ffe1; border: 0.75pt solid rgb(255, 192, 203); padding: 3.75pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.295; margin-bottom: 0pt; margin-top: 0pt; padding: 0pt 0pt 0pt 15pt; text-indent: -15pt;">
<span style="background-color: transparent; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;">4) ArrayList is </span><span style="background-color: transparent; color: black; font-family: "verdana"; font-size: 10pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">better for storing and accessing</span><span style="background-color: transparent; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;"> data.</span></div>
</td><td style="background-color: #f6ffe1; border: 0.75pt solid rgb(255, 192, 203); padding: 3.75pt; vertical-align: top;"><div dir="ltr" style="line-height: 1.295; margin-bottom: 0pt; margin-top: 0pt; padding: 0pt 0pt 0pt 15pt; text-indent: -15pt;">
<span style="background-color: transparent; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;">LinkedList is </span><span style="background-color: transparent; color: black; font-family: "verdana"; font-size: 10pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">better for manipulating</span><span style="background-color: transparent; color: black; font-family: "verdana"; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;"> data.</span></div>
</td></tr>
</tbody></table>
</div>
<span style="color: black; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<br />
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="color: #38761d; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Thread.sleep vs Thread.wait vs Thread.Yield</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: yellow; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Thread.sleep</span><span style="background-color: yellow; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> cannot be revoked</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: yellow; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Thread.wait </span><span style="background-color: yellow; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">can notify thread to continue</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: yellow; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Thread.yieid</span><span style="background-color: yellow; color: black; font-family: "calibri" , sans-serif; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> will go to runnable/ ready state</span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: black; font-family: "trebuchet ms"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Thread.Wait releases the monitor or lock it was holding on that object, but when a thread calls the </span><span style="color: black; font-family: "courier new"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">sleep()</span><span style="background-color: white; color: black; font-family: "trebuchet ms"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> method, it never releases the monitor even if it is holding. </span><span style="color: black; font-family: "trebuchet ms"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="color: black; font-family: "trebuchet ms"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><br /></span><span style="background-color: #eeeeee; color: #222426; font-family: "consolas" , sans-serif; font-size: 10pt; vertical-align: baseline; white-space: pre-wrap;">Thread.yield()</span><span style="background-color: white; color: #222426; font-family: "arial"; font-size: 11.5pt; vertical-align: baseline; white-space: pre-wrap;"> method pauses the currently executing thread temporarily for giving a chance to the remaining waiting threads of the same priority to execute. If there is no waiting thread or all the waiting threads have a lower priority then the same thread will continue its execution</span></div>
<span style="color: black; font-style: normal; font-weight: normal; letter-spacing: normal; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="color: #38761d; font-family: inherit; font-size: 13.5pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Volatile </span></div>
<div dir="ltr" style="line-height: 1.295; margin-bottom: 8pt; margin-top: 0pt;">
<span style="background-color: white; color: #545454; font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Any way the </span><span style="background-color: white; color: #6a6a6a; font-family: "arial"; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">volatile</span><span style="background-color: white; color: #545454; font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> keyword in </span><span style="background-color: white; color: #6a6a6a; font-family: "arial"; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Java</span><span style="background-color: white; color: #545454; font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> is used as an indicator to </span><span style="background-color: white; color: #6a6a6a; font-family: "arial"; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Java</span><span style="background-color: white; color: #545454; font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> compiler and Thread that do not cache value of this variable and always read it from main memory. ...</span><span style="background-color: white; color: #6a6a6a; font-family: "arial"; font-size: 11pt; font-weight: 700; vertical-align: baseline; white-space: pre-wrap;">Java volatile</span><span style="background-color: white; color: #545454; font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> keyword cannot be used with method or class and it can only be used with variable.</span></div>
<span style="background-color: white; font-family: "trebuchet ms"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">So if you want to share any variable in which read and write operation is atomic by implementation e.g. read and write in an </span><span style="font-family: "courier new"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">int</span><span style="background-color: white; font-family: "trebuchet ms"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> or a </span><span style="font-family: "courier new"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">boolean</span><span style="background-color: white; font-family: "trebuchet ms"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> variable then you can declare them as volatile variable.</span></div>
Kiranhttp://www.blogger.com/profile/02019143255160708858noreply@blogger.com0tag:blogger.com,1999:blog-4156628742577086320.post-48034446533922335472014-08-10T04:23:00.000-07:002014-08-10T04:50:51.949-07:00JIRA Zephyr Introduction<div dir="ltr" style="text-align: left;" trbidi="on">JIRA is a well known Powerful project management tool for creation and maintain project taks.<br />Zephyer is one of the JIRA Plugins for Test Case Management where one can create,update,execute tests manually.<br />ZAPI is an interface that provides RESTful services that can be called from your code to create,update and execute tests. Zephyr does not comes default with JIRA license. You need to purchase separate license to get Zephyr installed. Having this you can create your tests manually. To have your test cases get created programatically you need to purchase additional licese for ZAPI in addition to Zephyr.<br /><br />In my subsequent posts I would be posting topics on<br /><br /><ul style="text-align: left;"><li>JIRA Rest Interface</li><li>ZAPI Rest Interface</li><li>Fetching JIRA Projects</li><li>Fetching JIRA test cycles</li><li>Creating a Test Case</li><li>Creating Test Steps</li><li>Updating Test case</li><li>Assigning Test Case for Execution</li><li>Execution of Test Cases</li><li>Setting Execution statuses (PASS/FAIL,WIP)</li></ul><br /><br /></div>Kiranhttp://www.blogger.com/profile/02019143255160708858noreply@blogger.com1tag:blogger.com,1999:blog-4156628742577086320.post-51739798865093778122014-08-10T04:15:00.000-07:002014-08-10T04:52:58.533-07:00Webdriver Jmeter Integration Approach<div dir="ltr" style="text-align: left;" trbidi="on">There are couple of ways one can Integrate Webdriver scripts with Jmeter<br /><br />1. Junit Sampler<br />2.Web driver Sampler<br /><br />More to come on the above ones</div>Kiranhttp://www.blogger.com/profile/02019143255160708858noreply@blogger.com0tag:blogger.com,1999:blog-4156628742577086320.post-18728612921456801092014-08-10T04:14:00.000-07:002014-08-10T04:52:58.572-07:00Jmeter Introdcution<div dir="ltr" style="text-align: left;" trbidi="on"><span style="font-family: Georgia, Times New Roman, serif;">I have spend some time on analyzing functional automation using open source automation tools. This time I'm looking curious to explore some open source performance tools like Jmeter.</span><br /><span style="font-family: Georgia, Times New Roman, serif;"><br /></span><span style="font-family: Georgia, Times New Roman, serif;">At the time when I was a fresher , I had some learning on Jmeter on performance testing of web application and did some analysis on measuring performance for database like Postgre and Oracle.It was just couple of months and never looked back at Jmeter</span><br /><span style="font-family: Georgia, Times New Roman, serif;"><br /></span><span style="font-family: Georgia, Times New Roman, serif;">In this blog i'm putting on the analysis and outcome of my understanding on Integrating Jmeter with Selenium webdriver in the recent times.</span><br /><span style="font-family: Georgia, Times New Roman, serif;"><br /></span><span style="font-family: Georgia, Times New Roman, serif;">The intention of writing this blog is to provide some context on how the Selenium based tests can be reused to measure some performance parameters if a webpage for a single user/multiple users. It is suggested that it not a good practice to drive your Webdriver-Jmeter tests with multiple sets of Threads as Jmeter spawns multiple threads for simulating multiple user simulation. Multiple threads opens multiple browsers and that kills your system memory. How ever if you have a high end configuration machine , yes you can create multiple threads</span><br /><span style="font-family: Georgia, Times New Roman, serif;"><br /></span><span style="font-family: Georgia, Times New Roman, serif;">If you want more information on Jmeter check this http://jmeter.apache.org/</span><br /><span style="font-family: Georgia, Times New Roman, serif;"><br /></span><span style="font-family: Georgia, Times New Roman, serif;">In my subsequent blogs I discuss the approach</span><br /><span style="font-family: Georgia, Times New Roman, serif;"><br /></span><span style="font-family: Georgia, Times New Roman, serif;">- Integrating Webdriver with Jmeter</span><br /><span style="font-family: Georgia, Times New Roman, serif;">- Distribution of Webdriver Jmeter tests</span><br /><span style="font-family: Georgia, Times New Roman, serif;">- Invoking Webdriver Jmeter tests from Apache Ant </span><br /><span style="font-family: Georgia, Times New Roman, serif;">- Generation of HTML reports</span><br /><br /></div>Kiranhttp://www.blogger.com/profile/02019143255160708858noreply@blogger.com2tag:blogger.com,1999:blog-4156628742577086320.post-79146919173294979022014-03-15T19:42:00.000-07:002014-03-16T01:11:29.815-07:00How to Fetch the Rally User Story List<div dir="ltr" style="text-align: left;" trbidi="on">public Map<String, Map<String, String>> getFolderList() throws IOException {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>if (folderReferenceMap.isEmpty()) {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>QueryRequest folderRequest = new QueryRequest("TestFolder");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// spaces<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>folderRequest.setFetch(new Fetch("FormattedID", "Name"));<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>LOGGER.info("Feting the folder list from Rally for project ["<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>+ ReadProperties.getInstance().getProperty("rallyProject")<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>+ "]");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>folderRequest.setQueryFilter(new QueryFilter("Project.Name", "=",<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>ReadProperties.getInstance().getProperty("rallyProject")));<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>QueryResponse folderQueryResponse = restApi.query(folderRequest);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// JsonObject testSetJsonObject =<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// testSetQueryResponse.getResults().get(0).getAsJsonObject();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonArray resultArray = folderQueryResponse.getResults();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>for (JsonElement result : resultArray) {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String rallyFolderObjId = result.getAsJsonObject().get("_ref")<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.getAsString();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>LOGGER.debug(rallyFolderObjId);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String rallyFolderName = result.getAsJsonObject()<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.get("_refObjectName").getAsString();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// System.out.println(rallyFolderName);<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String formattedId = result.getAsJsonObject()<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.get("FormattedID").getAsString();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// System.out.println(formattedId);<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String testFolder = "testfolder";<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>int stringPosition = rallyFolderObjId.indexOf(testFolder)<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>+ testFolder.length() + 1;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>rallyFolderObjId = rallyFolderObjId.substring(stringPosition,<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>rallyFolderObjId.length());<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// System.out.println(rallyFolderObjId);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>Map<String, String> folderMap = new HashMap<String, String>();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>folderMap.put(rallyFolderObjId, rallyFolderName);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>folderReferenceMap.put(formattedId, folderMap);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>LOGGER.debug("Folder list loading from Rally is complete");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>return folderReferenceMap;<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br /><div><br /></div></div>Kiranhttp://www.blogger.com/profile/02019143255160708858noreply@blogger.com0tag:blogger.com,1999:blog-4156628742577086320.post-732733067396454602014-03-15T19:41:00.000-07:002014-03-16T01:11:29.828-07:00How to fetch the Rally Folder List <div dir="ltr" style="text-align: left;" trbidi="on">public Map<String, Map<String, String>> getFolderList() throws IOException {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>if (folderReferenceMap.isEmpty()) {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>QueryRequest folderRequest = new QueryRequest("TestFolder");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// spaces<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>folderRequest.setFetch(new Fetch("FormattedID", "Name"));<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>LOGGER.info("Feting the folder list from Rally for project ["<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>+ ReadProperties.getInstance().getProperty("rallyProject")<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>+ "]");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>folderRequest.setQueryFilter(new QueryFilter("Project.Name", "=",<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>ReadProperties.getInstance().getProperty("rallyProject")));<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>QueryResponse folderQueryResponse = restApi.query(folderRequest);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// JsonObject testSetJsonObject =<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// testSetQueryResponse.getResults().get(0).getAsJsonObject();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonArray resultArray = folderQueryResponse.getResults();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>for (JsonElement result : resultArray) {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String rallyFolderObjId = result.getAsJsonObject().get("_ref")<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.getAsString();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>LOGGER.debug(rallyFolderObjId);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String rallyFolderName = result.getAsJsonObject()<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.get("_refObjectName").getAsString();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// System.out.println(rallyFolderName);<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String formattedId = result.getAsJsonObject()<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.get("FormattedID").getAsString();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// System.out.println(formattedId);<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String testFolder = "testfolder";<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>int stringPosition = rallyFolderObjId.indexOf(testFolder)<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>+ testFolder.length() + 1;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>rallyFolderObjId = rallyFolderObjId.substring(stringPosition,<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>rallyFolderObjId.length());<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// System.out.println(rallyFolderObjId);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>Map<String, String> folderMap = new HashMap<String, String>();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>folderMap.put(rallyFolderObjId, rallyFolderName);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>folderReferenceMap.put(formattedId, folderMap);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>xAFTRallyScenarioDataMap.getInstance().setFolderReferenceMap(<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>folderReferenceMap);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>LOGGER.debug("Folder list loading from Rally is complete");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>return folderReferenceMap;<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br /><div><br /></div></div>Kiranhttp://www.blogger.com/profile/02019143255160708858noreply@blogger.com1tag:blogger.com,1999:blog-4156628742577086320.post-77483298269815757962014-03-15T19:31:00.000-07:002014-03-16T01:11:29.839-07:00How to get the List of all Test Cases <div dir="ltr" style="text-align: left;" trbidi="on">//Below Code fetches the list of TestCases based on Filter (Project,Folder,Owner..)<br /><br />public List<String> getTestCaseDetails(RallyRestApi restApi,<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String methodName, String folder, String projectName)<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>throws IOException {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// All Test cases<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>QueryRequest testcases = new QueryRequest("Test Case");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>testcases.setFetch(new Fetch("FormattedID", "Name", "Owner",<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>"Test Folder"));<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>testcases.setQueryFilter(new QueryFilter("Project.Name", "=",<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>projectName).and(<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>new QueryFilter("TestFolder.Name", "=", folder)).and(<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>new QueryFilter("Method", "=", methodName)));<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>testcases.setOrder("FormattedID ASC");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>QueryResponse queryResponse = restApi.query(testcases);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonArray testCaseList = new JsonArray();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>if (queryResponse.wasSuccessful()) {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(String.format("\nTotal results: %d",<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>queryResponse.getTotalResultCount()));<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>testCaseList = queryResponse.getResults().getAsJsonArray();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>for (JsonElement testCase : testCaseList) {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonObject json = new JsonObject();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>json = testCase.getAsJsonObject();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(json.get("FormattedID"));<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(json.get("LastVerdict"));<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(testCase);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>testCaseInfoList.add(testCase.toString());<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>} else {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>for (String err : queryResponse.getErrors()) {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>System.err.println("\t" + err);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>return testCaseInfoList;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>Kiranhttp://www.blogger.com/profile/02019143255160708858noreply@blogger.com0tag:blogger.com,1999:blog-4156628742577086320.post-26073320389303597572014-03-15T19:22:00.000-07:002014-03-16T01:11:29.850-07:00How to get list of Rally Projects <div dir="ltr" style="text-align: left;" trbidi="on">public Map<String, List<String>> getProjectReferenceMap()<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>throws IOException {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// Get the workspace references<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>List<String> workspaceReferenceList = getWorkSpaceReferences();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String workSpaceName = "";<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String projectRef = "";<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>GetRequest workspaceRequest;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>GetResponse workspaceResponse;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>Map<String, List<String>> projectWorkSpaceMap = new HashMap<String, List<String>>();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>List<String> projectList = new ArrayList<String>();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// Iterate through each workspace and get all the project associated<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// with each workspace<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>for (String workspaceRef : workspaceReferenceList) {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// Get the workspaces<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>if (workspaceRef.equalsIgnoreCase("workSpace")) {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>workspaceRequest = new GetRequest(workspaceRef);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>workspaceRequest.setFetch(new Fetch("Name", "Projects"));<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>workspaceResponse = restApi.get(workspaceRequest);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonObject workspaceObj = workspaceResponse.getObject();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonArray workspaceArray = workspaceObj.get("Results")<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.getAsJsonArray();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonObject jo;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonElement projRef;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// For each workspace get the list of projects<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>for (int i = 0; i < workspaceArray.size(); i++) {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>jo = workspaceArray.get(i).getAsJsonObject();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>workSpaceName = jo.get("Name").getAsString();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>projRef = jo.get("Projects");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonObject jobject = projRef.getAsJsonObject();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonElement je = jobject.get("_ref");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>projectRef = je.toString();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>projectList.add(projectRef);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>projectWorkSpaceMap.put(workSpaceName, projectList);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>return projectWorkSpaceMap;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br /><div><br /></div></div>Kiranhttp://www.blogger.com/profile/02019143255160708858noreply@blogger.com1tag:blogger.com,1999:blog-4156628742577086320.post-71562306451076379292014-03-15T19:20:00.000-07:002014-03-16T01:11:29.859-07:00How to fetch the Rally WorkSpace Reference<div dir="ltr" style="text-align: left;" trbidi="on"><br />//Below code would return the list of Workspaces<br />private List<String> getWorkSpaceReferences() throws IOException {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>List<String> workSpaceRefArray = new ArrayList<String>();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// Get Subscription Response<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonObject subscriptionObject = getSubScriptionResponse();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// From the workspaces get all workspaces<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonElement workSpaces = subscriptionObject.get("Workspaces");<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// Check if the subscription contains multiple projects which are<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// returned as an array<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>if (workSpaces.isJsonArray()) {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// TODO<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>} else {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// Get the single workspace<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonObject myWorkspaceObject = workSpaces.getAsJsonObject();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonObject workspaceObject = myWorkspaceObject.getAsJsonObject();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// Get the workspace reference<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String workspaceRef = workspaceObject.get("_ref").getAsString();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>workSpaceRefArray.add(workspaceRef);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>return workSpaceRefArray;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>Kiranhttp://www.blogger.com/profile/02019143255160708858noreply@blogger.com0tag:blogger.com,1999:blog-4156628742577086320.post-67586934503399706772014-03-15T19:18:00.000-07:002014-03-16T01:11:29.871-07:00How to get User Subscription details from Rally<div dir="ltr" style="text-align: left;" trbidi="on"><br /><br /><br />//Below code gives the User Details Subscriptions<br />private JsonObject getSubScriptionResponse() {<br /><br /> RallyRestApi restApi = new RallyRestApi(new URI(rallyURL),<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>"user@yourcomapany.com", "password");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>QueryRequest subscriptionRequest = new QueryRequest("Subscriptions");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>subscriptionRequest.setFetch(new Fetch("Name", "SubscriptionID",<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>"Workspaces", "Name"));<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>QueryResponse subscriptionQueryResponse = null;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonObject subscriptionQueryObject = null;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>try {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>subscriptionQueryResponse = restApi.query(subscriptionRequest);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonArray subscriptionQueryResults = subscriptionQueryResponse<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.getResults();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonElement subscriptionQueryElement = subscriptionQueryResults<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.get(0);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>subscriptionQueryObject = subscriptionQueryElement<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.getAsJsonObject();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>this.subscriptionId = subscriptionQueryObject.get("SubscriptionID")<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.toString();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Read Subscription: " + subscriptionId);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>} catch (IOException e) {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>e.printStackTrace();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>return subscriptionQueryObject;<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>Kiranhttp://www.blogger.com/profile/02019143255160708858noreply@blogger.com0tag:blogger.com,1999:blog-4156628742577086320.post-39830780493526477722014-03-15T18:45:00.000-07:002014-03-16T01:11:29.883-07:00How to Delete Rally Test Cases<div dir="ltr" style="text-align: left;" trbidi="on"><br /></div>Kiranhttp://www.blogger.com/profile/02019143255160708858noreply@blogger.com0tag:blogger.com,1999:blog-4156628742577086320.post-47247484999653362792014-03-15T18:44:00.000-07:002014-03-16T01:11:29.894-07:00How to Update Rally Test Cases and TestCase Steps<div dir="ltr" style="text-align: left;" trbidi="on">//Below code allows you to update TestCase name as well as the Test Steps associated with the Test Case<br /><br />public static void getTestSteps() throws IOException, URISyntaxException,<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JSONException {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String rallyURL = "https://us1.rallydev.com";<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>RallyRestApi restApi = new RallyRestApi(new URI(rallyURL),<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>"xxxx@yourcompany.com", "password");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span><br /> //Query the Test Case that you want to update<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>QueryRequest testCaseRequest = new QueryRequest("TestCase");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>testCaseRequest.setFetch(new Fetch("TC2033", "Name", "Steps")); //<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>testCaseRequest.setQueryFilter(new QueryFilter("FormattedID", "=",<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>"TC2033"));<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>QueryResponse testCaseResponse = restApi.query(testCaseRequest);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String testCaseName = "";<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonArray jArray = testCaseResponse.getResults();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonObject testCase = jArray.get(0).getAsJsonObject();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>testCaseName = jArray.get(0).getAsJsonObject().get("_refObjectName")<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.getAsString();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Updating the test case with new Description ");<br /> //Get the Test Case Object Refernce<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String testCaseObjReference = jArray.get(0).getAsJsonObject()<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.get("_ref").getAsString();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonObject jsonObject = new JsonObject();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>jsonObject.addProperty("Name", "Final test New Test Case Name");<br /> //Update the test case<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>UpdateRequest tcUpdateRequest = new UpdateRequest(<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>testCaseObjReference, jsonObject);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>UpdateResponse updateResponse = restApi.update(tcUpdateRequest);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>if (updateResponse.wasSuccessful()) {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Test case Name updated successfully");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Now updating the test steps");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>} else {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Failed to update Test Case Name");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br /><br /> <span class="Apple-tab-span" style="white-space: pre;"> </span>QueryRequest testStepRequest = new QueryRequest(<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>testCase.getAsJsonObject("Steps"));<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>testStepRequest.setFetch(new Fetch("StepIndex", "Input",<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>"ExpectedResult"));<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonArray testCaseSteps = restApi.query(testStepRequest)<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.getResults();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>for (int j = 0; j < testCaseSteps.size(); j++) {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(testCaseSteps.get(j).getAsJsonObject()<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.get("StepIndex").getAsString()<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>+ ": "<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>+ testCaseSteps.get(j).getAsJsonObject().get("Input")<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.getAsString()<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>+ ":"<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>+ testCaseSteps.get(j).getAsJsonObject()<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.get("ExpectedResult").getAsString());<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(testCaseSteps.get(j).getAsJsonObject()<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.get("_ref").getAsString());<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String testStepRefObject = testCaseSteps.get(j)<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.getAsJsonObject().get("_ref").getAsString();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonObject testCaseStepObject = new JsonObject();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>testCaseStepObject.addProperty("Input", "NewStepThree");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>UpdateRequest updateRequest = new UpdateRequest(<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>testStepRefObject, testCaseStepObject);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>UpdateResponse upResponse = restApi.update(updateRequest);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>if (upResponse.wasSuccessful()) {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Successfuly Updated");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>} else {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Failed to update");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>Kiranhttp://www.blogger.com/profile/02019143255160708858noreply@blogger.com0tag:blogger.com,1999:blog-4156628742577086320.post-73852424982032409232014-03-15T18:42:00.000-07:002014-03-16T01:11:29.905-07:00How to add attachements to Rally test cases<div dir="ltr" style="text-align: left;" trbidi="on">//This Snippet will Update Test Case Result and add Attachment to a Test Case<br /><br /><br />// Create and configure a new instance of RallyRestApi<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// Connection parameters<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String rallyURL = "https://rally1.rallydev.com";<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String wsapiVersion = "v2.0";<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String applicationName = "RestExample_CreateTestCaseResultAddAttachment";<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// Credentials<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String userName = "user@company.com";<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String userPassword = "topsecret";<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>RallyRestApi restApi = new RallyRestApi(new URI(rallyURL), userName,<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>userPassword);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>restApi.setWsapiVersion(wsapiVersion);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>restApi.setApplicationName(applicationName);<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// Workspace and Project Settings<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String myWorkspace = "/workspace/12345678910";<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String myProject = "/project/12345678911";<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// Test Case to which we want to add a result<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String testCaseFormattedID = "TC40";<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// User name of tester<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String testerRallyID = "tester@testit.com";<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// Reference to created TestCaseResult<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String testCaseResultRef = "";<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// File handle for image to attach<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>RandomAccessFile myImageFileHandle;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String imageFilePath = "/home/username/Pictures/";<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String imageFileName = "image1.txt";<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String fullImageFile = imageFilePath + imageFileName;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String imageBase64String;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>long attachmentSize;<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// Open file<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>myImageFileHandle = new RandomAccessFile(fullImageFile, "r");<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// Read User<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>QueryRequest userRequest = new QueryRequest("User");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>userRequest.setFetch(new Fetch("UserName", "Subscription",<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>"DisplayName"));<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>userRequest.setQueryFilter(new QueryFilter("UserName", "=",<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>testerRallyID));<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>QueryResponse userQueryResponse = restApi.query(userRequest);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonArray userQueryResults = userQueryResponse.getResults();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonObject userQueryObject = userQueryResults.get(0).getAsJsonObject();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String userRef = userQueryObject.get("_ref").getAsString();<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// Query for Test Case to which we want to add results<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>QueryRequest testCaseRequest = new QueryRequest("TestCase");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>testCaseRequest.setFetch(new Fetch("FormattedID", "Name"));<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>testCaseRequest.setQueryFilter(new QueryFilter("FormattedID", "=",<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>testCaseFormattedID));<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>QueryResponse testCaseQueryResponse = restApi.query(testCaseRequest);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonObject testCaseJsonObject = testCaseQueryResponse.getResults()<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.get(0).getAsJsonObject();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String testCaseRef = testCaseQueryResponse.getResults().get(0)<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.getAsJsonObject().get("_ref").getAsString();<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// Query for Test Set to which we want to add Test Case<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>QueryRequest testSetQuery = new QueryRequest("TestSet");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>testSetQuery.setFetch(new Fetch("FormattedID", "Name", "TestCases"));<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>testSetQuery.setWorkspace(myWorkspace);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>testSetQuery.setProject(myProject);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>testSetQuery.setQueryFilter(new QueryFilter("FormattedID", "=", "TS5"));<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>QueryResponse testSetQueryResponse = restApi.query(testSetQuery);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonObject testSetJsonObject = testSetQueryResponse.getResults().get(0)<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.getAsJsonObject();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String testSetRef = testSetJsonObject.get("_ref").getAsString();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Test Set Ref: " + testSetRef);<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>try {<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// Add a Test Case Result<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Creating Test Case Result...");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonObject newTestCaseResult = new JsonObject();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>newTestCaseResult.addProperty("Verdict", "Inconclusive");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>newTestCaseResult.addProperty("Date", "2013-09-04T18:00:00.000Z");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>newTestCaseResult.addProperty("Notes",<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>"Automated Selenium Test Runs");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>newTestCaseResult.addProperty("Build", "2013.09.04.0020101");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>newTestCaseResult.addProperty("Tester", userRef);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>newTestCaseResult.addProperty("TestCase", testCaseRef);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>newTestCaseResult.addProperty("TestSet", testSetRef);<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>CreateRequest createRequest = new CreateRequest("testcaseresult",<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>newTestCaseResult);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>CreateResponse createResponse = restApi.create(createRequest);<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>if (createResponse.wasSuccessful()) {<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(String.format("Created %s", createResponse<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.getObject().get("_ref").getAsString()));<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// Read Test Case Result<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>testCaseResultRef = Ref.getRelativeRef(createResponse<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.getObject().get("_ref").getAsString());<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(String.format(<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>"\nReading Test Case Result %s...", testCaseResultRef));<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>GetRequest getRequest = new GetRequest(testCaseResultRef);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>getRequest.setFetch(new Fetch("Date", "Verdict"));<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>GetResponse getResponse = restApi.get(getRequest);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonObject obj = getResponse.getObject();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(String.format(<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>"Read Test Case Result. Date = %s, Verdict = %s", obj<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.get("Date").getAsString(), obj.get("Verdict")<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.getAsString()));<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>try {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// Get and check length<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>long longLength = myImageFileHandle.length();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>long maxLength = 5000000;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>if (longLength >= maxLength)<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>throw new IOException(<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>"File size >= 5 MB Upper limit for Rally.");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>int fileLength = (int) longLength;<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// Read file and return data<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>byte[] fileBytes = new byte[fileLength];<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>myImageFileHandle.readFully(fileBytes);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>imageBase64String = Base64.encodeBase64String(fileBytes);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>attachmentSize = fileLength;<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// First create AttachmentContent from image string<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonObject myAttachmentContent = new JsonObject();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>myAttachmentContent.addProperty("Content",<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>imageBase64String);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>CreateRequest attachmentContentCreateRequest = new CreateRequest(<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>"AttachmentContent", myAttachmentContent);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>CreateResponse attachmentContentResponse = restApi<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.create(attachmentContentCreateRequest);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String myAttachmentContentRef = attachmentContentResponse<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.getObject().get("_ref").getAsString();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Attachment Content created: "<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>+ myAttachmentContentRef);<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// Now create the Attachment itself<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonObject myAttachment = new JsonObject();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>myAttachment.addProperty("TestCaseResult",<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>testCaseResultRef);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>myAttachment.addProperty("Content", myAttachmentContentRef);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>myAttachment.addProperty("Name", "AttachmentFromREST.jpg");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>myAttachment.addProperty("Description",<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>"Attachment From REST");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>myAttachment.addProperty("ContentType", "image/jpg");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>myAttachment.addProperty("Size", attachmentSize);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>myAttachment.addProperty("User", userRef);<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>CreateRequest attachmentCreateRequest = new CreateRequest(<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>"Attachment", myAttachment);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>CreateResponse attachmentResponse = restApi<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.create(attachmentCreateRequest);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String myAttachmentRef = attachmentResponse.getObject()<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.get("_ref").getAsString();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Attachment created: "<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>+ myAttachmentRef);<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>if (attachmentResponse.wasSuccessful()) {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Successfully created Attachment");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>} else {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String[] attachmentContentErrors;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>attachmentContentErrors = attachmentResponse<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.getErrors();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.println("Error occurred creating Attachment: ");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>for (int i = 0; i < attachmentContentErrors.length; i++) {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(attachmentContentErrors[i]);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>} catch (Exception e) {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.println("Exception occurred while attempting to create Content and/or Attachment: ");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>e.printStackTrace();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>} else {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String[] createErrors;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>createErrors = createResponse.getErrors();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>.println("Error occurred creating Test Case Result: ");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>for (int j = 0; j < createErrors.length; j++) {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(createErrors[j]);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>} finally {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// Release all resources<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>restApi.close();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>myImageFileHandle.close();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>Kiranhttp://www.blogger.com/profile/02019143255160708858noreply@blogger.com0tag:blogger.com,1999:blog-4156628742577086320.post-17335237729451253072014-03-15T18:41:00.000-07:002014-03-16T01:11:29.918-07:00How to add test steps to an Exiting test cases in Rally<div dir="ltr" style="text-align: left;" trbidi="on"><br /></div>Kiranhttp://www.blogger.com/profile/02019143255160708858noreply@blogger.com0tag:blogger.com,1999:blog-4156628742577086320.post-34127696914617443042014-01-31T19:45:00.000-08:002014-03-16T01:06:14.350-07:00Inspecting IOS elements and recording tests using Appium on Simulator<div dir="ltr" style="text-align: left;" trbidi="on">1.Download & Install the GUI version of Appium server(check appium.io)<br />2.Open the Appium server. You should see some thing like below<br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeaBTx7DTb2qpKqPdOEGi2vbhyphenhyphenrbq5Z2C7T1NJrBh_-_KUP4hsssXU_srOVLABvl7_Ioartb09dPV4-aA2rQNZ0DldMJkONw22-ZZ9Oi58aYVwoIISTrpMnhjwgGQ9vzXAAioU-ZHoibgC/s1600/Screen+Shot+2014-02-01+at+7.44.50+AM.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeaBTx7DTb2qpKqPdOEGi2vbhyphenhyphenrbq5Z2C7T1NJrBh_-_KUP4hsssXU_srOVLABvl7_Ioartb09dPV4-aA2rQNZ0DldMJkONw22-ZZ9Oi58aYVwoIISTrpMnhjwgGQ9vzXAAioU-ZHoibgC/s1600/Screen+Shot+2014-02-01+at+7.44.50+AM.png" height="316" width="400" /></a></div><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />3. We would be inspecting the IOS element using this GUI version of appium<br />4. Check the flag AppPath an provide the path to your .app(you can find the path from Xcode)<br />Ex: The path I provided here is '/Users/kiran/Library/Developer/Xcode/DerivedData/UICatalog-fqsvdhmisheuvqbsuomezsujnqgi/Build/Products/Debug-iphonesimulator/UICatalog.app'<br />5.Ensure you pick the .app path which is in '<b>Debug-iphonesimulator</b>' folder and not '<b>Debug-iphoneos folder </b>(when you run the UICatalog code on a real device from Xcode, the .app will be created in 'Debug-iphoneos).<br />6.Now click on '<b>Launch</b>' button to start the appium server.<br />7.Click on '<b>i'</b> button to launch the IOS inspector<br />8.Check the below video to see how to inspect elements on IOS simulator and record the tests<br /><br />You can even play back the tests with in the appium recorder<br />Check the following video link to have a glance on how to inspect and record<br /><a href="https://www.youtube.com/watch?v=BNgFixhS_AM&feature=youtu.be">https://www.youtube.com/watch?v=BNgFixhS_AM&feature=youtu.be</a><br /><br />You can run your tests either starting the appium from GUI mode or from terminal mode.<br />Now lets c how to run the tests when appium is launched from terminal<br />Stop the GUI mode appium server<br />open the terminal and type the command appium &. This will launch the appium server on default port 4723<br /><br /><br /></div>Kiranhttp://www.blogger.com/profile/02019143255160708858noreply@blogger.com1tag:blogger.com,1999:blog-4156628742577086320.post-86282422800642522252014-01-28T08:28:00.000-08:002014-03-16T01:11:29.928-07:00Rally API integration with Java<div dir="ltr" style="text-align: left;" trbidi="on">Recently I worked on Rally API integration with our Java Automation framework .Rally is the ALM (Application Life Management tool) . In this blog I would be posting my experiences in Integrating Rally API and the context would be more on Test Management<br /><div><br /></div><div>Rally exposes some webservices typically REST services that allows user to Manage the Test Management. To access the webservices Rally does not provide any API. How ever there are many open source Rest Clients for Java,C#,python.....</div><div><br /></div><div>I used Java Rest Client to access the Rally REST services you can download the libraries from the link</div><div>https://github.com/RallyTools/RallyRestToolkitForJava</div></div>Kiranhttp://www.blogger.com/profile/02019143255160708858noreply@blogger.com3tag:blogger.com,1999:blog-4156628742577086320.post-24902498140753949562014-01-28T08:24:00.000-08:002014-03-16T01:11:29.939-07:00How to update the test cases in rally with our Automation Test case results<div dir="ltr" style="text-align: left;" trbidi="on">Will soon post the BLOG...</div>Kiranhttp://www.blogger.com/profile/02019143255160708858noreply@blogger.com2tag:blogger.com,1999:blog-4156628742577086320.post-45826673336687959622014-01-28T08:23:00.001-08:002014-03-16T01:11:29.958-07:00How to create a Test Case using Rally Rest API<div dir="ltr" style="text-align: left;" trbidi="on">Will soon post the BLOG</div>Kiranhttp://www.blogger.com/profile/02019143255160708858noreply@blogger.com0tag:blogger.com,1999:blog-4156628742577086320.post-20739431324124504822014-01-28T08:23:00.000-08:002014-03-16T01:11:29.949-07:00How to Query for list of Test Cases using Query Filter<div dir="ltr" style="text-align: left;" trbidi="on">Will soon post the BLOG</div>Kiranhttp://www.blogger.com/profile/02019143255160708858noreply@blogger.com0tag:blogger.com,1999:blog-4156628742577086320.post-70383172725967700212014-01-28T08:22:00.000-08:002014-03-16T01:11:29.967-07:00How to Login in to Rally using Java Rest API client<div dir="ltr" style="text-align: left;" trbidi="on">To access to Rally you need to login authentication<br />public RallyRestApi authenticate() throws URISyntaxException, Exception {<br /><br /> //Provide Rally url,username and password<br /> RallyRestApi restApi = new RallyRestApi(new URI(https://us1.rallydev.com),<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>"username, "password");<br /><br /> //If you are behind a proxy server provide the following<br /> restApi.setProxy("proxyserver", "userName", "password");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>try {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>if (restApi == null) {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>LOGGER.debug("Authenticating Rally with provided credentials");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Initializing Rally Connector with user : "<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>+ userName);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>LOGGER.debug("Trying to connect and login to rally : ");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>restApi = new RallyRestApi(new URI(rallyUrl), userName,<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>password);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>QueryRequest userRequest = new QueryRequest("User");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// userRequest.setFetch(new Fetch("UserName", "Subscription",<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>// "DisplayName"));<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>userRequest.setQueryFilter(new QueryFilter("UserName", "=",<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>ReadProperties.getInstance().getProperty("username")));<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>QueryResponse userQueryResponse;<br /><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>userQueryResponse = restApi.query(userRequest);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonArray userQueryResults = userQueryResponse.getResults();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonElement userQueryElement = userQueryResults.get(0);<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>JsonObject userQueryObject = userQueryElement.getAsJsonObject();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String userRef = userQueryObject.get("_ref").toString();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>LOGGER.info("Rally Authentication Successful!");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>} catch (Exception e) {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>LOGGER.error("Failed to Authenticate User [" + userName + "]"<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>+ e.getMessage());<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>e.printStackTrace();<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>return restApi;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br /><div><br /></div></div>Kiranhttp://www.blogger.com/profile/02019143255160708858noreply@blogger.com0tag:blogger.com,1999:blog-4156628742577086320.post-63581657920301495432014-01-09T17:45:00.000-08:002014-03-16T01:06:14.359-07:00Inspecting IOS elements using Appium Inspector for .app file<div dir="ltr" style="text-align: left;" trbidi="on"><ol style="text-align: left;"><li>Launch the appium Server (GUI version)</li><li>You need to setup additional Parameters using to run the tests on Real Devices</li><li>Choose the app path. Here you need to choose from Xcode iphoneos folder as mentioned in one of my previous blog ex: <span style="color: #3933ff; font-family: Monaco; font-size: 11px;">/Users/kiran/Library/Developer/Xcode/DerivedData/UICatalog-fqsvdhmisheuvqbsuomezsujnqgi/Build/Products/Debug-iphoneos/UICatalog.app</span></li><li>Check the option UDID. UDID is the device ID. You can find it from Xcode Organiser.</li><li>Open xcode. Open organiser which is on top right of your Xcode</li><li>Select you device in the left list of the organiser</li><li>You should be able to see the device information</li><li>Here <b>Identifier </b>is the<b> UDID.</b></li><li>provide this is identifier in the appium server option UDID</li><li>Select option Force Device with selected option as iPhone</li><li>Select option BundleID. This is the application bundle id. To find this Id follow the below screenshot</li></ol><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiwkYIAe0uEE4pK0CE1PED2Xn2FjgXv2Xx1zZUq__hne5Sh1vjrQQS1SW9OWGxng3KzE7R8bS0XH7bVbMAClsty7v_smtg1NH4gOp8T2GWUQG5eb1wMoXmT1pFaQzwVObavyngL9Sg4xbn/s1600/organiser.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiwkYIAe0uEE4pK0CE1PED2Xn2FjgXv2Xx1zZUq__hne5Sh1vjrQQS1SW9OWGxng3KzE7R8bS0XH7bVbMAClsty7v_smtg1NH4gOp8T2GWUQG5eb1wMoXmT1pFaQzwVObavyngL9Sg4xbn/s1600/organiser.png" height="412" width="640" /></a></div><ol style="text-align: left;"><li>I used <b>Iphone configuration utility(</b>freeware)<b> </b>to find the app bundle path. Google it and your should be able to find the download references</li><li>Open the Iphone config utility, Under Application you should be able to see the app bundle id. In this case, <b>'com.yourcompany.UICatalog'. </b>Set this to the appium server option '<b>BundleID</b>'</li></ol><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnLBsW64DE4Qqp-mEXDV593kn0makgVW7ZtPi5Aq7-ZYkTQ1YUBicGfqVahq9PuuBcljl9CL6nN2rJbsSb8kTz1Yd2_ycLkKCZYMEVKe_PTTZ6OnS51P7uIzhcaRM4HwXx9mlSRX9Zvgbe/s1600/BundleID.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnLBsW64DE4Qqp-mEXDV593kn0makgVW7ZtPi5Aq7-ZYkTQ1YUBicGfqVahq9PuuBcljl9CL6nN2rJbsSb8kTz1Yd2_ycLkKCZYMEVKe_PTTZ6OnS51P7uIzhcaRM4HwXx9mlSRX9Zvgbe/s1600/BundleID.png" height="440" width="640" /></a></div><div><ol><li>Start the appium server</li><li>Click on Inspector Icon</li><li>You should see your Iphone Screen in the Inspector</li></ol><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbLlUOGU-ssMSF7ltObd2mbfAwY7AT9YwcetKq6FFyPXjLNWpa94ilaDJVvsnGWgrBnyueYiu0hK2AvZIQ6ce8d2D_7Tc_lEv_qB-JpG0-P4ZDeC9DiB3ruNFoMw0sq_tO1PILZmQDTaDe/s1600/Screen+Shot+2014-02-01+at+2.39.38+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbLlUOGU-ssMSF7ltObd2mbfAwY7AT9YwcetKq6FFyPXjLNWpa94ilaDJVvsnGWgrBnyueYiu0hK2AvZIQ6ce8d2D_7Tc_lEv_qB-JpG0-P4ZDeC9DiB3ruNFoMw0sq_tO1PILZmQDTaDe/s1600/Screen+Shot+2014-02-01+at+2.39.38+PM.png" height="376" width="640" /></a></div><div><br /></div><div><br /></div></div><div><br /></div></div>Kiranhttp://www.blogger.com/profile/02019143255160708858noreply@blogger.com0tag:blogger.com,1999:blog-4156628742577086320.post-17774166095241324762014-01-02T22:34:00.000-08:002014-03-16T01:06:14.367-07:00Running tests on Real Device when app is installed using .ipa file<div dir="ltr" style="text-align: left;" trbidi="on"><br /></div>Kiranhttp://www.blogger.com/profile/02019143255160708858noreply@blogger.com0tag:blogger.com,1999:blog-4156628742577086320.post-83445550905314677922013-12-01T18:46:00.000-08:002014-03-16T01:06:14.373-07:00 Prerequisites for running Tests On Real Devices<div dir="ltr" style="text-align: left;" trbidi="on">For Running tests on Real Devices (using .a<b>pp </b>file) You will need the following setup<br /><br /><ul style="text-align: left;"><li>Apple Developer profile</li><li>UDID of the Device(Iphone)</li><li>Application(.app) bundle ID</li><li>Your .app should be signed with valid provisioning profile</li><li>You have to build the rebuild .app file with your profile and should be able to deploy this .app from Xcode on your device.</li></ul><div><br /></div><br />For Running tests on Real Devices (using .<b>ipa </b>file) You will need the following Setup<br /><div><br /><ul style="text-align: left;"><li>Apple Developer profile</li><li>UDID of the Device(Iphone)</li><li>Application(.IPA) bundle ID</li><li>Your .Ipa file should be signed with valid developer provisioning profile</li><li>Since .Ipa file is an installation file you will need to have third party library called libimobile device. Appium internally uses the libimobile device.nstall .Ipa files on the real devices.</li><li>Download the source as zip (option provided on the bottom right of the page) from the following linkhttps://github.com/libimobiledevice/libimobiledevice</li><li>To be continued.....</li></ul></div></div>Kiranhttp://www.blogger.com/profile/02019143255160708858noreply@blogger.com2tag:blogger.com,1999:blog-4156628742577086320.post-55877631523985729622013-12-01T18:45:00.000-08:002014-03-16T01:06:14.380-07:00Create Appium tests targetting IOS Simulator<div dir="ltr" style="text-align: left;" trbidi="on">Creating Tests for your simulator<br />1. Install the . app file on your Xcode simulator<br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZjSze2nljCDzRvonMq52QExQxQGbryL6lP7RcnzrnyALyYiSDuURSZbVGMMdGzFr_HCAJOZj-ur8w4BxhV40R0EbH-SVTU-9bV-bPQu11FM8zRfLn-XQaKMgyu5PZEkhF6XgDH1ZXz8zX/s1600/Screen+Shot+2014-01-31+at+10.07.42+PM.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZjSze2nljCDzRvonMq52QExQxQGbryL6lP7RcnzrnyALyYiSDuURSZbVGMMdGzFr_HCAJOZj-ur8w4BxhV40R0EbH-SVTU-9bV-bPQu11FM8zRfLn-XQaKMgyu5PZEkhF6XgDH1ZXz8zX/s1600/Screen+Shot+2014-01-31+at+10.07.42+PM.png" height="343" width="400" /></a></div><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />2.Get the .App path<br />3.You need to have selenium libraries to write the appium tests as appium used the Web driver interface<br />4.Open eclipse and write the following code. As same as your selenium web driver web tests<br />5.Start your appium from terminal using <b>appium &</b><br /><b><br /></b><b>Note: </b>Object id's that i have used in the below snapshot might be different for UICatelog application. please change them accordingly<br /><div class="separator" style="clear: both; text-align: center;"></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDBcpJutnyStrMwhujmN009zQkCpSQixK58xWbiWKdhsrZCTP5DYaF0900fdrBHRegCMIefXe6Qoxl9akonv9ae2E7IkwIREe74PLpaXgRSerkeCA5GQub5jWxr9bOPdqAgOzMFPEVm92O/s1600/Screen+Shot+2014-01-31+at+10.16.19+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDBcpJutnyStrMwhujmN009zQkCpSQixK58xWbiWKdhsrZCTP5DYaF0900fdrBHRegCMIefXe6Qoxl9akonv9ae2E7IkwIREe74PLpaXgRSerkeCA5GQub5jWxr9bOPdqAgOzMFPEVm92O/s1600/Screen+Shot+2014-01-31+at+10.16.19+PM.png" height="376" width="640" /></a></div><br /></div>Kiranhttp://www.blogger.com/profile/02019143255160708858noreply@blogger.com0tag:blogger.com,1999:blog-4156628742577086320.post-89858157706701334432013-12-01T18:43:00.000-08:002014-03-16T01:06:14.387-07:00Setting up Appium Server<div dir="ltr" style="text-align: left;" trbidi="on"><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 18px;">Go to </span><a href="http://appium.io/" style="background-color: white; color: #888888; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 18px; text-decoration: none;">http://appium.io/</a><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 18px;"> and download appium server. You have couple of option which appium to download</span><br /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 18px;">1. appium UI</span><br /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 18px;">2. appium nodeJs</span><br /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 18px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 18px;">I prefer nodeJs as I can launch it directly from code through command line terminal. However some times I use the UI version to inspect the elements. You can even launch the Inspector from terminal, hmm need to figure out and would be posting soon.</span><br /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 18px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 18px;">To work with appium on ease,I would recommend you to have your own MAC laptop with SDK 6. SDK 7 should also be fine but preferebly SDK 6 is recommended.</span><br /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 18px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 18px;">Setup.</span><br /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 18px;">1. Open up your mac terminal</span><br /><div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 18px;"><span style="font-family: inherit;">2. Type the command <span class="pln" style="line-height: 20px; white-space: pre-wrap;">sudo npm install </span><span class="pun" style="color: #666600; line-height: 20px; white-space: pre-wrap;">-</span><span class="pln" style="line-height: 20px; white-space: pre-wrap;">g appium</span></span></div><h4 style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 18px; margin: 0px; position: relative;"><div><span class="pln" style="line-height: 20px; white-space: pre-wrap;"><span style="font-family: inherit;">3<span style="font-weight: normal;">.You should see appium getting downloaded and installed</span></span></span><span style="font-weight: normal;"><span class="pln" style="line-height: 20px; white-space: pre-wrap;"><span style="font-family: inherit;">That's it. What's next?</span></span><span class="pln" style="line-height: 20px; white-space: pre-wrap;"><span style="font-family: inherit;">1.You should have your Sample IOS app '.app'</span></span><span class="pln" style="line-height: 20px; white-space: pre-wrap;"><span style="font-family: inherit;">2. Get xCode 4.6 installed </span></span></span></div><div><span style="font-weight: normal;"><span class="pln" style="line-height: 20px; white-space: pre-wrap;">3.Download the sample app source code from the URL</span></span></div><div><span style="font-weight: normal;"><span class="pln" style="line-height: 20px; white-space: pre-wrap;"><a href="https://developer.apple.com/library/ios/samplecode/uicatalog/introduction/intro.html" style="color: #888888; text-decoration: none;">https://developer.apple.com/library/ios/samplecode/uicatalog/introduction/intro.html</a></span></span></div><div><span style="font-weight: normal;">4. Open the code in xCode and build and run the app on Simulator. Good now you have your .app file built in project's product folder. Get the path of the app and note it some where (Check the below Image)</span><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8yyRx7F2vA9cqK49yEbWzNheXvLCfQLtAd6ThIZBtjWWAT6mPyLXN_nVWSFBPcQ3xJEyLjEZR_9cIdrUGS0giJL3cxrvv23fmjV6WGAh66-R95RkDaa-pmxMma2LtpzSHWZkLDyYVGrHt/s1600/Screen+Shot+2014-01-31+at+9.49.53+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8yyRx7F2vA9cqK49yEbWzNheXvLCfQLtAd6ThIZBtjWWAT6mPyLXN_nVWSFBPcQ3xJEyLjEZR_9cIdrUGS0giJL3cxrvv23fmjV6WGAh66-R95RkDaa-pmxMma2LtpzSHWZkLDyYVGrHt/s1600/Screen+Shot+2014-01-31+at+9.49.53+PM.png" height="190" width="640" /></a></div><span style="font-weight: normal;"><br /></span></div><div><span style="font-weight: normal;"><br /></span></div><div><span style="font-weight: normal;">Next? Setting up your appium server to run your tests. Initially we will see how to setup appium server for Simulator tests.</span></div><div><span style="font-weight: normal;">1.Open the terminal and just run the command </span>appium &</div><div>2.<span style="font-weight: normal;">You should see the messages in the terminal that appium server is started on port 4723. This is the default port and can be customized later.</span></div><div><span style="font-weight: normal;">3.All set to run your tests.</span></div></h4></div>Kiranhttp://www.blogger.com/profile/02019143255160708858noreply@blogger.com0