MainMenu

Home Java Overview Maven Tutorials

Sunday, 2 August 2020

Introduction of Jmeter and Basic definitions

Introduction of Java & Basic Definitions




Introduction JMeter is the best open-source load testing tool to measure the performance of an application.

jMeter is an Open Source testing software. It is 100% pure Java application for load and performance testing.

jMeter is designed to cover various categories of tests such as load testing, functional testing, performance testing, regression testing, etc., and it requires JDK 6 or higher.

Performance Testing :-
In software quality assurance, performance testing is in general a testing practice performed to determine how a system performs in terms of responsiveness and stability under a particular workload.

Speed – It Checks whether the response of the application is fast.

Scalability – It determines the maximum user load.

Stability – It checks if the application is stable under varying loads.

Performance Testing Techniques:

Load testing - It is the simplest form of testing conducted to understand the behavior of the system under a specific load. Load testing will result in measuring important business critical transactions and load on the database, application server, etc., are also monitored.
Stress testing - It is performed to find the upper limit capacity of the system and also to determine how the system performs if the current load goes well above the expected maximum.
Soak testing - Soak Testing also known as endurance testing, is performed to determine the system parameters under continuous expected load. During soak tests the parameters such as memory utilization is monitored to detect memory leaks or other performance issues. The main aim is to discover the system's performance under sustained use.
Spike testing - Spike testing is performed by increasing the number of users suddenly by a very large amount and measuring the performance of the system. The main aim is to determine whether the system will be able to sustain the workload.

Attributes of Performance Testing:

Speed
Scalability
Stability
reliability

Connection Time : Time to connect to Server from client

Response Time : Response time is a measure of how responsive an application or subsystem is to a client request.

Throughput : Throughput indicates the number of transactions per second an application can handle, the amount of transactions produced over time during a test. Requests per second, calls per dat, hits per second, report per year etc.

Scenarios : Scenarios In the context of performance testing, a scenario is a sequence of steps in your application. A scenario can represent a use case or a business function such as searching a product catalog, adding an item to a shopping cart, or placing an order.

Bottleneck:Bottleneck used to describe a single part of a system that prevents further processing or significantly degrades the performance of the system as a whole.

Capacity:The degree to which a system can perform data processing until performance degrades. For example, the number of new customers being added to a database.

Concurrency: Normally this means the number of simultaneous virtual users driving transactions across the user journeys in a given performance test scenario but can also mean the number of transactions synchronized to happen at exactly the same point.

Key Performance Indicators(KPI):The set of targets which set the expected performance targets within the production system. These may include page response time(e.g. 99% of pages loaded <= 2 seconds), user concurrency, batch processing times, data throughput volumes, transaction failure rates and underlying infrastructure behavior(e.g. Maximum average CPU used, minimum free memory available, threshold for remaining physical storage/disk usage, logging space etc.)

Load Testing :-A type of performance testing used to evaluate the behavior of a system or component when the load on the system(via users and transaction) progressively increase up to and including peak levels.

Non-functional Requirements NFRs requirements that do not relate to the functioning of the system but to other aspects of the system such as reliability, usability and performance.

Performance Engineering:Activities designed to ensure a system will be designed and implemented to meet specific non malfunction requirements. Often takes place following completion of testing activities that highlight weaknesses in the design and implementation.

Performance Test Plan:-Typically a written document that details the objectives, scope, approach, deliverable, schedule, risk, data and test environment needs for testing on a specific project.

Performance Testing:-Testing designed to determine the performance level of a system.

Reliability :Related to stability, reliability is the degree to which a system provides the same result for the same action over time under load.

Scalability:The degree a which a system's performance and capacity can be increased typically by increasing available hardware resources with in a set of servers(vertical scaling) or increasing the number of servers available to services request (horizontal scaling)

Soak Testing:A type of performance testing used to evaluate the behavior of a system or component when the system is subjected to expected load over a sustained period of time.

Spike Testing: A type of performance testing used to evaluate the behavior of a system or component when subjected to large short-term changes in demand. Normally this is to test how the system responds to large increases in demand, e.g. User Logins, Black Friday-like scales events etc.

Stability:The degree to which a system exhibits failures and errors when under normal usage. For example, erroneous errors when registering new users under load.

Stress Testing:A type of performance testing used to evaluate the behavior of a system or component when subjected to load beyond the anticipated workload or by reducing the resources the system can use, such as CPU or memory.

Transaction Volume Model(TVM):A document detailing the user journeys to be simulated, the click-path steps that make up the user journeys and associated load/transaction volume models to be tested. This should include information regarding the geographical locale from where users will be expected to interact with the system and the method of interaction e.g. mobile vs desktop.

User Journey: The path through the system under test that a group of virtual users will use to simulate real users. It should be noted that key performance/volume impacting journeys should be used as it is impractical to performance test all possible User journeys, a good rule-of-thumb is to use the 20% of user journeys that generate 80% of the volume.

Virtual User:A simulated user that performs actions as a real user would during the execution of a test.

Thursday, 28 May 2020

How to Handle Tool Tip in selenium




