Posts

Showing posts from November, 2018

serenity cucumber selenium automation

BDD fundamentals Behaviour-Driven Development (BDD) is a collaborative approach to software development that bridges the communication gap between business and IT. BDD helps teams communicate requirements with more precision, discover defects early and produce software that remains maintainable over time. Writing acceptance criteria with Cucumber-JVM In Cucumber, you express acceptance criteria in a natural, human-readable form. For example, you want to write acceptance criteria for sending a mail you could write like this: Given I want to send a mail When I login to to mail box. clicked compose button, entered the details and clicked send Then I should see mail sent to the receiver. Sometimes tables can be used to summarize several different examples of the same scenario. Scenario Outline: sending a mail Given I have login to the mail box When I can enter the details '<Email>' and '<Subject>' Then I should see mail sent succes...

cucumber selenium automation for ag-Grid example

How to select row in xpath?

What is addShutdownHook method in java?

addShutdownHook method registers a new virtual-machine shutdown hook. A shutdown hook is a initialized but unstarted thread.  When JVM starts its shutdown it will start all registered shutdown hooks in some unspecified order and let them run concurrently.  When JVM (Java virtual machine)  shuts down > When the last non-daemon thread finishes, or when the System.exit is called. Once JVM’s shutdown has begun new shutdown hook cannot be registered neither  previously-registered hook can be de-registered. Any attempt made to do any of these operations causes an IllegalStateException. Example: public class AddShutDownHookTest extends Thread{    public static void main(String[] args) throws InterruptedException {              System. out .println( "main thread started" );                 ...

What is preemptive scheduling and time slicing in java

In preemptive scheduling, the highest priority thread executes until it enters into the waiting or dead state. In time slicing, a thread executes for a certain predefined time and then enters runnable pool. Than thread can enter running state when selected by thread scheduler.

When to use ArrayList and when to use LinkedList in application?

ArrayList has constant time search operation O(1) .Hence, ArrayList is preferred when there are more get() or search operation . Insertion , Deletion operations take constant time O(1) for LinkedList. Hence, LinkedList is preferred when there are more insertions or deletions involved in the application.

Lombok "val" example

" val " can use as the type of a local variable declaration instead of actually writing the type. Java With out Lombok public class ValExample {   public void example() {     ArrayList<String> example = new ArrayList<String>();     example.add("Hello, World!");     String foo = example.get(0);   } } Java With Lombok import java.util.ArrayList; import java.util.HashMap; import lombok.val; public class ValExample {   public void example() {     val example = new ArrayList<String>();     example.add("Hello, World!");     val foo = example.get(0);   } }

Lombok @Builder example

The @Builder annotation produces complex builder APIs for your classes. Java With Out Lombok public class BuilderExample {   private String name;   private int age;     BuilderExample(String name, int age) {     this.name = name;     this.age = age;     this.occupations = occupations;   }   //setter and getter } With Lombok import lombok.Builder; import lombok.Singular; @Builder public class BuilderExample {   private String name;   private int age; } Lombok with java 8 example BuilderExample.builder().name("Test").age(20).build();

Project Lombok Example

Lombok features The  Lombok javadoc  is available, but we advise these pages. val Finally! Hassle-free final local variables. var Mutably! Hassle-free local variables. @NonNull or: How I learned to stop worrying and love the NullPointerException. @Cleanup Automatic resource management: Call your  close()  methods safely with no hassle. @Getter/@Setter

Project lombok Installation in IDE

IntelliJ IDEA The  Jetbrains IntelliJ IDEA  editor is compatible with lombok. Add the  Lombok IntelliJ plugin  to add lombok support for IntelliJ: Go to  File > Settings > Plugins Click on  Browse repositories... Search for  Lombok Plugin Click on  Install plugin Restart IntelliJ IDEA Eclipse Download from https://projectlombok.org/download

Project Lombok dependencies

Lombok Gradle dependencies lombok { version = '1.18.4' sha256 = "" } Maven Dependencies <dependencies> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.4</version> <scope>provided</scope> </dependency> </dependencies>