Monday, December 31, 2018

public class StringReverse {
public static void main(String[] args) {
String str="selenium",reverse="";
for(int i=str.length()-1;i>=0;i--) {
reverse=reverse+str.charAt(i);
}
System.out.println(reverse);
}
}
Output: muineles

What is TesNG and What are the annotations in the TestNG?
     Ans: TestNG is testing framework to run the test cases. TestNG supports annotations like:
      @BeforeSuite
         @BeforeTest
           @BeforeClss
              @Test
              @Dataprovider
              @Cachelookup
           @AfterClass
         @AfterTest
       @AfterSuite
Difference between Hashmap and Hashtable?
  • HashMap is non-synchronized. Hashtable is synchronized. 
  • HashMap allows multiple threads where as hashtable doesn't
  • HashMap is not thread-safe where as hashtable is.
  • HashMap allows one null key and any number of null values. Hashtable doesn’t allow null keys and null values.
Note: We can make the HashMap as synchronized by calling this code
Map m = Collections.synchronizedMap(hashMap) [or] can be used ConcurrentHashMap for thread safe. HashMap throws ConcurrentModificationException when if other thread try to add/modify the contents of Object
Difference between ArrayList and LinkedList?
Similarities: Both implements List interface(linkedlist also implements deque interface), maintains insertion order and can contain duplicate elements. Both are non synchronized classes can be made synchronized explicitly by using Collections.synchronizedList method .
Differences: 
  • ArrayList internally uses a dynamic array to store the elements. LinkedList internally uses a doubly linked list to store the elements.
  • Updation and Deletion(manipulation) are slow because it internally uses an array. If any element is removed from the array, all the bits are shifted in memory. Manipulation with LinkedList is faster in LinkedList because it uses a doubly linked list, so no bit shifting is required in memory. 
  • An ArrayList class can act as a list only because it implements only List. LinkedList class can act as a list and queue both because it implements List as well as Deque interfaces
  • ArrayList is better for storing and accessing data. LinkedList is better for manipulating data.
  • LinkedList has more memory overhead than ArrayList because in ArrayList each index only holds actual object (data) but in case of LinkedList each node holds both data and address of next and previous node.
Performance: 
  • (ArrayList gives variable performance O(n) in worst case (while removing first element) and O(1) in best case (While removing last element). LinkedList remove operation gives O(1) performance)
  • ArrayList search operation is pretty fast compared to the LinkedList search operation. ArrayList gives the performance of O(1) while LinkedList performance is O(n).
Difference between Arraylist and HashMap?
  • ArrayList implements List Interface while HashMap is an implementation of Map interface.
  • Memory consumption is high in HashMap compared to the ArrayList.
  • ArrayList maintains the insertion order while HashMap doesn't maintain any order. ArrayList stores the elements only as value and maintain internally the indexing for every element. While HashMap stores elements with key and value pair, i.e. two objects. So HashMap takes more memory comparatively.
  • ArrayList allows duplicate elements but HashMap doesn't allow duplicate keys (It does allow duplicate values)
  • In ArrayList, an element can be fetched easily by specifying the index of it. But in HashMap, the elements is fetched by its corresponding key. It means that the key must be remembered always.
  •  In ArrayList, any number of null elements can be stored. While in HashMap, only one null key is allowed, but the values can be of any number.
ARRAYLISTHASHMAP
The java ArrayList implements List InterfaceThe java HashMap is implements Map interface
ArrayList always maintain insertion order of the elementsHashMap does not maintain the insertion order
ArrayList only stores value or elementHashMap stores key and value pairs
ArrayList can contain duplicate elementsHashMap does not contain duplicate keys but contain duplicate values.
We can have any numbers of null elements in ArrayListWe can have only one null key and any number of null values in HashMap
ArrayList get() method always gives an O(1) performanceHashMap get()method can be O(1) in the best case and O(n) in the worst case
A Java Program to retrieve the data from an excel file?
  Below is the code to read .xlsx file.
                               XSSFWorkbook -> to read .xlsx file (Microsoft Excel 2003 and earlier)
                               HSSFWorkbook -> to read .xls file (Microsoft Excel 2007 and later)
   Ans: We can read  data from Excel using Apache POI library.

Saturday, December 29, 2018

System.out.println(). Simply SOP
System:  is a final class in java.lang package. This class has methods to provide access to Standard Input, Standard Output and Standard Error Output streams. Can not be instantiated.
out: is final static variable of type PrintStream declared in the System class.
println(): is a overloaded method in PrintStream class. It accepts an expression as an argument and displays it in String form to the Standard Output. It is also a reference variable of Print Stream class and access println() of same class.
Below are the overloaded methods of println in PrintStream class with different arguments.
                   println();
                   println(String x);
                   println(boolean x);
                   println(char x);
                   println(int x);
                   println(long x);       
                   println(float x);
                   println(double x);
                   println(char x[]);
                   println(Object x);
Every println() method makes a call to print() and adds a newline.
Note: System class can not be instantiated as constructor is declared as private.
JDBC: is an acronym for 'Java Data Base Connectivity'. It is used for accessing the databases from Java Applications. JDBC API allows to do CRUD operations on Database.
Steps to connectivity between Java program and Database:

  1. Loading the Driver
  2. Create the Connections
  3. Create a Statement
  4. Execute the Query
  5. Close the Connections.
Loading the Driver:
We can register the driver using Class.forName("oracle.jdbc.driver.OracleDriver");
Class.forName() load the driver's class file into memory, which automatically registers it.
In JDBC API, we have java.sql.Driver, it is only an interface and it is available in JDK.
Create the Connections:
We can establish the connection using
Connection conn=DriverManager.getConnection(String url, String user, String password);
url can be created as "jdbc:oracle:thin:@hostname:port Number:databaseName"