Hello friends
In this Article we will learn that how to handle the tooltip operation in selenium, so while automating your website you will get 2 kind of below scenarios :-
1). Tool tip in title tag :- We will use getAttribute("title")

2). Tool tip inside div or any other html tag :- we will use here actions class.
Here is the code for both


import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class Tooltiptest {
WebDriver driver;
@BeforeTest
public void g() throws InterruptedException
{
/*System.setProperty("webdriver.chrome.driver", "D:\\Selenium\\Complete selenium\\ChromeDriver\\83\\chromedriver.exe");
System.setProperty("webdriver.chrome.silentOutput", "true");
driver = new ChromeDriver();*/
System.setProperty("webdriver.gecko.driver", "D:\\Selenium\\geckodriver\\new\\geckodriver.exe");
System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE, "null");
driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.navigate().to("file:///D:/Selenium/Complete%20selenium/tooltip/tooltip.html");
Thread.sleep(3000);
}
@Test
public void gettootltip() throws InterruptedException
{
WebElement tootipelement = driver.findElement(By.className("tooltip"));
Actions action = new Actions(driver);
action.moveToElement(tootipelement).build().perform();
String text = driver.findElement(By.className("tooltiptext")).getText();
System.out.println(text);
Thread.sleep(3000);
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
WebElement element = driver.findElement(By.xpath("/html/body/form/input[1]"));
String text2 = element.getAttribute("title");
System.out.println(text2);
}
}


Wednesday, 22 April 2020

Difference Between Collection and Collections

Difference Between Collection and Collections
Collection and collections in java

Difference between Collection and Collections

Difference between Collection and Collections

1). Collection is a root level Interface in Java Collection Framework or collection hierarchy. The Set, List and Queue are the some of the subInterfaces of Collection interface.

The important methods of Collection interface are add(), remove(), size(), clear() etc.

Collections is a utility class in java.util package which contains only static methods that operate on objects of type collection.

Collections class contains only static methods like sort(), min(), fill(), copy(), reverse() etc.

2). Before Java 8, interface was not allowed to contain static methods. collection is an Interface & interface can contain static methods since java 8 and Interface can also contain abstract methods and default methods.

But collections class contains only static methods.



3). Collection interface extends iterable interface

public interface Collections extends Iterable

and Collections class extends Object class

public class Collections extends Object



Similarities between Collection and Collections in Java



1). Both are part of the Java Collections Framework.

2). Both are present in java.util package

3). Both are added to jdk in java version 1.2





Example of Collections

import java.io.*;
import java.util.ArrayList;
import java.util.*;

public class ConsTest
{
public static void main(String args[]) throws IOException
{
ArrayList<Integer> alist = new ArrayList<Integer>();
alist.add(10);
alist.add(20);
alist.add(5);
alist.add(35);
alist.add(45);
System.out.println("maximum value" + " " + Collections.max(alist));
System.out.println("maximum value" + " " + Collections.min(alist));
ArrayList<String> list = new ArrayList<String>();
list.add("Chandan");
list.add("Chauhan");
list.add("Cha");
Collections.sort(list);
System.out.println("Sorted Strings" + " " + list);
Collections.sort(list, Collections.reverseOrder());
System.out.println("Reversed Strings" + " " + list);
ArrayList<String> slist = new ArrayList<String>(3);
slist.add("Chandan");
slist.add("Chauhan");
slist.add("Cha");
ArrayList<String> dlist = new ArrayList<String>(3);
dlist.add("a");
dlist.add("b");
dlist.add("c");
Collections.copy(dlist, slist);
System.out.println(dlist);
Collections.fill(dlist, "way2testing");
System.out.println(dlist);
}
}

Output :-

maximum value 45
maximum value 5
Sorted Strings [Cha, Chandan, Chauhan]
Reversed Strings [Chauhan, Chandan, Cha]
[Chandan, Chauhan, Cha]
[way2testing, way2testing, way2testing]



Collections in java:-
Any group of individual objects which are represented
as a single unit know as collection of objects.
Collection in java is a framework that provides an architecture to store and manipuate the group of objects.
Java collections can achieve all the operations that you perform on data like searching, sorting, insertion, manipuation etc.
"A collection represents a single unit of objects i.e. a group".
The collection interface (java.utill.Collection) and Map interface (java.util.Map) are two main "root" interface of java collection classes.

What is Framework :-
A framework is a set of classes and interfaces which provide a ready-made architecture.

List Inerface:-
It contains the index based methods to insert, update, delete and search the element.
It can have duplicate elements.
It can have null elements.

ArrayList :-
> ArrayList class implements the List Interface.
> It uses a dynamic array to store element
> It can store duplicate elements
> Arralist class maintain the insertion order and is non-synchronized.

