Introduction of Docker/ what is docker

 

What is Docker

Docker

  • It’s a open source company and a project.
  • Application delivery technology 
  • It is used to build deploy and run the container.
  • It will give you standard format to build deploy and run the application.
  • It will help you to run your distributed application anywhere.








Huawei Technologies - SDET interview questions and answers

 

Huawei Technologies - SDET interview questions and answers

--- Program to reverse each character in the string---

public class reverse

{


public static void main(String args[])

{

String temp = "This is just for interview";


String newString;

String test;

--------------------------Split String intoArray

String val[]= temp.split(" ");


for(int i =0; i<val.length();i++)

{


reverseString(val(i));


test= newString.concate(val(i).concate(" "));


}

System.out.println(test);


}

--------------------------Create a function to reverse a string 

public static void reverseString(String val)

{

char temp[]= val.toCharArray();

for(int i =temp.lenght-1; i<0;i--)

{

System.out.print(temp(i));

}


}


}






-- find the max value from the array

class maxArray

{

public static void main(String args[])

{

int test[] = {34, 8, 10, 3, 2, 80, 30, 33, 1};

int arr[i] =0;

for(int j =0; j<test.length; j++)

{


if(arr[i]<test[j])

{

arr[i]== test[j];

}

}

System.out.println(arr[i]);

}

}




class maxArray

{

public static void main(String args[])

{


String name = "india"


char val[]= name.tocharArray();


HashMap<Character, integer> obj = new HashMap<Character, integer>();


for(int i =0; i<val.lenght; i++)

{


if(obj.get(i).contains(val(i)))   // iskey or haskey

{

obj.put(val(i)),get(val(i)+1)

}

else

{

obj.put(val(i),1);

}

}

System.out.println(obj);

}

}





empname, add, salary, contactno




Class findsalary()

{




public static void main(String args[])

{


WebDriver driver = new ChromeDriver("Path");

driver.get("Application URL");

driver.findElement(By.xpath("username xpath")).sendkeys("username");

driver.findElement(By.xpath("password xpath")).sendkeys("password");

driver.findElement(By.xpath("loginButton xpath")).click();


List<WebElement> sal= driver.findElements("xpathforNamesalary");


List<WebElement> names = driver.findElements("xpathforNamecolumn"); // we can use webTable concept here and take the


for(int i =0; i<names.size();i++) // xpath for entercolumn instaead of any sepecif row 

{

if(names.get(i).getText().equals("Manish")

{

System.out.println(sal.get(i).getText());

}    

}

}






































Pytest-BDD framework -(Explain your framework which you are using to validate the API )

 

Explaination of Pytest-BDD framework 

 OR

 Please explain your framework which you are using to validate the API 

PyTest-BDD Framework


In our framework, we have majorly 5 important components

1. 

Entity :- 

a.       Configuration parser :- where we have kept our configparser/ reader you can say which we are using to read the configuration required to run our test cases, like client secret, id, scope, username and password.

b.       Key vault helper:- using this helper class we reading the data from Azure keyvalult.

c.       Blob strorge account :- Again to fetch the information of files present in the blob.

d.       Cosmos db reader:- to read the content from the cosmos db.

2.       

Feature

a.       In this component we are keeping our feature files based on the modules.

3.       Step definition

a.       Where we are creating the test files for step definitions.

b.       Created conftest file for fixtures and hooks

4.       

Test data

a.       Where we are storing the json parameters or payloads which are required for the API’s

b.       Also we have separate folders for expected json files and response values.

5.       

Helper

a.       In this component we are storing the API base class where we have

                                                               i.      Json file reader

                                                             ii.      API request method to request for get /post/ put/ patch and delete calls

                                                           iii.      Token generator


Java SDET Interview questions and Answers




Difference between abstraction and interface.

1 Abstract class 

--------------

1)An abstract class can have method body (non-abstract methods).

2)An abstract class can have instance variables.

3)An abstract class can have constructor

4)An abstract class can have static methods. 

5)You can extends one abstract class.


Interface

---------

1)Interface have only abstract methods.

2)An interface cannot have instance variables.

3)Interface cannot have constructor.

4)Interface cannot have static methods.

5)You can implement multiple interfaces



What is Encapsulation?


Encapsulation-
-encapsulation is java process of wrapping code and data into a single unit.
-we can create a fully encapsulated class in java by making all the data members of the class private.
-we can use setter and getter methods to set and get the data in encapsulation
-By providing only setter and getter method, we can make the class read only and write only.
-encapsulation provides us control over the data.

What do you understand by OOPS Concept


Oops concept-