Create a Statement: Interface define the methods and properties that enable you to send SQL or PL/SQL commands and receive data from your database.
Statement st = con.createStatement();

Execute the Query: Reads data from a database query and returns the data in a result set. The java.sql.ResultSet interface represents the result set of a database query.
ResultSet rs=stmt.executeQuery("select query);
Close the Connections:
The close() method of Connection interface is used to close the connection.
conn.close()

Saturday, December 22, 2018



SDLC:  A Framework containing the Processes, Activities, and the Tasks involved in the development, operation and maintenance of a software project (spanning the life of the system) from the definition of its requirements to the termination of its use.
                                                   (or)
The Software Development lifecycle is a systematic process for building software that ensures the quality product is built.
Below are the different phases in Software Development Life Cycle:
1.   Requirements Gathering or (Initiation)
2.   Analysis
3.   Designing
4.   Coding
5.   Testing
6.   Delivery & Maintenance
In every phase of SDLC, four important things have to be discussed. For every phase there will be an out put in the form of Document.
                      -> Responsibilities or Objectives
                      -> Role
                      -> Process (Guide lines for the roles)
                      -> Documentation
  1. Requirement Gathering:
    1. Responsibility: Collecting all the specifications or requirements from the customer.
    2. Role: This job will be done by Business Analyst (BA) and Engagement Manager Assist BA. BA deals with requirements and EM estimates excess cost for this project.
    3. Process: BA must follow the guide lines
      • Taking appointment before meeting with customer.
      • What to talk what not to talk must be given.
      • Work has to be done in consistent manner.
    4. Documentation: While dealing with the CEO of Bank, BA must get the entire requirement, note it down and then this requirement must document. He/She must follow the pre format (Template) provided by the company. This document is known as BD/ BDD/ FRS/ BRS. (BD - Business Document, BDD - Business Design Document, FRS - Functional Requirement Specification, BRS - Business Requirement Specification)
  2. Analysis: In this phase the requirements in BDD are analyzed. In this phase, the out come is SRS. This SRS is designed in the next phase.
    1. Responsibility:
      • Analysis of Requirement: Analyse explicit requirements and implicit requirements
      • Feasibility Study: states whether requirement is possible or not
      • Tentative Planning: rough planning of the requirement
      • Technology Selection: Analysis system requirements. e.g: for web dev Java, for documentation MS-Word etc.,
    2. Role: System Analyst (SA)
    3. Process: Guidelines will be provided to analyst to follow.
    4. Documentation: In order to develop the product, the system requirements are documented and send to design phase. This document is known as SRS (System Requirement Specifications).
  3. Design: 
    1. Responsibility: Designing of the project. In this Design there are two levels HLD (High Level Design) and LLD (Low Level Design). 
    2. Role: HLD is done by CA (Chief Architect). LLD is done by TL (Technical Leads)
    3. Process: Guidelines will be provided to follow.
    4. Documentation: The document designed in this phase is called Technical Design Document (TDD)
  4. Coding: 
    1. Responsibility: In this phase programming is the responsibility
    2. Role: Developer
    3. Process: Developer must follow some guide lines called Coding  standards. Some Coding Standards: 
      • Code space margin has to be left
      • Write comments at every program function so that readability enhanced.
      • Color coding etc…
    4. Documentation: All the coding files are documented in a document called Program File or Source Code Document (SCD).
  5. Testing: Testing goes in this phase. After testing in this phase, application is send to Delivery phase.
    1. Responsibility: Testing of the Application
    2. Role: Test Engineers (TE, STE)
    3. Process: 
      • Understanding Requirements (e.g: BRS, FRS)
      • Writing Test cases (either manual or Automation)
      • Executing Test cases
      • analyse the test results
    4. Documentation: Documentation in this phase is Defect Profile.
  6. Delivery(Deployment)&Maintenance: The objective of deployment phase is to make the developed software operational in a live environment. A deployment in the operational environment comes only after the product is fully tested and accepted by the business in the acceptance stage of the testing phase
    Once the software passes through all the stages without any issues, it is to undergo a maintenance process wherein it will be maintained and upgraded from time to time to adapt to change

Thursday, December 20, 2018

Marker Interface:
A marker interface is an empty interface with no fields or methods. These are used to indicate some information to compilers or JVMs
 Ex: Serializable, Cloneable, EventListener and Remote interfaces
A Class implements them to claim the membership in a particular set.
The String class and all the wrapper classes implement the java.io.Serializable interface by default

Tuesday, December 4, 2018

I have attended some interviews during my career. I am sharing with you questions i was asked in the interviews. Hope these questions are helpful to the readers.

    How to integrate maven and Jenkins?
    Differences between TestNG and JUnit?
    What is Page Object Model?
    Explain about your project framework?
    How to set proxy in maven?
    How to execute single login test case from multiple TCs?
    How to get the screenshot for failed case?
    How to find the 2nd largest value of an array?

selenium-repo by venu

Blog helps to a student or IT employee to develop or improve skills in Software Testing.
For Online Classes Email us: gadiparthi122@mail.com

Followers

About Me

My photo
Hyderabad, Andhra Pradesh, India
I am Automation Testing Professional. I have completed my graduation in B.Tech (Computers) from JNTU Hyderabad and started my career in Software Testing accidentally since then, I passionate on learning new technologies

Contact Form

Name

Email *

Message *

Popular Posts