This article will teach us how to use the Javascript location protocol properties to implement the web application's protocol. The read−only location.protocol property in javascript returns the protocol specified in the current webpage's URL. It offers details on the URL's protocol, including "http:", "https:", "file:", etc. Common protocol values that are utilised by numerous web apps include − http − It represents the Hypertext Transfer Protocol (HTTP). https − It represents the Hypertext Transfer Protocol Secure (HTTPS). file − It represents the File Transfer Protocol (FTP). ftp − It represents the File Transfer Protocol (FTP). data − It represents the data ... Read More
Maven is a project management and comprehension tool that provides a complete build lifecycle framework. User can automate the project's build infrastructure in almost no time as Maven uses a standard directory layout and a default build lifecycle. In case of multiple environments, Maven can set−up the way to work as per standards in a very short time. As most of the project setups are simple and reusable, Maven makes life easy while creating reports, checks, build and testing automation setups. Maven provides developers ways to manage the following: Builds Documentation Reporting Dependencies SCMs Releases Distribution Mailing list ... Read More
In this post, we will discover how to use javascript's preventDefault and return false functions to override an event's default behaviour. The two most popular JavaScript methods for stopping an event's default behaviour are preventDefault() and return false. Let’s understand both of the concepts below − preventDefault() Return false The preventDefault() method is a function available on event objects in JavaScript Return false is not a function, but a javascript statement It helps to stop a certain event's default behaviour. It not only prevents the default behavior but also stops the event from ... Read More
Writing a test in TestNG basically involves the following steps − Write the business logic of the test and insert TestNG annotations in the code. Add the information about the test (e.g. the class name, the groups you wish to run, etc.) in a testng.xml file or in build.xml. Run TestNG. In this article, we will see one complete example of TestNG testing using POJO class, Business logic class and a test xml, which will be run by TestNG. Approach/Algorithm to solve this problem Step 1: Create EmployeeDetails.java in src, which is a POJO class as shown ... Read More
JUnit and TestNG are the most popular testing frameworks for Java applications. Both frameworks are easy to use. So, when it comes to choose the testing framework for your application, it’s better to have a high−level idea of what features are present in one or the other and then take the informed decision based on your project requirements. In this article, we will compare and contrast the different features of TestNG and JUnit. JUnit vs TestNG The following table compares JUnit vs TestNG on different features. The table excludes very specific or common features that are present in both these ... Read More
Testing is the process of checking the functionality of an application to ensure it works as per requirements. Unit testing comes into picture at the developer level where adequate measures are taken to test every single entity (class or method) to ensure the final product meets the requirements. What is Cucumber? Cucumber is a testing tool that supports Behaviour Driven Development (BDD) framework. It defines application behaviour using simple English text, defined by a language called Gherkin. Cucumber allows automation functional validation that is easily read and understood. Cucumber was initially implemented in Ruby and then extended to Java framework. ... Read More
TestNG is a powerful testing framework, an enhanced version of JUnit which was in use for a long time before TestNG came into existence. NG stands for 'Next Generation'. TestNG framework provides the following features − Annotations help us organize the tests easily. Flexible test configuration. Test cases can be grouped more easily. Parallelization of tests can be achieved using TestNG. Support for data−driven testing. Inbuilt reporting. Selenium Webdriver allows to interact with webpages. It is an interface not a testing framework. To run any test or code only in selenium we must use java main method. TestNG ... Read More
The focus of items on a web page can be determined via focus events, which we will learn about in this article. The numerous browser−provided events that are triggered when an HTML element gains or loses attention are known as focus events in JavaScript. These occasions can be utilised in a number of contexts, for as in response to user actions like clicking on an input field. We can track when a web page element obtains or loses focus with the aid of focus events. There are three main focus events in JavaScript − Focus − This event gets ... Read More
In this tutorial, we will learn about the lastIndex property in javascript. In addition to this, we will also learn about how we can use it to manage matches within a string The lastIndex property is a property given by regex objects in JavaScript. It represents the index at which the next search will start within a string passed in the regex, or in simple terms, the index at which to start the next match in a string. When using a regex object with methods like exec(), compile(), etc, the lastIndex property is automatically updated to the index after the ... Read More
A symbol in JavaScript is a primitive data type, introduced in ES6 version update, that represents an immutable and unique identifier. Unlike other primitive types like strings, booleans, numbers, etc, symbols are guaranteed to be unique. This implies that even if two symbols have the same content, they are going to be distinct (separate) entities and not equal to each other. Symbols are primarily used to avoid naming conflicts when adding properties to objects. In this Tutorial, we will learn about symbols in JavaScript. Along with that we will also learn how we can use them to add properties in ... Read More