Best Mockito code snippet using org.mockito.invocation.Location
Source:InterceptedInvocation.java
...12import org.mockito.internal.exceptions.VerificationAwareInvocation;13import org.mockito.internal.invocation.mockref.MockReference;14import org.mockito.internal.reporting.PrintSettings;15import org.mockito.invocation.Invocation;16import org.mockito.invocation.Location;17import org.mockito.invocation.StubInfo;18public class InterceptedInvocation implements Invocation, VerificationAwareInvocation {19 private static final long serialVersionUID = 475027563923510472L;20 private final MockReference<Object> mockRef;21 private final MockitoMethod mockitoMethod;22 private final Object[] arguments;23 private final Object[] rawArguments;24 private final RealMethod realMethod;25 private final int sequenceNumber;26 private final Location location;27 private boolean verified;28 private boolean isIgnoredForVerification;29 private StubInfo stubInfo;30 public InterceptedInvocation(31 MockReference<Object> mockRef,32 MockitoMethod mockitoMethod,33 Object[] arguments,34 RealMethod realMethod,35 Location location,36 int sequenceNumber) {37 this.mockRef = mockRef;38 this.mockitoMethod = mockitoMethod;39 this.arguments = ArgumentsProcessor.expandArgs(mockitoMethod, arguments);40 this.rawArguments = arguments;41 this.realMethod = realMethod;42 this.location = location;43 this.sequenceNumber = sequenceNumber;44 }45 @Override46 public boolean isVerified() {47 return verified || isIgnoredForVerification;48 }49 @Override50 public int getSequenceNumber() {51 return sequenceNumber;52 }53 @Override54 public Location getLocation() {55 return location;56 }57 @Override58 public Object[] getRawArguments() {59 return rawArguments;60 }61 @Override62 public Class<?> getRawReturnType() {63 return mockitoMethod.getReturnType();64 }65 @Override66 public void markVerified() {67 verified = true;68 }...
Source:InvocationBuilder.java
...8import java.lang.reflect.Method;9import java.util.LinkedList;10import java.util.List;11import org.mockito.Mockito;12import org.mockito.internal.debugging.LocationImpl;13import org.mockito.internal.invocation.mockref.MockReference;14import org.mockito.internal.invocation.mockref.MockStrongReference;15import org.mockito.invocation.Invocation;16import org.mockito.invocation.Location;17import org.mockitousage.IMethods;18/**19 * Build an invocation.20 */21@SuppressWarnings("unchecked")22public class InvocationBuilder {23 private String methodName = "simpleMethod";24 private int sequenceNumber = 0;25 private Object[] args = new Object[] {};26 private Object mock = Mockito.mock(IMethods.class);27 private Method method;28 private boolean verified;29 private List<Class<?>> argTypes;30 private Location location;31 /**32 * Build the invocation33 * <p>34 * If the method was not specified, use IMethods methods.35 *36 * @return invocation37 */38 public Invocation toInvocation() {39 if (method == null) {40 if (argTypes == null) {41 argTypes = new LinkedList<Class<?>>();42 for (Object arg : args) {43 if (arg == null) {44 argTypes.add(Object.class);45 } else {46 argTypes.add(arg.getClass());47 }48 }49 }50 try {51 method =52 IMethods.class.getMethod(53 methodName, argTypes.toArray(new Class[argTypes.size()]));54 } catch (Exception e) {55 throw new RuntimeException(56 "builder only creates invocations of IMethods interface", e);57 }58 }59 Invocation i =60 createInvocation(61 new MockStrongReference<Object>(mock, false),62 new SerializableMethod(method),63 args,64 NO_OP,65 location == null ? new LocationImpl() : location,66 1);67 if (verified) {68 i.markVerified();69 }70 return i;71 }72 protected Invocation createInvocation(73 MockReference<Object> mockRef,74 MockitoMethod mockitoMethod,75 Object[] arguments,76 RealMethod realMethod,77 Location location,78 int sequenceNumber) {79 return new InterceptedInvocation(80 mockRef, mockitoMethod, arguments, realMethod, location, sequenceNumber);81 }82 public InvocationBuilder method(String methodName) {83 this.methodName = methodName;84 return this;85 }86 public InvocationBuilder seq(int sequenceNumber) {87 this.sequenceNumber = sequenceNumber;88 return this;89 }90 public InvocationBuilder args(Object... args) {91 this.args = args;92 return this;93 }94 public InvocationBuilder arg(Object o) {95 this.args = new Object[] {o};96 return this;97 }98 public InvocationBuilder mock(Object mock) {99 this.mock = mock;100 return this;101 }102 public InvocationBuilder method(Method method) {103 this.method = method;104 return this;105 }106 public InvocationBuilder verified() {107 this.verified = true;108 return this;109 }110 public InvocationMatcher toInvocationMatcher() {111 return new InvocationMatcher(toInvocation());112 }113 public InvocationBuilder simpleMethod() {114 return this.method("simpleMethod");115 }116 public InvocationBuilder differentMethod() {117 return this.method("differentMethod");118 }119 public InvocationBuilder argTypes(Class<?>... argTypes) {120 this.argTypes = asList(argTypes);121 return this;122 }123 public InvocationBuilder location(final String location) {124 this.location =125 new Location() {126 public String toString() {127 return location;128 }129 public String getSourceFile() {130 return "SomeClass";131 }132 };133 return this;134 }135}...
Source:NumberOfInvocationsChecker.java
...6import java.util.List;7import org.mockito.internal.reporting.Discrepancy;8import org.mockito.internal.verification.api.InOrderContext;9import org.mockito.invocation.Invocation;10import org.mockito.invocation.Location;11import org.mockito.invocation.MatchableInvocation;12import static org.mockito.internal.exceptions.Reporter.neverWantedButInvoked;13import static org.mockito.internal.exceptions.Reporter.tooLittleActualInvocations;14import static org.mockito.internal.exceptions.Reporter.tooLittleActualInvocationsInOrder;15import static org.mockito.internal.exceptions.Reporter.tooManyActualInvocations;16import static org.mockito.internal.exceptions.Reporter.tooManyActualInvocationsInOrder;17import static org.mockito.internal.invocation.InvocationMarker.markVerified;18import static org.mockito.internal.invocation.InvocationMarker.markVerifiedInOrder;19import static org.mockito.internal.invocation.InvocationsFinder.findFirstMatchingUnverifiedInvocation;20import static org.mockito.internal.invocation.InvocationsFinder.findInvocations;21import static org.mockito.internal.invocation.InvocationsFinder.findMatchingChunk;22import static org.mockito.internal.invocation.InvocationsFinder.getLastLocation;23public class NumberOfInvocationsChecker {24 private NumberOfInvocationsChecker() {25 }26 public static void checkNumberOfInvocations(List<Invocation> invocations, MatchableInvocation wanted, int wantedCount) {27 List<Invocation> actualInvocations = findInvocations(invocations, wanted);28 int actualCount = actualInvocations.size();29 if (wantedCount > actualCount) {30 Location lastInvocation = getLastLocation(actualInvocations);31 throw tooLittleActualInvocations(new Discrepancy(wantedCount, actualCount), wanted, lastInvocation);32 }33 if (wantedCount == 0 && actualCount > 0) {34 Location firstUndesired = actualInvocations.get(wantedCount).getLocation();35 throw neverWantedButInvoked(wanted, firstUndesired);36 }37 if (wantedCount < actualCount) {38 Location firstUndesired = actualInvocations.get(wantedCount).getLocation();39 throw tooManyActualInvocations(wantedCount, actualCount, wanted, firstUndesired);40 }41 markVerified(actualInvocations, wanted);42 }43 public static void checkNumberOfInvocations(List<Invocation> invocations, MatchableInvocation wanted, int wantedCount, InOrderContext context) {44 List<Invocation> chunk = findMatchingChunk(invocations, wanted, wantedCount, context);45 int actualCount = chunk.size();46 if (wantedCount > actualCount) {47 Location lastInvocation = getLastLocation(chunk);48 throw tooLittleActualInvocationsInOrder(new Discrepancy(wantedCount, actualCount), wanted, lastInvocation);49 }50 if (wantedCount < actualCount) {51 Location firstUndesired = chunk.get(wantedCount).getLocation();52 throw tooManyActualInvocationsInOrder(wantedCount, actualCount, wanted, firstUndesired);53 }54 markVerifiedInOrder(chunk, wanted, context);55 }56 public static void checkNumberOfInvocationsNonGreedy(List<Invocation> invocations, MatchableInvocation wanted, int wantedCount, InOrderContext context) {57 int actualCount = 0;58 Location lastLocation = null;59 while( actualCount < wantedCount ){60 Invocation next = findFirstMatchingUnverifiedInvocation(invocations, wanted, context );61 if( next == null ){62 throw tooLittleActualInvocationsInOrder(new Discrepancy(wantedCount, actualCount), wanted, lastLocation );63 }64 markVerified( next, wanted );65 context.markVerified( next );66 lastLocation = next.getLocation();67 actualCount++;68 }69 }70}...
Source:TestBase.java
...10import org.mockito.internal.MockitoCore;11import org.mockito.internal.configuration.ConfigurationAccess;12import org.mockito.internal.invocation.mockref.MockStrongReference;13import org.mockito.internal.invocation.InterceptedInvocation;14import org.mockito.internal.debugging.LocationImpl;15import org.mockito.internal.invocation.InvocationBuilder;16import org.mockito.internal.invocation.InvocationMatcher;17import org.mockito.internal.invocation.SerializableMethod;18import org.mockito.invocation.Invocation;19import java.io.ByteArrayOutputStream;20import java.io.IOException;21import java.io.PrintStream;22import static org.mockito.Mockito.mock;23/**24 * the easiest way to make sure that tests clean up invalid state is to require25 * valid state for all tests.26 */27public class TestBase {28 @After29 public void cleanUpConfigInAnyCase() {30 ConfigurationAccess.getConfig().overrideCleansStackTrace(false);31 ConfigurationAccess.getConfig().overrideDefaultAnswer(null);32 StateMaster state = new StateMaster();33 //catch any invalid state left over after test case run34 //this way we can catch early if some Mockito operations leave weird state afterwards35 state.validate();36 //reset the state, especially, reset any ongoing stubbing for correct error messages of tests that assert unhappy paths37 state.reset();38 }39 @Before40 public void init() {41 MockitoAnnotations.initMocks(this);42 }43 public static void makeStackTracesClean() {44 ConfigurationAccess.getConfig().overrideCleansStackTrace(true);45 }46 public void resetState() {47 new StateMaster().reset();48 }49 public static Invocation getLastInvocation() {50 return new MockitoCore().getLastInvocation();51 }52 protected static Invocation invocationOf(Class<?> type, String methodName, Object ... args) throws NoSuchMethodException {53 Class<?>[] types = new Class<?>[args.length];54 for (int i = 0; i < args.length; i++) {55 types[i] = args[i].getClass();56 }57 return new InterceptedInvocation(new MockStrongReference<Object>(mock(type), false),58 new SerializableMethod(type.getMethod(methodName, types)), args, InterceptedInvocation.NO_OP,59 new LocationImpl(), 1);60 }61 protected static Invocation invocationAt(String location) {62 return new InvocationBuilder().location(location).toInvocation();63 }64 protected static InvocationMatcher invocationMatcherAt(String location) {65 return new InvocationBuilder().location(location).toInvocationMatcher();66 }67 protected String getStackTrace(Throwable e) {68 ByteArrayOutputStream out = new ByteArrayOutputStream();69 e.printStackTrace(new PrintStream(out));70 try {71 out.close();72 } catch (IOException ex) {}73 return out.toString();...
Source:ReturnsSmartNulls.java
...7import static org.mockito.internal.util.ObjectMethodsGuru.isToStringMethod;8import java.io.Serializable;9import java.lang.reflect.Modifier;10import org.mockito.Mockito;11import org.mockito.internal.debugging.LocationImpl;12import org.mockito.invocation.InvocationOnMock;13import org.mockito.invocation.Location;14import org.mockito.stubbing.Answer;15/**16 * Optional Answer that can be used with17 * {@link Mockito#mock(Class, Answer)}18 * <p>19 * This implementation can be helpful when working with legacy code. Unstubbed20 * methods often return null. If your code uses the object returned by an21 * unstubbed call you get a NullPointerException. This implementation of22 * Answer returns SmartNulls instead of nulls.23 * SmartNull gives nicer exception message than NPE because it points out the24 * line where unstubbed method was called. You just click on the stack trace.25 * <p>26 * ReturnsSmartNulls first tries to return ordinary return values (see27 * {@link ReturnsMoreEmptyValues}) then it tries to return SmartNull. If the28 * return type is not mockable (e.g. final) then ordinary null is returned.29 * <p>30 * ReturnsSmartNulls will be probably the default return values strategy in31 * Mockito 2.1.032 */33public class ReturnsSmartNulls implements Answer<Object>, Serializable {34 private static final long serialVersionUID = 7618312406617949441L;35 private final Answer<Object> delegate = new ReturnsMoreEmptyValues();36 public Object answer(final InvocationOnMock invocation) throws Throwable {37 Object defaultReturnValue = delegate.answer(invocation);38 if (defaultReturnValue != null) {39 return defaultReturnValue;40 }41 Class<?> type = invocation.getMethod().getReturnType();42 if (!type.isPrimitive() && !Modifier.isFinal(type.getModifiers())) {43 final Location location = new LocationImpl();44 return Mockito.mock(type, new ThrowsSmartNullPointer(invocation, location));45 }46 return null;47 }48 private static class ThrowsSmartNullPointer implements Answer {49 private final InvocationOnMock unstubbedInvocation;50 private final Location location;51 public ThrowsSmartNullPointer(InvocationOnMock unstubbedInvocation, Location location) {52 this.unstubbedInvocation = unstubbedInvocation;53 this.location = location;54 }55 public Object answer(InvocationOnMock currentInvocation) throws Throwable {56 if (isToStringMethod(currentInvocation.getMethod())) {57 return "SmartNull returned by this unstubbed method call on a mock:\n" +58 unstubbedInvocation.toString();59 }60 throw smartNullPointerException(unstubbedInvocation.toString(), location);61 }62 }63}...
Source:StubbingArgMismatchesTest.java
1/*2 * Copyright (c) 2017 Mockito contributors3 * This program is made available under the terms of the MIT License.4 */5package org.mockito.internal.junit;6import org.junit.Test;7import org.mockito.internal.invocation.InvocationBuilder;8import org.mockito.internal.util.SimpleMockitoLogger;9import org.mockito.invocation.Invocation;10import org.mockitoutil.TestBase;11import static org.junit.Assert.assertEquals;12import static org.junit.Assert.assertTrue;13public class StubbingArgMismatchesTest extends TestBase {14 SimpleMockitoLogger logger = new SimpleMockitoLogger();15 StubbingArgMismatches mismatches = new StubbingArgMismatches();16 @Test17 public void no_op_when_no_mismatches() throws Exception {18 //when19 mismatches.format("MyTest.myTestMethod", logger);20 //then21 assertTrue(logger.isEmpty());22 }23 @Test24 public void logs_mismatch() throws Exception {25 //given26 mismatches.add(27 new InvocationBuilder().args("a").location("-> at A.java").toInvocation(),28 new InvocationBuilder().args("b").location("-> at B.java").toInvocation());29 //when30 mismatches.format("MyTest.myTestMethod", logger);31 //then32 assertEquals(33 "[MockitoHint] MyTest.myTestMethod (see javadoc for MockitoHint):\n" +34 "[MockitoHint] 1. Unused... -> at B.java\n" +35 "[MockitoHint] ...args ok? -> at A.java\n", logger.getLoggedInfo());36 }37 @Test38 public void multiple_matching_invocations_per_stub_plus_some_other_invocation() throws Exception {39 //given40 Invocation stubbing = new InvocationBuilder().args("a").location("-> at A.java").toInvocation();41 mismatches.add(new InvocationBuilder().args("x").location("-> at X.java").toInvocation(), stubbing);42 mismatches.add(new InvocationBuilder().args("y").location("-> at Y.java").toInvocation(), stubbing);43 mismatches.add(44 new InvocationBuilder().method("differentMethod").args("n").location("-> at N.java").toInvocation(),45 new InvocationBuilder().method("differentMethod").args("m").location("-> at M.java").toInvocation());46 //when47 mismatches.format("MyTest.myTestMethod", logger);48 //then49 assertEquals(50 "[MockitoHint] MyTest.myTestMethod (see javadoc for MockitoHint):\n" +51 "[MockitoHint] 1. Unused... -> at A.java\n" +52 "[MockitoHint] ...args ok? -> at X.java\n" +53 "[MockitoHint] ...args ok? -> at Y.java\n" +54 "[MockitoHint] 2. Unused... -> at M.java\n" +55 "[MockitoHint] ...args ok? -> at N.java\n", logger.getLoggedInfo());56 }57}...
Source:DefaultInvocationFactory.java
...4 */5package org.mockito.internal.invocation;6import org.mockito.internal.creation.DelegatingMethod;7import org.mockito.internal.invocation.mockref.MockWeakReference;8import org.mockito.internal.debugging.LocationImpl;9import org.mockito.internal.progress.SequenceNumber;10import org.mockito.invocation.Invocation;11import org.mockito.invocation.InvocationFactory;12import org.mockito.invocation.Location;13import org.mockito.mock.MockCreationSettings;14import java.lang.reflect.Method;15import java.util.concurrent.Callable;16public class DefaultInvocationFactory implements InvocationFactory {17 public Invocation createInvocation(Object target, MockCreationSettings settings, Method method, final Callable realMethod, Object... args) {18 RealMethod superMethod = new RealMethod.FromCallable(realMethod);19 return createInvocation(target, settings, method, superMethod, args);20 }21 public Invocation createInvocation(Object target, MockCreationSettings settings, Method method, RealMethodBehavior realMethod, Object... args) {22 RealMethod superMethod = new RealMethod.FromBehavior(realMethod);23 return createInvocation(target, settings, method, superMethod, args);24 }25 private Invocation createInvocation(Object target, MockCreationSettings settings, Method method, RealMethod superMethod, Object[] args) {26 return createInvocation(target, method, args, superMethod, settings);27 }28 public static InterceptedInvocation createInvocation(Object mock, Method invokedMethod, Object[] arguments, RealMethod realMethod, MockCreationSettings settings, Location location) {29 return new InterceptedInvocation(30 new MockWeakReference<Object>(mock),31 createMockitoMethod(invokedMethod, settings),32 arguments,33 realMethod,34 location,35 SequenceNumber.next()36 );37 }38 private static InterceptedInvocation createInvocation(Object mock, Method invokedMethod, Object[]39 arguments, RealMethod realMethod, MockCreationSettings settings) {40 return createInvocation(mock, invokedMethod, arguments, realMethod, settings, new LocationImpl());41 }42 private static MockitoMethod createMockitoMethod(Method method, MockCreationSettings settings) {43 if (settings.isSerializable()) {44 return new SerializableMethod(method);45 } else {46 return new DelegatingMethod(method);47 }48 }49}...
Source:AtLeastXNumberOfInvocationsChecker.java
...5package org.mockito.internal.verification.checkers;6import java.util.List;7import org.mockito.internal.verification.api.InOrderContext;8import org.mockito.invocation.Invocation;9import org.mockito.invocation.Location;10import org.mockito.invocation.MatchableInvocation;11import static org.mockito.internal.exceptions.Reporter.tooLittleActualInvocations;12import static org.mockito.internal.exceptions.Reporter.tooLittleActualInvocationsInOrder;13import static org.mockito.internal.invocation.InvocationMarker.markVerified;14import static org.mockito.internal.invocation.InvocationMarker.markVerifiedInOrder;15import static org.mockito.internal.invocation.InvocationsFinder.findAllMatchingUnverifiedChunks;16import static org.mockito.internal.invocation.InvocationsFinder.findInvocations;17import static org.mockito.internal.invocation.InvocationsFinder.getLastLocation;18public class AtLeastXNumberOfInvocationsChecker {19 public static void checkAtLeastNumberOfInvocations(List<Invocation> invocations, MatchableInvocation wanted, int wantedCount) {20 List<Invocation> actualInvocations = findInvocations(invocations, wanted);21 int actualCount = actualInvocations.size();22 if (wantedCount > actualCount) {23 Location lastLocation = getLastLocation(actualInvocations);24 throw tooLittleActualInvocations(new AtLeastDiscrepancy(wantedCount, actualCount), wanted, lastLocation);25 }26 markVerified(actualInvocations, wanted);27 }28 public static void checkAtLeastNumberOfInvocations(List<Invocation> invocations, MatchableInvocation wanted, int wantedCount,InOrderContext orderingContext) {29 List<Invocation> chunk = findAllMatchingUnverifiedChunks(invocations, wanted, orderingContext);30 int actualCount = chunk.size();31 if (wantedCount > actualCount) {32 Location lastLocation = getLastLocation(chunk);33 throw tooLittleActualInvocationsInOrder(new AtLeastDiscrepancy(wantedCount, actualCount), wanted, lastLocation);34 }35 markVerifiedInOrder(chunk, wanted, orderingContext);36 }37}...
Location
Using AI Code Generation
1import org.mockito.invocation.Location;2import org.mockito.invocation.Invocation;3import org.mockito.invocation.InvocationOnMock;4import org.mockito.invocation.MockHandler;5import org.mockito.invocation.Invocation;6import org.mockito.invocation.InvocationOnMock;7import org.mockito.invocation.MockHandler;8import org.mockito.invocation.InvocationOnMock;9import org.mockito.invocation.MockHandler;10import org.mockito.invocation.MockHandler;11import org.mockito.Mockito;12import org.mockito.MockitoSession;13import org.mockito.MockingDetails;14import org.mockito.MockCreationSettings;15import org.mockito.MockName;16import org.mockito.MockUtil;17import org.mockito.verification.VerificationMode;18import org.mockito.verification.VerificationData;19import org.mockito.verification.VerificationStrategy;20import org.mockito.verification.VerificationDataInOrder;21import org.mockito.verification.VerificationInOrderMode;22import org.mockito.verification.VerificationInOrderMode;23import org.mockito.verification.VerificationModeFactory;24import org.mockito.verification.VerificationWithTimeout;25import org.mockito.verification.VerificationAfterDelay;26import org.mockito.verification.VerificationAfterDelay;27import org.mockito.verification.VerificationMode;
Location
Using AI Code Generation
1import org.mockito.invocation.Location;2import org.mockito.invocation.InvocationOnMock;3import org.mockito.stubbing.Answer;4import org.mockito.Mock;5import org.mockito.InjectMocks;6import org.mockito.MockitoAnnotations;7import org.mockito.runners.MockitoJUnitRunner;8import org.junit.runner.RunWith;9import org.junit.Test;10import org.junit.Before;11import static org.junit.Assert.assertEquals;12import static org.mockito.Mockito.*;13@RunWith(MockitoJUnitRunner.class)14public class 1 {15 private List mockedList;16 private ClassUnderTest classUnderTest;17 public void init() {18 MockitoAnnotations.initMocks(this);19 }20 public void test() {21 when(mockedList.get(0)).thenAnswer(new Answer() {22 public Object answer(InvocationOnMock invocation) {23 Object[] args = invocation.getArguments();24 Location location = invocation.getLocation();25 return "called with arguments: " + args;26 }27 });28 System.out.println(mockedList.get(0));29 }30}31import org.mockito.invocation.Location;32import org.mockito.invocation.InvocationOnMock;33import org.mockito.stubbing.Answer;34import org.mockito.Mock;35import org.mockito.InjectMocks;36import org.mockito.MockitoAnnotations;37import org.mockito.runners.MockitoJUnitRunner;38import org.junit.runner.RunWith;39import org.junit.Test;40import org.junit.Before;41import static org.junit.Assert.assertEquals;42import static org.mockito.Mockito.*;43@RunWith(MockitoJUnitRunner.class)44public class 2 {45 private List mockedList;46 private ClassUnderTest classUnderTest;47 public void init() {48 MockitoAnnotations.initMocks(this);49 }50 public void test() {51 when(mockedList.get(0)).thenAnswer(new Answer() {52 public Object answer(InvocationOnMock invocation) {53 Object[] args = invocation.getArguments();54 Location location = invocation.getLocation();55 return "called with arguments: " + args;56 }57 });58 System.out.println(mockedList.get(0));59 }60}61import org.mockito.inv
Location
Using AI Code Generation
1import org.mockito.invocation.Location;2class Test {3 void test() {4 Location location = new Location();5 location.getFileName();6 location.getLineNumber();7 location.getStackTrace();8 }9}10[ERROR] /home/akmo/GSoC/1.java:7:9: Unused import - org.mockito.invocation.Location. [UnusedImports]
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!