1.Inheritance-Inheritance in java is mechanism in which child class acquires all properties of parent class. Here properties are variables, functions, etc. Inheritance provides code reusability. When we inherit properties from existing class, we can reuse methods and fields of parent class and we can add methods and fields also. The class which inherits the properties of other class is called as child class/derived class. The class whose properties are inherited is called as parent class/base class/super class.

2.Polymorphism- When one task is performed by different ways is called as polymorphism. Polymorphism in java is a concept by which we can perform single action in different ways.
Types-
1.Method overloading
2.Method overriding


3. Encapsulation-
-encapsulation is java process of wrapping code and data into a single unit.
-we can create a fully encapsulated class in java by making all the data members of the class private.
-we can use setter and getter methods to set and get the data in encapsulation
-By providing only setter and getter method, we can make the class read only and write only.
-encapsulation provides us control over the data.


4.Abstraction- is a process of hiding the implementation details and showing only functionality to user. It shows only important things to user and hides the internal details. E.g. sending sms, we just type the test and send the message. We don’t know the internal processing of message delivery. 

What is Hash Map ? Can we store objects in hash map and how to retrieve them?

 HashMap is a hash table based implementation of Java's Map interface. A map is an object that maps keys to values. A map cannot contain duplicate keys

--> In Java HashMap object provides key/value pairs for storing information in memory. You can store any data type combination as long as the keys are unique.

--> When you want to retrieve the object, you call the get() method and again pass the key object.


Explain overriding and method over loading .

Method overloading:
=================
--> Overloading deals with multiple methods in the same class with the same name but different signatures 
--> Overloading lets you define a similar operation in different ways for different data.

Method overriding:
================
--> Overriding deals with two methods, One in the parent class and one in a child class that have the same signature
--> Overriding lets you define a similar operation in different ways for different object types.

Explain overriding and method over loading .

Constructor :
===========
Constructor has same name as the class name
Constructor is used to initilize the data members and start up tasks
Constructor is automatically called when an object is created 
There is no return data type in constructor 
There is always a default constructor provided by compiler

Interface:
=========
Interface contains only abstract methods
Access modifiers for methods in interfaces must be public
Variables defined must be public,static,final
To implement an interface, we use implements keyword


Explain Set and Map in Java.

Set:
====
A set is a collection that cannot contain duplicate elements. How ever it makes no guarantees concerning the order of iteration.
Below are the classes Implement set interface
1. Hashset
2. LinkedHashSet
3. TreeSet

Implementation of Set interface:
============================
public class Hashset
{
 public static void main(String args[])
{
 HashSet<String> hs = new HashSet();
 hs.add(""Deepthi"");
 hs.add(""Keerthi"");
 hs.add(""Spoorthy"");
s.o.pn(hs);
}
}
Methods in iterator interface:
========================
hasNext()
next()
remove()

Iterator interface is used to traverse each element present in the set interface.