Example :-
package com.test.practice;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public class Oopstutorial
{
public static void main(String[] args)
{
ArrayList<Integer> al= new ArrayList<Integer>();
List<> al2= new LinkedList<Integer>();
al.add(20);
al.add(200);
al.add(40);
al.add(90);
al.add(15);
System.out.println("2nd position object " + al.get(1));
System.out.println("Array list" + al);
System.out.println("Maximum num is " + Collections.max(al));
al2.add(20);
al2.add(20);
al2.add(400);
al2.add(90);
al2.add(15);
System.out.println("linked list" + al2);
System.out.println("Maximum num is " + Collections.max(al2));
System.out.println("Minimum num is " + Collections.min(al));
ArrayList<String>sl = new ArrayList<String>();
sl.add("chandan");
sl.add("adhiraj");
sl.add("singh");
Collections.sort(sl);
System.out.println("sorted list is " + sl);
Collections.reverse(sl);
System.out.println("reversed list is " + sl);
Iterator<String> it = sl.iterator();
while(it.hasNext())
{
System.out.println(it.next());
}
}
}


Set Interface:-
Set Interface in java is present in java.util package
it extends the collection interface does not allow to store duplicate elements we can store at most one null value in set.

HashSet:-
Hashset class implements the Set Interface.
It represents the collection that uses a hash table for storage. It contains unique Items.

import java.util.Set;
import java.util.TreeSet;
public class Oopstutorial
{
public static void main(String[] args)
{
Set<String> s = new HashSet<String>();
Set<String>ts = new TreeSet<String>();
s.add("chandan");
s.add("adhiraj");
s.add("chandan");
s.add("chauhan");
System.out.println("Set elements are " +s);
ts.add("chandan");
ts.add("adhiraj");
ts.add("chandan");
ts.add("chauhan");
System.out.println("Treeset elements are" +ts); //Elements in treeset stored in ascending order
}
}

Map Interface :-
hashMap is a Map based collection class that is used for storing Key & Value(associated with keys).
1).It is donated as HashMap.
2).Hashmap contains only unique elements.
3).Hashmap may have only one null key and multiple null values
4). Hashmap maintains no order.

Example:-
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
public class Oopstutorial
{
public static void main(String[] args)
{
Map< String, Integer > record = new HashMap< String, Integer >();
record.put("chandan", 30);
record.put("baji", 29);
record.put("adhiraj", 31);
System.out.println(record.get("chandan"));
Set<String> k = record.keySet();
for(String i : k)
{
System.out.println(i+ " "+record.get(i));
}
}
}

Output:-
baji 29
chandan 30
adhiraj 31
#Collection

Friday, 10 April 2020

Static and Dynamic Testing






Topics

:- QA Vs QC

:- Verification V/s Validation

:- Static V/s Dynamic Testing

:- Review, Walkthrough & Inspection





QA V/s QC


:-QA is process related                       QC is the actual testing of the software

:-QA focuses on building in quality                        QC focuses on testing for quality

:-QA is preventing defects                        QC is detecting defects

:-QA is process Oriented                        QC is product Oriented.

:-QA is for entire life Cycle                        QC is for testing part in SDLC

:-QA focuses on building quality                       QC focuses on testing for quality and hence detecting defects

and hence preventing defects

:-Quality Assurance makes sure                        Quality control makes sure the results of what you done you are doing the right things, are what you expected.

the right way. fit for purpose & right first time                     to achieve Reliability, maintainability & safety



Verification V/s Validation




Verification checks whether we are building the right system

Verification is a process of finding out the product being developed the right way?

Verification typically involves

:-Review

:-Walkthroughs

:-Inspections

:- Buddy Check

Validation checks whether we are building the System Right

Validation is a process of finding out if the product being developed is right?

-- Generally Takes place after verification are completed

-- Validation typically involves actual Testing Like System Testing.



Reviews :-

Conducts on documents to ensure correctness and completeness.

Examples :-

:- :- Requirement Reviews

:- :- Design Reviews

:- :- Code Reviews

:- :- Test Plan Reviews

:- :- Test Cases Reviews etc.





Phases of Review :-

:- :- Planning

:- :- Kick-off

:- :- Preparartion

:- :- Review Meeting

:- :- Rework

:- :- follow up





Walkthroughs :-

:- :- It is a formal review and we can discuss/raise the issue at peer level.

:- :- Also walthrough does not have minutes of the meeting/meet. It can happen at any time and conduct just like that no schedule as such.




Inspections :-

:- :- It is a formal approach to the requirements schedule.

:- :- At lest 3-6 people will sit in the meeting 1-reader 2- writer 3- moderator plus concerned.

:- :- Inspection will have a proper schedule which will be intimated via email to the concerned developer/Tester.





Buddy Check :-

One person goes through the documents prepared by another person in order to find out if that person has made mistakes i.e. to find out bugs which the author couldn't find previously.





Static V/s Dynamic Testing



:- Static testing is an approach to test project documents in the form of

:- :- Reviews

:- :- Walkthroughs

:- :- Inspections





Dynamic Testing is an approach to the actual Software by giving inputs & performing operation and observing results.





Wednesday, 1 April 2020

Drag and Drop Test






Drag and Drop

Drag the image back and forth between the two div elements.

Friday, 10 January 2020

Path Practice Page





Drag and drop HTML5 demo

Try to drag the purple box around.

Drag Me

Dustbin

Drag the way2test image into the rectangle: