Wednesday 21 August 2019

Java VS Javascript - Difference between java and JS

Java vs Javascript


java vs javascript



What is Jscript?


JavaScript(JS or JScript) is a client side programming language used to add programming logic to web pages. This is how you can understand it. HTML is a designing language and it only designs web pages. You cannot perform any logic in web pages through HTML. For example, when the user clicks on the link, you want to perform some processing by calling a function. But you cannot do this through HTML, because HTML is used only to design web pages. For this you need a programming language.

Dynamic web page in Javascript

JavaScript is a similar programming language that adds logic to web pages and makes them dynamic. It was developed by Sun Micro Systems. It was earlier named Live Script which was later changed to JavaScript. JavaScript has object oriented programming capabilities. It is defined in the head section of the HTML file. You cannot perform any calculations with HTML if you do not use JavaScript. You can also perform validation with JavaScript. JavaScript is a programming language that browsers understand and is used exclusively for web pages.

Features of JavaScript


There are 2 important features of JavaScript, which are given below.

Dynamic

JavaScript is able to generate dynamic web pages. JavaScript is capable of making changes in the web page as soon as it is loaded. While loading web pages, it can be decided what task to perform. While this does not happen in HTML, all the actions are already defined in it and you cannot take any action in the load time of web pages generates HTML static pages. But JavaScript generates dynamic pages. For example, the JavaScript page can show weather according to your location while loading.

Client Side

JavaScript is a client side scripting language. Any execution in PHP is performed on the server. But not so with JavaScript. When you use JavaScript, any execution is performed on the client side. For example, validation in JavaScript is performed in the web browser on the client side. But validation in PHP is performed on the server because of this JavaScript reduces the load of the server.


Advantages of javascript 

Javascript is fast

JavaScript is very fast due to being client side. Because it does not waste time in establishing connection to the server. JavaScript executes without connection to the server.

JavaScript is cross platform

JavaScript runs smoothly on any browser and operating systems without any problems. All latest browsers support JavaScript by default.

Javascript works with multiple languages

JavaScript can easily work with other languages. Such as HTML, CSS and PHP etc.

Javascript is Simple

JavaScript is a very simple language. Anyone can learn and implement it easily.


Disadvantages of JavaScript


Apart from the advantages, there are also the disadvantages of JavaScript which are given below.

Less secure

The code of JavaScript executes on the client side, so some viruses can come in it. Because of this JavaScript is not considered to be very secure.

Execution Vary

JavaScript gives different results on different browsers. But this is not the case with server side scripting languages. The server side script always returns the same result, regardless of the browser.

No Support for Network Applications

JavaScript cannot work with network applications because there is no support available in JavaScript for this.

Functions of JavaScript

  1. JavaScript is used to create dynamic web pages.
  2. Highly interactive web pages are created from this.
  3. By performing validation on the client side via JavaScript, you can reduce the load of the server.
  4. With this you can solve many problems related to browser.
Thats all we have for JS, Now let us discuss what is java and what is difference between java and javascript.


 JAVA



 History of Java


Java is a general purpose object oriented programming language. Sun microsystems java 1991 Was made in Earlier java was named oak but later it was changed to java. Java was developed by James Gosling. Java was primarily developed to make consumer electronics such as TV, VCR etc. software.
The most important and popular feature of Java was that the java platform was independent. Because java was not made for any particular hardware or operating system. Therefore programs created in java can be executed on any system. This feature of Java makes java the most popular language even today.

Features of Java


Java has many features. To become a good java programmer, you should know all these features. Let's try to learn about some popular features of java.

Compiled and Interpreted


Most programming languages ​​are either compiled or interpreted. But java combines these two approaches and creates a two stage system. First, java compiler your program and generate byte code.

Byte code does not contain machine instructions. Therefore java generates machine code by interpreting bytecode in the second stage, which can be executed directly.

Java is platform independent

Makes Java bytecode platform independent. When you compile a java program, it is converted into byte code. This byte code cannot run on any machine or operating system. It only runs on JVM (Java Virtual Machine).

