What is Java collection framework

Collection framework in java is set of interfaces and classes that forms a collection of data Objects

Set, List, and Queus are interfaces helps to build collection. Map is really not a collection as it is key/value pairs of data.

Java collections help us to create group of objects and it iterates in data container, helping developer to do data operations like add, modify, remove etc.

Selenium tutorials

Selenium Tutorials 

Selenium and Jenkins

Protractor 

RobotFramework

Selenium features as below

 Selenium supports Cross Browser Testing. The Selenium tests can be run on multiple browsers and multiple machines and multiple Operating systems.

Supports several scripting languages like Java, Python, C#, and PHP.

Selenium uses Browser native commands. It locates and actions applied on UI elements,

Reporting are very easy and extensible.

TestNG quick summary:

 TestNG’s is Selenium + reporting features. It is easy to generate reports using Listeners and Reporters in TestNG

 Features of TestNG includes the following,

1)      Annotations – please refer my annotation blogAnnotation – TestNG’s test case priority

2)      Supports parameterization/ data driven testing

3)      Test cases can be grouped and parallel testing is allowed.

Automaton testing using Cucumber – Behavior driven development (BDD)

Application behavior is the main focus on BDD. The requirements are written in English which gives more readability and understandability of the requirement.

So any roles in the company (Tester, developer, end user, and techno functional person) can read it and understand it. Also this will reduce the complication in terms of missing requirement or misrepresenting or misunderstanding requirements between different roles (Developer /tester / end user)

Gherkin is a business readable language – refer below for an example. Below feature file is integrated with Selenium and are having user stories as below.

Please refer below – “feature, Scenario, Given, When, And, Then “are the Keywords below to understand on how to write a feature file.

Selenium jenkins integration steps are as below:

  Jenkin related steps:
1) start jenkins by running command in DOS prompt (detailed steps in here )
2) then make sure you are able to access url : localhost:8080
3) then you need to configure jenkins to run the selenium scripts – for that click on “Manage Jenkins”
4) then click on Configure systems
5) Find out the jdk files are installed (usually in C:\ program files … folder path) and copy paste the path in JDK section “JDK Installations” in ” Configure systems” which you are already in.
6) Give JDK name “JAVA_HOME” and provide Java path below in the next field. Selenium related steps:
3) Open eclipse IDE and start new Java project
4) make sure you added selenium jars (Selenium server standalone jar file which you can download add to new project) to support selenium framework for your automation testing.
5) then create a simple selenium script – make sure it is running and completing successfully in Eclipse.
6) Also create a xml file give a name “Xml1.xml”  Make sure Run “Xml1.xml” as “TestNG Suite” is working fine in Eclipse. Also notedown the xml file path in selenium project. create a lib folder in that and add all jar files which are required. Commmand prompt:
7) navigate to that project folder in command prompt and set all required classpath like bin and lib etc which are already in xml file folder in selenium project which you got from selenium project in eclipse.
8) then type command “Java org.testng.testNG Xml1.xml” which will display results in command prompt/DOS screen
9) now create a batch file “Batch1.bat” which contains the above command and also a command for compiling as e.g “java -cp bin;lib/* org.testng.testNG Xml1.xml” Jenkins setup to build and run the file:
10) in Jenkins, create a “new item” with selection of “Freestyle project”
11) then select “Advance options” and put the Selenium project home directory path in there.
12) the build trigger section, select Batch file execution option in there, then put the batch file name “Batch1.bat”
13) click and save the new item
14) click on “Build Now” and verify the “Console output”

How to configure Hub & Node machines for selenium parallel test execution
Configuring Hub machine

1) Start the command prompt/DOS prompt

2) Navigate to the folder location where the Selenium server jar file is kept.

3) Type java –jar selenium-server-standalone-[VERSION].jar –role hub

Note: [VERSION] is the one your downloaded version of selenium-server-standalone Jar file.

Your will see the below screen

Selenium Hub
Selenium Hub

4) Now type: http://localhost:4444 in browser

Your will see the below screen

5) Now type: http://localhost:4444/console in browser

You will see the below screen

Console

Configuring Node machines

Follow the same steps 1 to 2 in node machines

Then type,

Java –jar selenium-server-standalone-[VERSION].jar –role node –hub http://yourHUBmachineIP:4444/grid/register

Selenium Node

What is TestRunner in Cucumber

In order to link Cucumber with Selenium WebDriver, you need to start a Java project in eclipse IDE.

Then, add both Cucumber and Selenium jar files

Write test runner code and execute the same . Please refer BDD testing details on Selenium Cucumber

What is contract testing

What is contract testing?

Contract testing is famous in microservices world. When we consider less numbers of microservices,  then contract testing is not so necessary.However when you look at the Amazon or Netflix microservices mesh, it is countless. Such cases it is extremely difficult for developer or tester to maintain unit/automation test suite as per the microservices development chnages.
Contract testing is the best possible solution currently offered for this situation. In contract testing, a mocked service is created to represent the provider.  There are commercial or opensource tools available to stimulate this. In short, contract is set of predefined requests and responses created by automation or developer team to do their testing.

How to setup angular project

How to setup Angular project and generate components ?

  1. install latest nodejs from nodejs.org
  2. Go to git bash/powershell ISE/CMD
  3. type following commands,
  4. install Angular : npm install -g @angular/cli
  5. ng new my-newweb-app
  6. ng g c myFirstModule or type mg generate component myFirstModule (optional)
  7. go to project folder ” my-newweb-app ” via commandline itself
  8. type mg serve -o

Other programming notes

select [(ngModel)]=”value” (change)=”selected()”

option *ngFor=”let item of data” [ngValue]=”item”>{{item.name}}</option
</select

selected(){
alert(this.value.name)
}

data:Array = [
{id: 0, name: “Test “},
{id: 1, name: “Test2”}
];

div>  <input ref-email placeholder=”text here” />  </div

What is ELK

What is ELK (Elastic search, Logstash, Kibana) ?

ELK stack is a combination of 3 open-source products as below,

  1. Elasticsearch, a search and analytics engine.
  2. Logstash, that index the data to Elasticsearch. Logstash has a config file that has input,filter and output section. Config file looks like json file.
  3. Kibana, a visualization tool which provides a web based GUI for a user. User can design the bar, plot reporting charts.
    In order to make Kibana and Elasticsearch interact, you need to make both server up and running. Then logstash will index the data to Elasticsearch. 
    Then Kibana would read the data from Elasticsearch and visualize it.

DevOps vs DevSecOps vs NetOps

What is DevOps vs DevSecOps vs NetOps ?

DevOps is the practice of using set of tools, processes and practices to get good agility in software implementation to customers. It combines Dev (software development ) and Ops (information operations). DevOps shortens the development lifecycles and provides Continous Integration & Delivery. 
DevSecOps is when security features are included in DevOps CI/CD flow.
NetOps is when network services are packaged to DevOps.

Jenkins job vs pipeline

What is Jenkins jobs and Jenkins pipeline ?

Jenkins jobs and Jenkins pipeline are essentially same, however pipeline is more staged flow of jobs. For Jenkins pipeline, Jenkinsfile is used.
What is Jenkinsfile?Jenkinsfile is a text file placed in the root project directory. The Jenkinsfile has multiple stages like build, unit test, sonar test, functional,  regression, integration,  performance testing, deployment etc.

What is a Java Constructor

A java constructor is a special method used to initialize java objects. Constructor can be used to set initial values for object attributes. Constructor is called when an object of a class is created. Constructor can also take parameters. Constructors can take many parameters they way a method takes.Constructor name should match class name. Also Constructor can not return value.

QA Automation Interview questions

QA Automation Interview questions

  1. Differentiate final , finally, finalize (Short Ans: final method can’t be overridden, final variable can’t be changed, finally goes with try/catch, finalize is garbage collector)
  2. how to handle exceptions in java (Ans: try catch, throws, etc)
  3. how to use parameters in cucumber/testNG (Ans: scenario outline,tidy gherkin plugin, vs testng.xml-suite,test,class,method;)
  4. compare TestNG and Cucumber BDD (Ans: testng.xml, POM,vs feature file,Junit testrunner,stepDefention, POM)
  5. how to validate flatfiles , db using Java (Ans: input filestream, driver class connection, server name, instance , authentication, sql statement)
  6. how to skip method/test in TestNG, Cucumber BDD (Ans: testng.xml, annotation, cucumber tags on testrunner)
  7. differentiate encapsulation , abstraction
  8. what are interface and explain the methods – webdriver interface, driver object reference, FF/IEdriver class (Since interface can not be instantiated)
  9. write programs – sort array, print number in reverse, print string reverse, etc
  10. how does SSL works , public key-private key, session encryption etc
  11. method overridden vs method overloading (super class methods are overridden by child class when both has same methods, overload – one class has multiple methods with same method name but different parameters)
  12. Selenium automation challenges (ajax – webdriver wait methods, frames switch, alert.accept, multiple windows handlers, pdf in webpage, alert vs modal confuse, dynamic id,name-use xpath contains, etc)
  13. handle dropdown – select class
  14. feature file extension
  15. bufferbuilder usage
  16. what is background, scenarios outline, before/afterhooks vs tags, 
  17. usage of autoit, robotclass, javascript executor, 
  18. Jenkins schedule batch, report generation, 
  19. grid setup, hub and node, run on dos prompt, or use JSON file to configure nodes and run JSON on commandline..then connect in Jenkins 
  20. how to manage Git versions between two teams
  21. What is data structure and use of it test automation

Nested Java program loops

Nested Java program loops

import java.util.Scanner;

class NestedIfElse {
public static void main(String[] args) {
int marksObtained, passingMarks;
char grade;

passingMarks = 40;

Scanner input = new Scanner(System.in);

System.out.println(“Input marks scored by you”);

marksObtained = input.nextInt();

if (marksObtained >= passingMarks) {

if (marksObtained > 90)
grade = ‘A’;
else if (marksObtained > 75)
grade = ‘B’;
else if (marksObtained > 60)
grade = ‘C’;
else
grade = ‘D’;

System.out.println(“You passed the exam and your grade is ” + grade);
}
else {
grade = ‘F’;
System.out.println(“You failed and your grade is ” + grade);
}
}
}