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.
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
4) Now type: http://localhost:4444 in browser
Your will see the below screen
5) Now type: http://localhost:4444/console in browser
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.
ELK stack is a combination of 3 open-source products as below,
Elasticsearch, a search and analytics engine.
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.
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 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 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.
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.
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)
how to handle exceptions in java (Ans: try catch, throws, etc)
how to use parameters in cucumber/testNG (Ans: scenario outline,tidy gherkin plugin, vs testng.xml-suite,test,class,method;)
how to validate flatfiles , db using Java (Ans: input filestream, driver class connection, server name, instance , authentication, sql statement)
how to skip method/test in TestNG, Cucumber BDD (Ans: testng.xml, annotation, cucumber tags on testrunner)
differentiate encapsulation , abstraction
what are interface and explain the methods – webdriver interface, driver object reference, FF/IEdriver class (Since interface can not be instantiated)
write programs – sort array, print number in reverse, print string reverse, etc
how does SSL works , public key-private key, session encryption etc
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)
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)
handle dropdown – select class
feature file extension
bufferbuilder usage
what is background, scenarios outline, before/afterhooks vs tags,
usage of autoit, robotclass, javascript executor,
Jenkins schedule batch, report generation,
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
how to manage Git versions between two teams
What is data structure and use of it test automation
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);
}
}
}