To run Java's program, you have to install JVM on your operating system. There is a separate JVM for each operating system but all do the same. And that is to convert bytecode into machine code for that operating system.

So the bytecode generated by the JVM of one operating system can be run on any other JVM. And then the JVM generates machine code for that operating system. So different machine code is generated for different machines but it is generated from the same byte code because your program is first converted to byte code.

Java is object oriented

Java is a true object oriented programming language. Almost everything in Java is object. Java stores all information as objects.

Robust and Secure

If we talk about user experience then java is a robust language. Any program created in Java can work in different environments with different technologies without crashing. Its programs never crash. It is very reliable language. Security in Java is provided by JVM. The machine detects invalid combinations by running some tests on the JVM before generating the code.

Distributed

From Java you can create distributed applications. Distributed applications are applications that are on different networks. And perform the task together. Through RMI in Java, you can interact with the applications available on other networks.

Simple and famous

Java is a simple language. Many features of Java are derived from c and c ++. Java's syntax is similar to c and c ++. Such as variable declarations, control statements and method declarations etc. All these make java easy to understand. Because java is designed with c and c ++ in mind, it seems familiar to most programmers.

Multi-threaded and Interactive

By default java is a multithreaded language. Any java program can complete many tasks simultaneously. This feature makes java fast and interactive.

High performance

When it comes to performance, the performance of java is very impressive. Java's speed is the main reason byte code. The architecture of Java is designed in such a way that the overhead at junta is very low.

Dynamic and Extensible

Java is a dynamic language. Java is capable of dynamic linking from libraries, methods and classes during run time. Therefore java can be used easily with new technologies.

Ease of Development

Developing programs in Java is very easy. Java provides you with built-in libraries which contain important classes for your use. This reduces the overhead of the programmer. The programmer can easily develop software by accessing these libraries.

Object Oriented Principles of Java

As I told you java is an object oriented language. Java also follows object oriented principles like all object oriented programming languages. Let us try to learn about these principles.

Encapsulation

Encapsulation is also called data hiding. In encapsulation you declare private variables. And access them through public methods, your variables can be accessed by methods of your own class.
No other class can access your variables. In this way, you also hide and use the data. Another means of encapsulation is to bind data and code to a unit and prevent access from outside


Thats all we have for difference between java and javascript. Java is an object oriented language whereas javascript is object based scripting language.




Monday 12 August 2019

Exception handling in Java - handle exception in java

Exception handling in Java

Exception handling in java

Exception handling is a very important feature in Java. This helps in handling bad user experience. Exceptions are run time errors. Exception is a situation that stops the program while you are running. Just as the amount of memory your program needs to execute, if your memory is not in your computer, then execution of your program will stop. This is the out of memory exception. Similar situations are called exceptions in java and they are handled. Exception handing plays very important part in selenium. Exception handling interview questions will be based on below tutorials. Let's start with exception handing in details

Program Crashes


Just like if you forget to put semicolon in front of a statement while creating a program, then the program error shows you and is not compiled. Similarly, when exception is generated in java (or not handled), your program stops and does not execute.

Handle a java program


If you want that your program does not stop executing on the exception, then for this you have to handle exceptions. This is called exception handling in java. When you handle exceptions, your program does not stop at the exception, but instead executes the rest of the code by skipping the exception code.

Java Exception Handling


In Java, you handle exceptions with the help of some keywords. All these keywords together form a structure that is very easy to implement.

Try

The code of your program that can generate an exception, you write it in the try block. For example, you are doing a mathematical operation in the program and you feel that an exception can be generated, then you write that code in the try block.

Throw

Most of the possible exceptions are already defined in the java library for you and these exceptions throw java automatically, you just have to handle them. But if you want, you can also create your own exceptions. You have to throw such exceptions yourself, for this you use throw keyword. You can also throw a predefined exception if you want.

Catch

If an exception is generated in the try block, it is handled in this block. You write the code in this block that you want to execute when an exception occurs. For example, you can print a message that tells the user that an exception has been generated.


