Tuesday, March 31, 2020

Interview Questions

What is Session Time?
Specifies the number of minutes that a session can remain idle before the server terminates it automatically. The default is 10 minutes. SessionTimeout has no hard-coded limit. ... It should not be set higher than 20 minutes (except in special cases) because every open session is holding onto memory
Tracking session expiration in browser
<session-config>
  <session-timeout>10</session-timeout>
 </session-config>
what is authentication and what is authorization
Authentication vs Authorization. ... Authentication means confirming your own identity, whereas authorization means being allowed access to the system. In even more simpler terms authentication is the process of verifying oneself, while authorization is the process of verifying what you have access to
- what is difference between scrum and Agile
Agile
Scrum
Agile is a development methodology based on iterative and incremental approach.Scrum is one of the implementations of agile methodology. In which incremental builds are delivered to the customer in every two to three weeks' time.
Agile software development has been widely seen as highly suited to environments which have small but expert project development teamScrum is ideally used in the project where the requirement is rapidly changing.
In the Agile process, the leadership plays a vital role.Scrum fosters a self-organizing, cross-functional team.
Compared to Scrum it is a more rigid method. So there is not much room for frequent changes.The biggest advantage of Scrum is its flexibility as it quickly reacts to changes.
Agile involves collaborations and face-to-face interactions between the members of various cross-functional teams.In Scrum, collaboration is achieved in daily stand up meeting with a fixed role assigned to scrum master, product owner, and team members.
Agile can require lots of up-front development process and organizational change.Not too many changes needed while implementing scrum process.
The agile method needs frequent delivery to the end user for their feedback.In the scrum, after each sprint, a build is delivered to the client for their feedback.
In this method, each step of development like requirements, analysis, design, are continually monitored during the lifecycle.A demonstration of the functionality is provided at the end of every sprint. So that regular feedback can be taken before next sprint.
Project head takes cares of all the tasks in the agile method.There is no team leader, so the entire team addresses the issues or problems.
The Agile method encourages feedback during the process from the end user. In this way, the end product will be more useful.Daily sprint meeting is conducted to review and feedback to decide future progress of the project.
Deliver and update the software on a regular basis.When the team is done with the current sprint activities, the next sprint can be planned.
Design and execution should be kept simple.Design and execution can be innovative and experimental.
In the Agile method, the priority is always to satisfy the customer by providing continuous delivery of valuable software.Empirical Process Control is a core philosophy of Scrum based process.
Working software is the most elementary measure of progress.Working software is not an elementary measure.
It is best to have face-to-face communication, and techniques like these should be used to get as close to this goal as possible.Scrum team focus to deliver maximum business value, from beginning early in the project and continuing throughout.
Following are Agile principles:
-Welcome changing requirements, even late in development. Agile processes allow change according to customer's competitive advantage.
-Business people and developers will work daily throughout the project.
-Attention to technical excellence and right design enhances agility
-Agile team, work on to become more effective, for that they adjust its behavior according to the project.
Following are scrum principles:
-Self-organization: This results in healthier shared ownership among the team members. It is also an innovative and creative environment which is conducive to growth.
-Collaboration: Collaboration is another essential principle which focuses collaborative work. 1. awareness 2. articulation, and 3. appropriation. It also considers project management as a shared value-creation process with teams working together to offer the highest value.
-Time-boxing: This principle defines how time is a limiting constraint in Scrum method. An important element of time-boxed elements are Daily Sprint planning and Review Meetings.
-Iterative Development: This principle emphasizes how to manage changes better and build products which satisfy customer needs. It also defines the organization's responsibilities regarding iterative development.

Wednesday, March 25, 2020

How To Find Broken Links Using Selenium WebDriver

Find Broken Links Using Selenium WebDriver:

One of the key test case is to find broken links on a webpage. Due to existence of broken links, your website reputation gets damaged and there will be a negative impact on your business. It’s mandatory to find and fix all the broken links before release. If a link is not working, we face a message as 404 Page Not Found.
Let’s see some of the HTTP status codes.
200 – Valid Link
404 – Link not found
400 – Bad request
401 – Unauthorized
500 – Internal Error
Consider a test case to test all the links in the home page of “SoftwareTestingMateria.com”
Below code fetches all the links of a given website (i.e., SoftwareTestingMateria.com) using WebDriver commands and reads the status of each href link with the help of HttpURLConnection class.
Click here for more information on HttpURLConnection
Given clear explanation in the comments section with in the program itself. Please go through it to understand the flow.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package softwareTestingMaterial;
 
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class BrokenLinks {
public static void main(String[] args) throws InterruptedException {
//Instantiating FirefoxDriver
System.setProperty("webdriver.gecko.driver", "D:\\Selenium Environment\\Drivers\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
//Maximize the browser
driver.manage().window().maximize();
//Implicit wait for 10 seconds
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
//To launch softwaretestingmateria.com
driver.get("https://www.softwaretestingmaterial.com");
//Wait for 5 seconds
Thread.sleep(5000);
//Used tagName method to collect the list of items with tagName "a"
//findElements - to find all the elements with in the current page. It returns a list of all webelements or an empty list if nothing matches
List<WebElement> links = driver.findElements(By.tagName("a"));
//To print the total number of links
System.out.println("Total links are "+links.size());
//used for loop to
for(int i=0; i<links.size(); i++) {
WebElement element = links.get(i);
//By using "href" attribute, we could get the url of the requried link
String url=element.getAttribute("href");
//calling verifyLink() method here. Passing the parameter as url which we collected in the above link
//See the detailed functionality of the verifyLink(url) method below
verifyLink(url);
}
}
// The below function verifyLink(String urlLink) verifies any broken links and return the server status.
public static void verifyLink(String urlLink) {
        //Sometimes we may face exception "java.net.MalformedURLException". Keep the code in try catch block to continue the broken link analysis
        try {
//Use URL Class - Create object of the URL Class and pass the urlLink as parameter
URL link = new URL(urlLink);
// Create a connection using URL object (i.e., link)
HttpURLConnection httpConn =(HttpURLConnection)link.openConnection();
//Set the timeout for 2 seconds
httpConn.setConnectTimeout(2000);
//connect using connect method
httpConn.connect();
//use getResponseCode() to get the response code.
if(httpConn.getResponseCode()== 200) {
System.out.println(urlLink+" - "+httpConn.getResponseMessage());
}
if(httpConn.getResponseCode()== 404) {
System.out.println(urlLink+" - "+httpConn.getResponseMessage());
}
}
//getResponseCode method returns = IOException - if an error occurred connecting to the server.
catch (Exception e) {
//e.printStackTrace();
}
    }

String

  Java String  class provides a lot of methods to perform operations on strings such as compare(), concat(), equals(), split(), length(), re...