Location Protocol Property in JavaScript

AmitDiwan
Updated on 16-Aug-2023 15:03:36

229 Views

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

Disable HTML Reporting for TestNG with Maven

Ashish Anand
Updated on 16-Aug-2023 15:01:50

269 Views

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

preventDefault vs Return false in JavaScript

AmitDiwan
Updated on 16-Aug-2023 14:59:37

3K+ Views

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

Create Test Case Using TestNG Annotations

Ashish Anand
Updated on 16-Aug-2023 14:57:50

186 Views

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

Advantages of TestNG Over JUnit

Ashish Anand
Updated on 16-Aug-2023 14:50:50

306 Views

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

Advantages of Using TestNG with Cucumber

Ashish Anand
Updated on 16-Aug-2023 14:49:34

664 Views

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

Automating Functional Tests with TestNG

Ashish Anand
Updated on 16-Aug-2023 14:48:20

332 Views

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

Explain Focus Events in JavaScript

AmitDiwan
Updated on 16-Aug-2023 14:46:06

1K+ Views

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

LastIndex Property in JavaScript

AmitDiwan
Updated on 16-Aug-2023 14:28:09

126 Views

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

What are JavaScript Symbols

AmitDiwan
Updated on 16-Aug-2023 14:24:58

730 Views

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

Advertisements