Throws

You can use nested try blocks. And in such a situation, if you want an exception to handle the outer try block, then in such a situation you use the throws keyword. You write the names of all exceptions by putting the throws keyword next to the definition in the method. If an exception occurs, the outer try block handles it.

Finally

After handling the exception, you finally write the code you want to execute. After the exception in the try block, the compiler does not execute that code and finally executes the block directly after the catch block.

Steps to Handle Java Exceptions

First of all, write the code in the try block from which exception can be generated.
After the try block, write the code to handle runtime exception in java in the catch block. As such, you can print a message related to the exception.

After handling the exception, finally write the code that you want to execute. It is very important for you to know about exceptions before handling the Exceptions. There are some exceptions that occur regularly in java. You can easily practice on these common exceptions and improve your skill. Some common exceptions coming regularly in Java are being described below.

Exceptions in Java


Arithmetic Exceptions

Any arithmetic error such as Arithmetic Exception is generated if you try to divide a number by zero or try to store more value than its size in a variable.

Class cast exception

Class-Cast-Exception is generated if you want to store the reference of a class to another class and if the first class is not a subclass of the second class.

Array Store Exception

If you have created a string array and you try to store string in it, then Array-Store Exception is generated.

Array Index Out Of Bounds Exception

Array-Index-Out-Of-Bounds-Exception is generated if the size of your array is 10 and you try to store the value at the 11th position or access the 11th position.

Illegal Argument Exception

Illegal-Argument-Exception is generated when you pass an invalid argument in a method such as passing the string instead of int.

Null Pointer Exception

In Java you can assign null value to a reference variable, but if you try to use this reference variable, NullPointerException is generated.

 Number Format Exception

When you try to cast a string value to a number, a Number-Format-Exception occurs.



We will bring more exception handling in java with examples. To know more about testing check this : Manual Testing




Friday 9 August 2019

SDLC Phases : Software development life cycle



software testing life cycle - SDLC phases


What is SDLC?


The full name of SDLC is software development life cycle. It is also called system development life cycle. SDLC describes the life cycle of a software or system and SDLC is a process of how system is developed. Software development methodologies or SDLC methodologies plays important role in software development and software testing. Database design is a fundamental component of SDLC. All the steps or process that takes place in building any system is called the system development life cycle (SDLC). SDLC is the mose important topic if preparing for ISTQB.

Similarly we have STLC which stands for software testing life cycle which describe the life cycle of software testing with different testing phases such as Requirement analysis/ Requirement gathering, Test planning, Test case development, Environment setup , Test execution and Test case closure. Now let’s start with learning SDLC phases in detailed manner.

 SDLC Phases:


There are five phases / steps in system development life cycle. Which is as follows: -

  1. Planning
  2. Analysis
  3. Detailed system design
  4. Implementation
  5. Maintenance



1. Planning: - What is the first step of the system development life cycle? In the planning phase and analysis , we discuss what we want the software to achieve or what its goals are. The quality requirements and risk identification of the software are also included in the planning phase and while planning phase it should be primary aim to deliver high quality software.
In this phase we see whether the system (software) that is present is doing its work properly or not. If he is doing his job properly then there is no need to change him. In this we also evaluate the cost. How much cost will be required to design the system, this all comes in the planning phase.

2. Analysis: - In the planning phase, problems are defined and in the analysis phase those problems are examined with more details. In the analysis phase, the user requirements are seen, what are the needs of the end users. In this phase the hardware and software of the system are studied thoroughly. In this, both end users and designers together solve the problem areas.

3. Detail system design: - We always have a question that what is the design phase in SDLC? In the detail system design phase, the designer completes the design of the system's process. The system includes complete technical specifications so that the system becomes even more interactive and efficient.

4. Implementation: - In this phase, hardware, DBMS software and application programs are installed and database design is implemented. Before database design can be implemented, the system has to go through testing, coding, and debugging processes. This is the longest running phase in SDLC.

5. Maintenance: - This is the last phase of SDLC. When the system (software) is ready and the users start using it, then the problems that come in them have to be solved time-to-time. Maintaining the finished system (software) in a timely manner and maintaining it is called maintenance. SDLC has three types of maintenance: - Corrective maintenance, adaptive maintenance and Perfective maintenance.

Software development life cycle phases

  • Requirement gathering
  • Feasibility Study
  • Requirement gathering
  • System Analysis
  • System design
  • Software Development
  • Testing
  • Implementation
  • Maintenance
  • Review


1. Requirement Gathering: - The first step of the system development life cycle is to find out the real problem of the system and to do any further work without knowing the problem in the system is to make the effort fruitless. Problems in any system define user requirements. In this phase, the system analyst discovers the problem and discuses what we have to achieve from the system or what is its goal. In this phase we see whether the current system is doing its job properly or not. Both functional requirements and non functional requirements must be coved as a part of requirement analysis.

2. Feasibility Study: - Under the feasibility study, it is considered whether to improve the existing system or to develop a completely new system. The feasibility study helps in understanding the overview of the problem. The feasibility study is done to ensure that the project is carried forward, or to postpone or cancel.

3. System Analysis: - System analysis is the most important phase of the system development life cycle. In the first phase the problem is defined, and in this phase those problems are investigated with more depth. In this stage the user requirements are seen, what are the needs of the end users. In this phase the hardware and software of the system are thoroughly studied. In this, both end users and designers together solve the problems.

4. System design: - In this stage the designer completes the design of the process of the system. The system includes complete technical specifications so that the system becomes even more interactive and efficient.

5. Software Development: - Creating software or program after system design is the next stage of SDLC. Development is the stage where the programmer coding the program according to the system design means that in this phase the system changes to actual.

7. Software Testing: - System testing is done in this phase before the database design is implemented. This is the testing phase in the system development. The main is to deliver quality software to the customer. The system has to go through testing, coding, and debugging process. This is the longest time in SDLC. Want to know more about software testing check Software Testing

6. Implementation: - In this step, hardware, DBMS software and application programs are installed and database design is implemented.

7. Maintenance: - When the system is ready and the users start using it, then any problem that comes in them has to be solved from time to time. Maintenance of the finished system according to time is called maintenance.

8.Review:- When the system is implemented, the user is asked to review whether the system is capable of meeting the user's requirements.


Manual Testing Tutorials - What is manual testing



What is manual testing

What is Manual Testing?

Software testing is done to find the process or method of finding errors / errors in the software application or program known to enable the application to function according to the need of the end users. This is the prime responsibility in manual testing jobs.

Manual testing involves manually testing a software without using any automated tools or any scripts as we create selenium script for automation testing. Thus, the manual tester plays the role of a end user who tests the software to identify any unexpected behavior, bugs or defects. There are various steps for manual testing such as unit testing, integration testing, system testing, and user acceptance testing.

Where software testing is done to find the process or method of finding errors in the software application or program known to enable the application to function according to the need of the end users.

According to the definition of manual testing - the process of analyzing software items to detect differences between existing and required conditions and to evaluate the features of software items.

Automation testing is also part of software testing where automation testing tools are used to perform actions automatically. Manual testing interview questions basically comes from basic of manual testing where many skilled testers struggle. Lets discus below types of manual testing or Manual testing tutorial.


Methods of Software testing

1. White Box Testing:


White-box testing is also called open-box testing or glass box testing . White-Box Testing is a detailed examination of internal logic and code structure. The tester monitors the source code and finds out which unit / part of the code is behaving incorrectly. White-Box Testing is used to design the test case of the programming scheme along with the internal perspective of the system. This testing is usually done at the unit level.

2. Black Box Testing:


It is also called Behavioral Testing. This is the technique of manual testing without any knowledge about the internal work of the application is called black-box testing. In this manual tester is not aware of the architecture of the system and don't have much coding knowledge.
Typically, while performing black-box testing, the tester interacts with the user interface of the system by giving input and checking its output, without knowing how and where the input is handled.


3. Gray-Box Testing:


Gray-Box Testing is a technique for testing applications with limited knowledge of the application's internal functionality. In software testing, the more you know the tester phrase, the better the application can be tested. Unlike black-box testing, where the tester only tests the user interface of the application. In gray-box testing, the tester has access to the design document and database. With this knowledge, a tester can create better test data and test scenarios.

Types of Software Testing


A. Functional Testing:


It is a type of black-box testing that is based on the specifications of the software being tested. The application is tested by providing input and then checking the results which should correspond to the intended functionality for it. Functional testing of a software is performed on a complete, integrated system, which evaluates system compliance according to specific requirements.

Type of Functional Testing

1. Integration Testing


Integration testing is defined as testing the combined parts of an application to determine whether they function correctly.Integration testing can be done in two ways: bottom-up integration testing, top-down integration testing and mixed integration testing.


2. Unit Testing


Unit Testing is done to check if different modules of the source code are working properly. That is, in the developer's environment, each unit of the application is tested separately by the developer.The goal of unit testing is to separate each part of the program and to check that all the requirements.

3. System Testing:


System testing fully tests the system. Once all components are integrated, the entire application is rigorously tested to see that it satisfies the specified quality standard. This type of testing is done by a specialized testing team.

4. Regression Testing


Whenever a software application changes, it is quite possible that other applications within the application have also been affected by this change.Regression testing is done to verify that the fixed bug is not violating other functionality or business rules.

5. Acceptance Testing


This testing is done to get customer sign-off, so that the software can be delivered and payment is received.

B. Non-Functional Testing:


This is based on testing an application with non-functional features. Non-functional testing involves testing software from requirements that are non-functional in nature but are important for performance, security, user interface, etc.

1. Performance Testing:


It is mostly used in software to identify any bottlenecks or performance problems rather than finding bugs.There are various reasons why the software performance is low - Network delay , Load balancing between servers, Data rendering, speed, capacity or Stability.

2. Load Testing:

It is the process of examining the behavior of software by applying the maximum load in terms of accessing the software and manipulating large input data. This can be done in both normal and extreme load conditions. This type of testing identifies the software's maximum capacity and its behavior at peak times.

3. Security Testing

Security testing involves testing the software to identify any defects in security. This is perform on applications to check if it is free from any risk , vulnerabilities or threats.



Manual testing interview questions will be asked maximum of the time from above discussed topics. We will soon be posting manual testing resume which will help in finding relevant manual testing job.

For Automation testing resume check out here : Selenium Resume








Saturday 3 August 2019

Selenium with cucumber interview questions

Selenium with cucumber interview questions

Selenium with cucumber interview questions

Cucumber Interview Questions

This tutorial would be very useful for all the selenium automation tester out there who are planning to switch to another company or actively looking for a job change. As we all know that selenium skills is rising over the past couple of years and it has become difficult to crack interview with the increase in competition in this skill. We would be discussing few of interview questions on selenium which interviewer most of the time seeks the interviewee to answer. We have few selenium interview questions that will help in preparing for interview


That's why the easiest way to crack any interview is preparation. As selenium or automation testing is skill set that is required by maximum of the organization because of it being open-source, free and support of different programming language like java, c# , Ruby or perl. Now lets have a look on automation test interview questions which are frequently asked in any QA automation interview.


Automation testing interview questions in selenium

1. Explain Framework used in selenium ?

This is most frequent as well as most important question asked to qa automation engineer. This question should be prepared at best when preparing for automation test interview. This answer will totally depends on framework used in your current project which can be cucumber,POM(Page object model) or using TestNG testing tool.

Answer to this question should start with explaining the framework which includes project structure (may vary if using POM or cucumber), packages names, page object java files, locators source file, reporting tool used etc.

For Page object model this must be explained as we are using page object model design pattern in current project with page factory. We have stored web element locators with xpath and css selectors in a separate file under a package name "locators". We write test case in separate file where we use the paths and execute the case using TestNG.