iterator<String> it = hs.iterator();
while(it.hasNext())
{
s.o.pln((it.next());   //Prints all elements present in the set
}

Map:
=====
A map is an object that maps keys to values. A map cannot contain duplicate keys.
Below are the main implementations of Map interfaces
1. HashMap
2. LinkedHashedMap
3. TreeMap

Implementation of Map Interface:
===============================
public class HashMap
{
 public static void main(String args[])
{
 HashMap<Integer, String> hm = new HashMap(Integer,String);
 hm.put(0, ""Deepthi"");
 hm.put(1, ""Keerthi"");
 hm.put(2,""Spoorthy"");
s.o.pn(hm);
Set s = hm.entryset();    // Storing in set interface
Iterator i = s.iterator();
while(i.next())
{
    Map.Entry m=(Map.Entry);
    i.next();
   s.o.pln(m.getKey());
   s.o.pln(m.getValue());
}
}


What is static and final in java?

static and final are the keywords used in java

The main difference between a static and final keyword is that static is keyword is used to define the class member that can be used independently of any object of that class. Final keyword is used to declare, a constant variable, a method which can not be overridden and a class that can not be inherited.

memory is allocated only once for static variable or method . It is a class variable or method.
final -> when applied to a variable or method or class, its value cannot be changed. It will be constant

How will you prevent the override method in java

In java, we know that child class can override the parent class methods. so in order to prevent the overriding in java , we need to make parent class methods as static or final. why because static and final methods can not be override.

Explain about collections.

it is a framework of classes and interfaces to make data manipulation easy


Java Programs for SDET Interview

 

Reverse a string in java 


public class ReverseString {

public static void main(String[] args) {

String value = "selenium";

String newvalue ="";

//convert string to character

char val[]= value.toCharArray();

for(int i = val.length-1; i>=0;i--)

{

System.out.print(val[i]);

// convert character to string again

newvalue = newvalue.concat(Character.toString(val[i]));

}

System.out.println("");

System.out.println(newvalue);

}

}


Get unique charcters from a string in java 

public static void main(String args[])
{
String value = "selenium";

//get the lenght of the string 

int stringlength = value.length();

//Create a set of characters

HashSet<Character> set=new HashSet();  

for(int i =0; i<stringlength ;i++ )
{

// convert string to array of characters and add in set interface

set.add(value.toCharArray()[i]);

}
System.out.println(set);
}


To get the count of charcters from a string in java 


public static void main(String[] args) {
String temp = "interview prepration for sdet";

// array of index

int[] index = new int[temp.length()];  

// declare two variable for index values and count

int i, j;

// array of characters

char characterarray[] = temp.toCharArray();  
for( i =0; i<temp.length();i++)
{

// store index values for the characters

index[i] =1;

for ( j =i+1 ;j<temp.length(); j++)

{
if(characterarray[i]==characterarray[j])

{

index[i]++;

characterarray[j] = '0'; 
}
}
 
}

System.out.println("Characters and their corresponding frequencies");  

for(i = 0; i <index.length; i++) {  

        if(characterarray[i] != ' ' && characterarray[i] != '0')  

        System.out.println(characterarray[i] + "-" + index[i]); 

}
}

API / Web Services - Interview Questions.

 


API / Web Services - Basics


What is web Service? Explain with an example?

Web service is a standardized communication medium between the client and server applications on the World Wide Web.

For example :- when we started searching anything on the google it will invoke different type of services like.. Search for the resources, getting the results from multiple websites, spelling check, fetch cache etc.

another example will be like if i want to show the temperature of the current city, instead of writing the logic to get the temperature of the city i can simply invoke API's which can help me with this feature.  

In simple words..

Web Services are the services which is can be written by anyone else and we can just pass our input and get the output from that service.

It means we really don't need to know how exactly it is giving us the output but we are getting the desired output based on our input values.

A web service is a software module that is designed to perform a certain set of tasks. 

API terminologies

Get :- Get action tells the system/ module that you want to fetch or retrieve the information. 

Post :- With post api generally we create a new object and receive response code as 201, in case of successful completion of the object. 

Put :- It is same as post, but it worked for the existing object, so we need some existing parameters and stuff/ change/updated values to work on that object also PUT is for complete entity replacement whereas PATCH is to partially update the entity.

Delete : Delete action just ask server to delete an existing object.

Patch :- Patch request says that we would only send the data that we need to modify without modifying or effecting other parts of the data. Ex: if we need to update only the first name, we pass only the first name also PUT is for complete entity replacement whereas PATCH is to partially update the entity.

Idempotency :- A action that will always results in the same server state, no matter how many times we call it is known as idempotency.

Type of API's 

REST ( Representational State Transfer)

SOAP ( Simple Object Access Protocol )

Risk with API's

API structure keep on changing   change

API logic change (any bugs )

response structure change


API / Web Services - Interview Questions.

Question :- Suppose I have a service which return schedule flights available based on input parameters. Can you tell me how would you test this service ? All possible test scenarios?

Ans :- i can think of below mention test scenarios.

Search Flight Names - API to get all the flight Name available in the system

Search Flight Names based on the date - API to get all the flight Name available in the system based on the selected date.

Search Flight Names based on airports - API to get all the flight Name available in the system based on the airports.

Search Flight Names based on timings - API to get all the flight Name available in the system based on the timings.

Search Flight Names based on price filter- API to get all the flight Name available in the system based on the price filters.

Search Flight Names based on flight cancellation options- API to get all the flight Name available in the system based on flight cancellation options







Scrum ceremonies/events in Agile Scrum

 


Scrum ceremonies/events in Agile Scrum


Sprint (or iteration) is the heart of Scrum. It calls for below ceremonies that bring structure to each sprint:

Sprint Planning: Held at the start of each sprint to define the Sprint Backlog (importing stories from the Product/Release backlog), i.e. items that can be completed in the current sprint.

Daily Scrum: 15-minute stand-up meeting to synchronize the work of team members, i.e. what’s done on the prior day, what needs to be done today, and identify any impediments. 

Sprint Review: Held at the end of each sprint to demonstrate the added functionality. The goal is to get feedback from the product owner and other stakeholders to ensure that the delivered increment met the business need and to revise the Product Backlog based on the feedback.

Sprint Retrospective: Held at the end of each sprint to reflect on the completed sprint and identify opportunities to improve in the next – what went well, what did not and what can be improved.