For automation engineers who are using Cucumber testing tool in project they need to explain it in a way that they are creating feature file, step definition file and page object file in separate packages and then running the feature file with runner class by providing tag in the class and adding it to the scenario in feature file. This need to be elaborate and in detailed way so interviewer gets confidence that you are a genuine resource with good hands on experience.

2. How to handle dynamic table in web page or web application.

This question is also frequently asked that how can we handle dynamic table in selenium. Interviewer intention would only to be see the approach we are using to validate the table. For answer please visit this post handle dynamic table in web page.

3. How to upload file using selenium automation tool?

This is also frequently asked in test automation interview questions, We can upload file using two method in selenium WebDriver by upload file in selenium webdriver using sendkeys and selenium webdriver using AutoIt. For more info visit this - Uplaod file in selenium

4. What is data driven testing and how to achieve?

Data driven means fetching the data from the excel sheet which we can use as test data. Instead of implicitly writing test data in the scripts it is always a better approach to keep the test data to excel sheet and fetch it using Apache POI API. For more information visit - Data driven in selenium

5. What is selenium IDE and how is it different from selenium grid?

This software testing interview question is asked just to check if we are aware of types of testing tools such as selenium IDE, selenium RC and selenium grid.

Selenium IDE is an Integrated development environment for selenium testing tool. It allow us to edit,record and debug a test. It is only available in Firefox extension. It includes entire selenium core whereas selenium grid is part of selenium suite which is used to run multiple test in multiple browser at a same time. For more information go to : what is selenium IDE

6. How to capture screenshot in selenium webdriver?

Taking screenshots as an evidence of successful test run or in case of failure is very important. This shows that the test case is passed or failed in a steps. This question need to be prepared as a testing interview automation question. Screenshots in selenium can be taken by typecasting web driver instance to TakeScreenshot. For more info check : Take Screenshot in selenium webdriver

7. What are major advantages of cucumber framework?

Cucumber uses BDD approach helps in building a bridge of communication between the IT developers and business or clients. There are many advantages of cucumber tool few of them are mentioned below:

  • Cucumber is open source which gains interest of business.
  • Communication gap between IT folks and business is reduced which helps in delivering quality applications.
  • It is written in plain English which make it easier for everyone to understand the scenario.
  • Automation scripts are easier to maintain as well.


We will be posting more QA automation interview questions in website soon.

Thursday 1 August 2019

How to upload file in selenium - robot class and AutoIT

Upload file in selenium

This is the most frequent question how to upload file in selenium that we always have in selenium webdriver to upload files in upload section of a web page or a web form.We have mainly 2 method that we can use to upload file in web page.One method is Upload file in selenium webdriver using sendkeys and other is upload file in selenium webdriver using autoit.

How to upload a file using selenium webdriver in java

We will see how we can upload file in selenium webdriver using sendkeys.This is the most frequently used technique to upload file using sendkeys().This is the inbuild selenium method to send key values to textbox but here we will see how we can use this method to upload files in the upload element or upload section or browse button.


Upload file in selenium webdriver using sendkeys:

Below is the generic method that we will used to upload the files by just passing the file path as a parameter to the method and this method will find the upload element in the UI and send the path of the file to upload or upload to input type file. Below is the method which will be used to upload file in selenium

Method to upload file in selenium:
public static void main(String args[])
{ public void Upload_document_in_Selenium(String filepath)
{
delay(3);
int in=filepath.indexOf(".");
FilePaths=filepath.substring(0,in);
String path = System.getProperty("user.dir")+"\\TestData\\"+FilePaths;
    delay(3);
        UploadFile.sendKeys(path);
delay(10);
UploadButton.click();
delay(3);
clickNext.click();
}
}


Upload file in selenium,upload file in selenium webdriver using sendkeys


The above method will get the file path and upload the file using selenium sendkeys method, now if this does not work due to any limitation of the application or technology used in the web development. we can take the help of upload file in selenium webdriver using robot class or upload file in selenium webdriver using autoit.
We will see how we can upload file in selenium using autoit in next blog. Use this upload trick more efficiently in projects and happy testing