Best Easymock code snippet using org.easymock.tests.Util.Util
Source:PythonBinaryHostTestTest.java
...39import com.android.tradefed.result.TestDescription;40import com.android.tradefed.result.proto.TestRecordProto.FailureStatus;41import com.android.tradefed.util.CommandResult;42import com.android.tradefed.util.CommandStatus;43import com.android.tradefed.util.FileUtil;44import com.android.tradefed.util.IRunUtil;45import com.android.tradefed.util.StreamUtil;46import com.android.tradefed.util.IRunUtil.EnvPriority;47import com.google.common.io.CharStreams;48import org.easymock.Capture;49import org.easymock.EasyMock;50import org.easymock.IAnswer;51import org.easymock.IArgumentMatcher;52import org.junit.After;53import org.junit.Before;54import org.junit.Test;55import org.junit.runner.RunWith;56import org.junit.runners.JUnit4;57import java.io.ByteArrayInputStream;58import java.io.File;59import java.io.IOException;60import java.io.InputStream;61import java.io.InputStreamReader;62import java.io.OutputStream;63import java.util.HashMap;64/** Unit tests for {@link PythonBinaryHostTest}. */65@RunWith(JUnit4.class)66public final class PythonBinaryHostTestTest {67 private static final String PYTHON_OUTPUT_FILE_1 = "python_output1.txt";68 private PythonBinaryHostTest mTest;69 private IRunUtil mMockRunUtil;70 private IBuildInfo mMockBuildInfo;71 private ITestDevice mMockDevice;72 private TestInformation mTestInfo;73 private ITestInvocationListener mMockListener;74 private File mFakeAdb;75 private File mPythonBinary;76 private File mOutputFile;77 private File mModuleDir;78 @Before79 public void setUp() throws Exception {80 mFakeAdb = FileUtil.createTempFile("adb-python-tests", "");81 mMockRunUtil = EasyMock.createMock(IRunUtil.class);82 mMockBuildInfo = EasyMock.createMock(IBuildInfo.class);83 mMockListener = EasyMock.createMock(ITestInvocationListener.class);84 mMockDevice = EasyMock.createMock(ITestDevice.class);85 mTest =86 new PythonBinaryHostTest() {87 @Override88 IRunUtil getRunUtil() {89 return mMockRunUtil;90 }91 @Override92 String getAdbPath() {93 return mFakeAdb.getAbsolutePath();94 }95 };96 IInvocationContext context = new InvocationContext();97 context.addAllocatedDevice("device", mMockDevice);98 context.addDeviceBuildInfo("device", mMockBuildInfo);99 mTestInfo = TestInformation.newBuilder().setInvocationContext(context).build();100 EasyMock.expect(mMockDevice.getSerialNumber()).andStubReturn("SERIAL");101 mMockRunUtil.setEnvVariable(PythonBinaryHostTest.ANDROID_SERIAL_VAR, "SERIAL");102 mMockRunUtil.setWorkingDir(EasyMock.anyObject());103 mMockRunUtil.setEnvVariablePriority(EnvPriority.SET);104 mMockRunUtil.setEnvVariable(EasyMock.eq("PATH"), EasyMock.anyObject());105 mModuleDir = FileUtil.createTempDir("python-module");106 mPythonBinary = FileUtil.createTempFile("python-dir", "", mModuleDir);107 mTestInfo.executionFiles().put(FilesKey.HOST_TESTS_DIRECTORY, new File("/path-not-exist"));108 }109 @After110 public void tearDown() throws Exception {111 FileUtil.deleteFile(mFakeAdb);112 FileUtil.deleteFile(mPythonBinary);113 FileUtil.deleteFile(mOutputFile);114 FileUtil.recursiveDelete(mModuleDir);115 }116 /** Test that when running a python binary the output is parsed to obtain results. */117 @Test118 public void testRun() throws Exception {119 mMockListener = EasyMock.createNiceMock(ITestInvocationListener.class);120 mOutputFile = readInFile(PYTHON_OUTPUT_FILE_1);121 try {122 OptionSetter setter = new OptionSetter(mTest);123 setter.setOptionValue("python-binaries", mPythonBinary.getAbsolutePath());124 mMockRunUtil.setEnvVariable(EasyMock.eq("LD_LIBRARY_PATH"), EasyMock.anyObject());125 expectedAdbPath(mFakeAdb);126 CommandResult res = new CommandResult();127 res.setStatus(CommandStatus.SUCCESS);128 res.setStdout("python binary stdout.");129 res.setStderr(FileUtil.readStringFromFile(mOutputFile));130 EasyMock.expect(131 mMockRunUtil.runTimedCmd(132 EasyMock.anyLong(),133 EasyMock.isNull(),134 (OutputStream) EasyMock.anyObject(),135 EasyMock.eq(mPythonBinary.getAbsolutePath())))136 .andAnswer(137 new IAnswer<CommandResult>() {138 @Override139 public CommandResult answer() throws Throwable {140 OutputStream stream = (OutputStream) getCurrentArguments()[2];141 StreamUtil.copyFileToStream(mOutputFile, stream);142 return res;143 }144 });145 mMockListener.testRunStarted(146 EasyMock.eq(mPythonBinary.getName()),147 EasyMock.eq(11),148 EasyMock.eq(0),149 EasyMock.anyLong());150 mMockListener.testLog(151 EasyMock.eq(mPythonBinary.getName() + "-stdout"),152 EasyMock.eq(LogDataType.TEXT),153 EasyMock.anyObject());154 mMockListener.testLog(155 EasyMock.eq(mPythonBinary.getName() + "-stderr"),156 EasyMock.eq(LogDataType.TEXT),157 EasyMock.anyObject());158 EasyMock.expect(mMockDevice.getIDevice()).andReturn(new StubDevice("serial"));159 EasyMock.replay(mMockRunUtil, mMockBuildInfo, mMockListener, mMockDevice);160 mTest.run(mTestInfo, mMockListener);161 EasyMock.verify(mMockRunUtil, mMockBuildInfo, mMockListener, mMockDevice);162 } finally {163 FileUtil.deleteFile(mPythonBinary);164 }165 }166 /** Test that when running a non-unittest python binary with any filter, the test shall fail. */167 @Test168 public void testRun_failWithIncludeFilters() throws Exception {169 mOutputFile = readInFile(PYTHON_OUTPUT_FILE_1);170 mMockListener = EasyMock.createNiceMock(ITestInvocationListener.class);171 try {172 OptionSetter setter = new OptionSetter(mTest);173 setter.setOptionValue("python-binaries", mPythonBinary.getAbsolutePath());174 mTest.addIncludeFilter("test1");175 mMockRunUtil.setEnvVariable(EasyMock.eq("LD_LIBRARY_PATH"), EasyMock.anyObject());176 expectedAdbPath(mFakeAdb);177 CommandResult res = new CommandResult();178 res.setStatus(CommandStatus.SUCCESS);179 res.setStderr(FileUtil.readStringFromFile(mOutputFile));180 EasyMock.expect(181 mMockRunUtil.runTimedCmd(182 EasyMock.anyLong(),183 EasyMock.isNull(),184 (OutputStream) EasyMock.anyObject(),185 EasyMock.eq(mPythonBinary.getAbsolutePath())))186 .andAnswer(187 new IAnswer<CommandResult>() {188 @Override189 public CommandResult answer() throws Throwable {190 throw new RuntimeException("Parser error");191 }192 });193 mMockListener.testRunStarted(EasyMock.eq(mPythonBinary.getName()), EasyMock.eq(0));194 mMockListener.testRunFailed((FailureDescription) EasyMock.anyObject());195 mMockListener.testRunEnded(196 EasyMock.anyLong(), EasyMock.<HashMap<String, Metric>>anyObject());197 mMockListener.testLog(198 EasyMock.eq(mPythonBinary.getName() + "-stderr"),199 EasyMock.eq(LogDataType.TEXT),200 EasyMock.anyObject());201 EasyMock.expect(mMockDevice.getIDevice()).andReturn(new StubDevice("serial"));202 EasyMock.replay(mMockRunUtil, mMockBuildInfo, mMockListener, mMockDevice);203 mTest.run(mTestInfo, mMockListener);204 EasyMock.verify(mMockRunUtil, mMockBuildInfo, mMockListener, mMockDevice);205 } finally {206 FileUtil.deleteFile(mPythonBinary);207 }208 }209 /**210 * Test that when running a python binary with include filters, the output is parsed to obtain211 * results.212 */213 @Test214 public void testRun_withIncludeFilters() throws Exception {215 try {216 OptionSetter setter = new OptionSetter(mTest);217 setter.setOptionValue("python-binaries", mPythonBinary.getAbsolutePath());218 mTest.addIncludeFilter("__main__.Class1#test_1");219 mMockRunUtil.setEnvVariable(EasyMock.eq("LD_LIBRARY_PATH"), EasyMock.anyObject());220 expectedAdbPath(mFakeAdb);221 CommandResult res = new CommandResult();222 res.setStatus(CommandStatus.SUCCESS);223 String output =224 "test_1 (__main__.Class1)\n"225 + "run first test. ... ok\n"226 + "test_2 (__main__.Class1)\n"227 + "run second test. ... ok\n"228 + "test_3 (__main__.Class1)\n"229 + "run third test. ... ok\n"230 + "----------------------------------------------------------------------\n"231 + "Ran 3 tests in 1s\n";232 res.setStderr(output);233 EasyMock.expect(234 mMockRunUtil.runTimedCmd(235 EasyMock.anyLong(),236 EasyMock.isNull(),237 (OutputStream) EasyMock.anyObject(),238 EasyMock.eq(mPythonBinary.getAbsolutePath())))239 .andAnswer(240 new IAnswer<CommandResult>() {241 @Override242 public CommandResult answer() throws Throwable {243 OutputStream stream = (OutputStream) getCurrentArguments()[2];244 StreamUtil.copyStreams(245 new ByteArrayInputStream(output.getBytes()), stream);246 return res;247 }248 });249 // 3 tests are started and ended.250 for (int i = 0; i < 3; i++) {251 mMockListener.testStarted(252 EasyMock.<TestDescription>anyObject(), EasyMock.anyLong());253 mMockListener.testEnded(254 EasyMock.<TestDescription>anyObject(),255 EasyMock.anyLong(),256 EasyMock.<HashMap<String, Metric>>anyObject());257 }258 // 2 tests are ignored.259 mMockListener.testIgnored(EasyMock.<TestDescription>anyObject());260 mMockListener.testIgnored(EasyMock.<TestDescription>anyObject());261 mMockListener.testRunStarted(262 EasyMock.eq(mPythonBinary.getName()),263 EasyMock.eq(3),264 EasyMock.eq(0),265 EasyMock.anyLong());266 mMockListener.testRunEnded(267 EasyMock.anyLong(), EasyMock.<HashMap<String, Metric>>anyObject());268 mMockListener.testLog(269 EasyMock.eq(mPythonBinary.getName() + "-stderr"),270 EasyMock.eq(LogDataType.TEXT),271 EasyMock.anyObject());272 EasyMock.expect(mMockDevice.getIDevice()).andReturn(new StubDevice("serial"));273 EasyMock.replay(mMockRunUtil, mMockBuildInfo, mMockListener, mMockDevice);274 mTest.run(mTestInfo, mMockListener);275 EasyMock.verify(mMockRunUtil, mMockBuildInfo, mMockListener, mMockDevice);276 } finally {277 FileUtil.deleteFile(mPythonBinary);278 }279 }280 /**281 * Test that when running a python binary with exclude filters, the output is parsed to obtain282 * results.283 */284 @Test285 public void testRun_withExcludeFilters() throws Exception {286 try {287 OptionSetter setter = new OptionSetter(mTest);288 setter.setOptionValue("python-binaries", mPythonBinary.getAbsolutePath());289 mTest.addExcludeFilter("__main__.Class1#test_1");290 mMockRunUtil.setEnvVariable(EasyMock.eq("LD_LIBRARY_PATH"), EasyMock.anyObject());291 expectedAdbPath(mFakeAdb);292 CommandResult res = new CommandResult();293 res.setStatus(CommandStatus.SUCCESS);294 String output =295 "test_1 (__main__.Class1)\n"296 + "run first test. ... ok\n"297 + "test_2 (__main__.Class1)\n"298 + "run second test. ... ok\n"299 + "test_3 (__main__.Class1)\n"300 + "run third test. ... ok\n"301 + "----------------------------------------------------------------------\n"302 + "Ran 3 tests in 1s\n";303 res.setStderr(output);304 EasyMock.expect(305 mMockRunUtil.runTimedCmd(306 EasyMock.anyLong(),307 EasyMock.isNull(),308 (OutputStream) EasyMock.anyObject(),309 EasyMock.eq(mPythonBinary.getAbsolutePath())))310 .andAnswer(311 new IAnswer<CommandResult>() {312 @Override313 public CommandResult answer() throws Throwable {314 OutputStream stream = (OutputStream) getCurrentArguments()[2];315 StreamUtil.copyStreams(316 new ByteArrayInputStream(output.getBytes()), stream);317 return res;318 }319 });320 // 3 tests are started and ended.321 for (int i = 0; i < 3; i++) {322 mMockListener.testStarted(323 EasyMock.<TestDescription>anyObject(), EasyMock.anyLong());324 mMockListener.testEnded(325 EasyMock.<TestDescription>anyObject(),326 EasyMock.anyLong(),327 EasyMock.<HashMap<String, Metric>>anyObject());328 }329 // 1 test is ignored.330 mMockListener.testIgnored(EasyMock.<TestDescription>anyObject());331 mMockListener.testRunStarted(332 EasyMock.eq(mPythonBinary.getName()),333 EasyMock.eq(3),334 EasyMock.eq(0),335 EasyMock.anyLong());336 mMockListener.testRunEnded(337 EasyMock.anyLong(), EasyMock.<HashMap<String, Metric>>anyObject());338 mMockListener.testLog(339 EasyMock.eq(mPythonBinary.getName() + "-stderr"),340 EasyMock.eq(LogDataType.TEXT),341 EasyMock.anyObject());342 EasyMock.expect(mMockDevice.getIDevice()).andReturn(new StubDevice("serial"));343 EasyMock.replay(mMockRunUtil, mMockBuildInfo, mMockListener, mMockDevice);344 mTest.run(mTestInfo, mMockListener);345 EasyMock.verify(mMockRunUtil, mMockBuildInfo, mMockListener, mMockDevice);346 } finally {347 FileUtil.deleteFile(mPythonBinary);348 }349 }350 /**351 * Test running the python tests when an adb path has been set. In that case we ensure the352 * python script will use the provided adb.353 */354 @Test355 public void testRun_withAdbPath() throws Exception {356 mMockListener = EasyMock.createNiceMock(ITestInvocationListener.class);357 mOutputFile = readInFile(PYTHON_OUTPUT_FILE_1);358 mTestInfo.executionFiles().put(FilesKey.ADB_BINARY, new File("/test/adb"));359 try {360 OptionSetter setter = new OptionSetter(mTest);361 setter.setOptionValue("python-binaries", mPythonBinary.getAbsolutePath());362 mMockRunUtil.setEnvVariable(EasyMock.eq("LD_LIBRARY_PATH"), EasyMock.anyObject());363 expectedAdbPath(new File("/test/adb"));364 CommandResult res = new CommandResult();365 res.setStatus(CommandStatus.SUCCESS);366 res.setStderr(FileUtil.readStringFromFile(mOutputFile));367 EasyMock.expect(368 mMockRunUtil.runTimedCmd(369 EasyMock.anyLong(),370 EasyMock.isNull(),371 (OutputStream) EasyMock.anyObject(),372 EasyMock.eq(mPythonBinary.getAbsolutePath())))373 .andAnswer(374 new IAnswer<CommandResult>() {375 @Override376 public CommandResult answer() throws Throwable {377 OutputStream stream = (OutputStream) getCurrentArguments()[2];378 StreamUtil.copyFileToStream(mOutputFile, stream);379 return res;380 }381 });382 mMockListener.testRunStarted(383 EasyMock.eq(mPythonBinary.getName()),384 EasyMock.eq(11),385 EasyMock.eq(0),386 EasyMock.anyLong());387 mMockListener.testLog(388 EasyMock.eq(mPythonBinary.getName() + "-stderr"),389 EasyMock.eq(LogDataType.TEXT),390 EasyMock.anyObject());391 EasyMock.expect(mMockDevice.getIDevice()).andReturn(new StubDevice("serial"));392 EasyMock.replay(mMockRunUtil, mMockBuildInfo, mMockListener, mMockDevice);393 mTest.run(mTestInfo, mMockListener);394 EasyMock.verify(mMockRunUtil, mMockBuildInfo, mMockListener, mMockDevice);395 } finally {396 FileUtil.deleteFile(mPythonBinary);397 }398 }399 /** Test running the python tests when shared lib is available in HOST_TESTS_DIRECTORY. */400 @Test401 public void testRun_withSharedLibInHostTestsDir() throws Exception {402 mMockListener = EasyMock.createNiceMock(ITestInvocationListener.class);403 mOutputFile = readInFile(PYTHON_OUTPUT_FILE_1);404 File hostTestsDir = FileUtil.createTempDir("host-test-cases");405 mTestInfo.executionFiles().put(FilesKey.HOST_TESTS_DIRECTORY, hostTestsDir);406 File binary = FileUtil.createTempFile("python-dir", "", hostTestsDir);407 File lib = new File(hostTestsDir, "lib");408 lib.mkdirs();409 File lib64 = new File(hostTestsDir, "lib64");410 lib64.mkdirs();411 try {412 OptionSetter setter = new OptionSetter(mTest);413 setter.setOptionValue("python-binaries", binary.getAbsolutePath());414 mMockRunUtil.setEnvVariable(415 PythonBinaryHostTest.LD_LIBRARY_PATH,416 lib.getAbsolutePath()417 + ":"418 + lib64.getAbsolutePath()419 + ":"420 + hostTestsDir.getAbsolutePath());421 expectedAdbPath(mFakeAdb);422 CommandResult res = new CommandResult();423 res.setStatus(CommandStatus.SUCCESS);424 res.setStderr(FileUtil.readStringFromFile(mOutputFile));425 EasyMock.expect(426 mMockRunUtil.runTimedCmd(427 EasyMock.anyLong(),428 EasyMock.isNull(),429 (OutputStream) EasyMock.anyObject(),430 EasyMock.eq(binary.getAbsolutePath())))431 .andAnswer(432 new IAnswer<CommandResult>() {433 @Override434 public CommandResult answer() throws Throwable {435 OutputStream stream = (OutputStream) getCurrentArguments()[2];436 StreamUtil.copyFileToStream(mOutputFile, stream);437 return res;438 }439 });440 mMockListener.testRunStarted(441 EasyMock.eq(binary.getName()),442 EasyMock.eq(11),443 EasyMock.eq(0),444 EasyMock.anyLong());445 mMockListener.testLog(446 EasyMock.eq(binary.getName() + "-stderr"),447 EasyMock.eq(LogDataType.TEXT),448 EasyMock.anyObject());449 EasyMock.expect(mMockDevice.getIDevice()).andReturn(new StubDevice("serial"));450 EasyMock.replay(mMockRunUtil, mMockBuildInfo, mMockListener, mMockDevice);451 mTest.run(mTestInfo, mMockListener);452 EasyMock.verify(mMockRunUtil, mMockBuildInfo, mMockListener, mMockDevice);453 } finally {454 FileUtil.recursiveDelete(hostTestsDir);455 }456 }457 /** Test running the python tests when shared lib is available in TESTS_DIRECTORY. */458 @Test459 public void testRun_withSharedLib() throws Exception {460 mMockListener = EasyMock.createNiceMock(ITestInvocationListener.class);461 mOutputFile = readInFile(PYTHON_OUTPUT_FILE_1);462 File testsDir = FileUtil.createTempDir("host-test-cases");463 mTestInfo.executionFiles().put(FilesKey.TESTS_DIRECTORY, testsDir);464 File binary = FileUtil.createTempFile("python-dir", "", testsDir);465 File lib = new File(testsDir, "lib");466 lib.mkdirs();467 File lib64 = new File(testsDir, "lib64");468 lib64.mkdirs();469 try {470 OptionSetter setter = new OptionSetter(mTest);471 setter.setOptionValue("python-binaries", binary.getAbsolutePath());472 mMockRunUtil.setEnvVariable(473 PythonBinaryHostTest.LD_LIBRARY_PATH,474 lib.getAbsolutePath()475 + ":"476 + lib64.getAbsolutePath()477 + ":"478 + testsDir.getAbsolutePath());479 expectedAdbPath(mFakeAdb);480 CommandResult res = new CommandResult();481 res.setStatus(CommandStatus.SUCCESS);482 res.setStderr(FileUtil.readStringFromFile(mOutputFile));483 EasyMock.expect(484 mMockRunUtil.runTimedCmd(485 EasyMock.anyLong(),486 EasyMock.isNull(),487 (OutputStream) EasyMock.anyObject(),488 EasyMock.eq(binary.getAbsolutePath())))489 .andAnswer(490 new IAnswer<CommandResult>() {491 @Override492 public CommandResult answer() throws Throwable {493 OutputStream stream = (OutputStream) getCurrentArguments()[2];494 StreamUtil.copyFileToStream(mOutputFile, stream);495 return res;496 }497 });498 mMockListener.testRunStarted(499 EasyMock.eq(binary.getName()),500 EasyMock.eq(11),501 EasyMock.eq(0),502 EasyMock.anyLong());503 mMockListener.testLog(504 EasyMock.eq(binary.getName() + "-stderr"),505 EasyMock.eq(LogDataType.TEXT),506 EasyMock.anyObject());507 EasyMock.expect(mMockDevice.getIDevice()).andReturn(new StubDevice("serial"));508 EasyMock.replay(mMockRunUtil, mMockBuildInfo, mMockListener, mMockDevice);509 mTest.run(mTestInfo, mMockListener);510 EasyMock.verify(mMockRunUtil, mMockBuildInfo, mMockListener, mMockDevice);511 } finally {512 FileUtil.recursiveDelete(testsDir);513 }514 }515 /**516 * If the binary returns an exception status, we should throw a runtime exception since517 * something went wrong with the binary setup.518 */519 @Test520 public void testRunFail_exception() throws Exception {521 try {522 OptionSetter setter = new OptionSetter(mTest);523 setter.setOptionValue("python-binaries", mPythonBinary.getAbsolutePath());524 mMockRunUtil.setEnvVariable(EasyMock.eq("LD_LIBRARY_PATH"), EasyMock.anyObject());525 expectedAdbPath(mFakeAdb);526 CommandResult res = new CommandResult();527 res.setStatus(CommandStatus.EXCEPTION);528 res.setStderr("Could not execute.");529 String output = "Could not execute.";530 res.setStderr(output);531 EasyMock.expect(532 mMockRunUtil.runTimedCmd(533 EasyMock.anyLong(),534 EasyMock.isNull(),535 (OutputStream) EasyMock.anyObject(),536 EasyMock.eq(mPythonBinary.getAbsolutePath())))537 .andAnswer(538 new IAnswer<CommandResult>() {539 @Override540 public CommandResult answer() throws Throwable {541 OutputStream stream = (OutputStream) getCurrentArguments()[2];542 StreamUtil.copyStreams(543 new ByteArrayInputStream(output.getBytes()), stream);544 return res;545 }546 });547 EasyMock.expect(mMockDevice.getIDevice()).andReturn(new StubDevice("serial"));548 mMockListener.testLog(549 EasyMock.eq(mPythonBinary.getName() + "-stderr"),550 EasyMock.eq(LogDataType.TEXT),551 EasyMock.anyObject());552 // Report a failure if we cannot parse the logs553 mMockListener.testRunStarted(mPythonBinary.getName(), 0);554 FailureDescription failure =555 FailureDescription.create(556 "Failed to parse the python logs: Parser finished in unexpected "557 + "state TEST_CASE. Please ensure that verbosity of output "558 + "is high enough to be parsed.");559 failure.setFailureStatus(FailureStatus.TEST_FAILURE);560 mMockListener.testRunFailed(failure);561 mMockListener.testRunEnded(562 EasyMock.anyLong(), EasyMock.<HashMap<String, Metric>>anyObject());563 EasyMock.replay(mMockRunUtil, mMockBuildInfo, mMockListener, mMockDevice);564 mTest.run(mTestInfo, mMockListener);565 EasyMock.verify(mMockRunUtil, mMockBuildInfo, mMockListener, mMockDevice);566 } finally {567 FileUtil.deleteFile(mPythonBinary);568 }569 }570 /**571 * If the binary reports a FAILED status but the output actually have some tests, it most *572 * likely means that some tests failed. So we simply continue with parsing the results.573 */574 @Test575 public void testRunFail_failureOnly() throws Exception {576 mMockListener = EasyMock.createNiceMock(ITestInvocationListener.class);577 mOutputFile = readInFile(PYTHON_OUTPUT_FILE_1);578 try {579 OptionSetter setter = new OptionSetter(mTest);580 setter.setOptionValue("python-binaries", mPythonBinary.getAbsolutePath());581 mMockRunUtil.setEnvVariable(EasyMock.eq("LD_LIBRARY_PATH"), EasyMock.anyObject());582 expectedAdbPath(mFakeAdb);583 CommandResult res = new CommandResult();584 res.setStatus(CommandStatus.FAILED);585 res.setStderr(FileUtil.readStringFromFile(mOutputFile));586 EasyMock.expect(587 mMockRunUtil.runTimedCmd(588 EasyMock.anyLong(),589 EasyMock.isNull(),590 (OutputStream) EasyMock.anyObject(),591 EasyMock.eq(mPythonBinary.getAbsolutePath())))592 .andAnswer(593 new IAnswer<CommandResult>() {594 @Override595 public CommandResult answer() throws Throwable {596 OutputStream stream = (OutputStream) getCurrentArguments()[2];597 StreamUtil.copyFileToStream(mOutputFile, stream);598 return res;599 }600 });601 mMockListener.testRunStarted(602 EasyMock.eq(mPythonBinary.getName()),603 EasyMock.eq(11),604 EasyMock.eq(0),605 EasyMock.anyLong());606 mMockListener.testLog(607 EasyMock.eq(mPythonBinary.getName() + "-stderr"),608 EasyMock.eq(LogDataType.TEXT),609 EasyMock.anyObject());610 EasyMock.expect(mMockDevice.getIDevice()).andReturn(new StubDevice("serial"));611 EasyMock.replay(mMockRunUtil, mMockBuildInfo, mMockListener, mMockDevice);612 mTest.run(mTestInfo, mMockListener);613 EasyMock.verify(mMockRunUtil, mMockBuildInfo, mMockListener, mMockDevice);614 } finally {615 FileUtil.deleteFile(mPythonBinary);616 }617 }618 @Test619 public void testRun_useTestOutputFileOptionSet_parsesSubprocessOutputFile() throws Exception {620 mMockRunUtil.setEnvVariable(EasyMock.eq("LD_LIBRARY_PATH"), EasyMock.anyObject());621 mMockListener = EasyMock.createNiceMock(ITestInvocationListener.class);622 mOutputFile = readInFile(PYTHON_OUTPUT_FILE_1);623 newDefaultOptionSetter(mTest).setOptionValue(USE_TEST_OUTPUT_FILE_OPTION, "true");624 expectRunThatWritesTestOutputFile(625 newCommandResult(CommandStatus.SUCCESS, "NOT TEST OUTPUT"),626 FileUtil.readStringFromFile(mOutputFile));627 mMockListener.testRunStarted(anyObject(), eq(11), eq(0), anyLong());628 replayAllMocks();629 mTest.run(mTestInfo, mMockListener);630 EasyMock.verify(mMockListener);631 }632 @Test633 public void testRun_useTestOutputFileOptionSet_parsesUnitTestOutputFile() throws Exception {634 mMockRunUtil.setEnvVariable(EasyMock.eq("LD_LIBRARY_PATH"), EasyMock.anyObject());635 mMockListener = EasyMock.createNiceMock(ITestInvocationListener.class);636 newDefaultOptionSetter(mTest).setOptionValue(USE_TEST_OUTPUT_FILE_OPTION, "true");637 expectRunThatWritesTestOutputFile(638 newCommandResult(CommandStatus.SUCCESS, "NOT TEST OUTPUT"),639 "test_1 (__main__.Class1)\n"640 + "run first test. ... ok\n"641 + "test_2 (__main__.Class1)\n"642 + "run second test. ... ok\n"643 + "----------------------------------------------------------------------\n"644 + "Ran 2 tests in 1s");645 mMockListener.testRunStarted(anyObject(), eq(2), eq(0), anyLong());646 replayAllMocks();647 mTest.run(mTestInfo, mMockListener);648 EasyMock.verify(mMockListener);649 }650 @Test651 public void testRun_useTestOutputFileOptionSet_logsErrorOutput() throws Exception {652 mMockRunUtil.setEnvVariable(EasyMock.eq("LD_LIBRARY_PATH"), EasyMock.anyObject());653 mMockListener = EasyMock.createNiceMock(ITestInvocationListener.class);654 String errorOutput = "NOT TEST OUTPUT";655 newDefaultOptionSetter(mTest).setOptionValue(USE_TEST_OUTPUT_FILE_OPTION, "true");656 expectRunThatWritesTestOutputFile(657 newCommandResult(CommandStatus.SUCCESS, errorOutput),658 "TEST_RUN_STARTED {\"testCount\": 5, \"runName\": \"TestSuite\"}");659 mMockListener.testLog(660 anyObject(), eq(LogDataType.TEXT), inputStreamSourceContainsText(errorOutput));661 replayAllMocks();662 mTest.run(mTestInfo, mMockListener);663 EasyMock.verify(mMockListener);664 }665 @Test666 public void testRun_useTestOutputFileOptionSet_logsTestOutput() throws Exception {667 mMockRunUtil.setEnvVariable(EasyMock.eq("LD_LIBRARY_PATH"), EasyMock.anyObject());668 mMockListener = EasyMock.createNiceMock(ITestInvocationListener.class);669 String testOutput = "TEST_RUN_STARTED {\"testCount\": 5, \"runName\": \"TestSuite\"}";670 newDefaultOptionSetter(mTest).setOptionValue(USE_TEST_OUTPUT_FILE_OPTION, "true");671 expectRunThatWritesTestOutputFile(672 newCommandResult(CommandStatus.SUCCESS, "NOT TEST OUTPUT"), testOutput);673 mMockListener.testLog(674 EasyMock.eq(mPythonBinary.getName() + "-stderr"),675 EasyMock.eq(LogDataType.TEXT),676 EasyMock.anyObject());677 mMockListener.testLog(678 anyObject(), eq(LogDataType.TEXT), inputStreamSourceContainsText(testOutput));679 replayAllMocks();680 mTest.run(mTestInfo, mMockListener);681 EasyMock.verify(mMockListener);682 }683 @Test684 public void testRun_useTestOutputFileOptionSet_failureMessageContainsHints() throws Exception {685 mMockRunUtil.setEnvVariable(EasyMock.eq("LD_LIBRARY_PATH"), EasyMock.anyObject());686 mMockListener = EasyMock.createNiceMock(ITestInvocationListener.class);687 newDefaultOptionSetter(mTest).setOptionValue(USE_TEST_OUTPUT_FILE_OPTION, "true");688 expectRunThatWritesTestOutputFile(689 newCommandResult(CommandStatus.SUCCESS, "NOT TEST OUTPUT"), "BAD OUTPUT FORMAT");690 Capture<FailureDescription> description = new Capture<>();691 mMockListener.testRunFailed(capture(description));692 replayAllMocks();693 mTest.run(mTestInfo, mMockListener);694 String message = description.getValue().getErrorMessage();695 EasyMock.verify(mMockListener);696 assertThat(message).contains("--" + TEST_OUTPUT_FILE_FLAG);697 assertThat(message).contains("verbosity");698 }699 private OptionSetter newDefaultOptionSetter(PythonBinaryHostTest test) throws Exception {700 OptionSetter setter = new OptionSetter(test);701 setter.setOptionValue("python-binaries", mPythonBinary.getAbsolutePath());702 return setter;703 }704 private static CommandResult newCommandResult(CommandStatus status, String stderr) {705 CommandResult res = new CommandResult();706 res.setStatus(status);707 res.setStderr(stderr);708 return res;709 }710 private void expectRunThatWritesTestOutputFile(711 CommandResult result, String testOutputFileContents) {712 Capture<String> testOutputFilePath = new Capture<>();713 expect(714 mMockRunUtil.runTimedCmd(715 anyLong(),716 eq(mPythonBinary.getAbsolutePath()),717 eq("--test-output-file"),718 capture(testOutputFilePath)))719 .andStubAnswer(720 new IAnswer<CommandResult>() {721 @Override722 public CommandResult answer() {723 try {724 FileUtil.writeToFile(725 testOutputFileContents,726 new File(testOutputFilePath.getValue()));727 } catch (IOException ex) {728 throw new RuntimeException(ex);729 }730 return result;731 }732 });733 expect(mMockDevice.getIDevice()).andReturn(new StubDevice("serial"));734 expectedAdbPath(mFakeAdb);735 }736 private void replayAllMocks() {737 EasyMock.replay(mMockRunUtil, mMockBuildInfo, mMockListener, mMockDevice);738 }739 private void expectedAdbPath(File adbPath) {740 CommandResult pathRes = new CommandResult();741 pathRes.setStatus(CommandStatus.SUCCESS);742 pathRes.setStdout("bin/");743 EasyMock.expect(mMockRunUtil.runTimedCmd(60000L, "/bin/bash", "-c", "echo $PATH"))744 .andReturn(pathRes);745 mMockRunUtil.setEnvVariable("PATH", String.format("%s:bin/", adbPath.getParent()));746 CommandResult versionRes = new CommandResult();747 versionRes.setStatus(CommandStatus.SUCCESS);748 versionRes.setStdout("bin/");749 EasyMock.expect(mMockRunUtil.runTimedCmd(60000L, "adb", "version")).andReturn(versionRes);750 }751 private static InputStreamSource inputStreamSourceContainsText(String text) {752 EasyMock.reportMatcher(753 new IArgumentMatcher() {754 @Override755 public boolean matches(Object actual) {756 if (!(actual instanceof InputStreamSource)) {757 return false;758 }759 InputStream is = ((InputStreamSource) actual).createInputStream();760 String contents;761 try {762 contents =763 CharStreams.toString(764 new InputStreamReader(is)); // Assumes default charset.765 } catch (IOException ex) {766 throw new RuntimeException(ex);767 }768 return contents.contains(text);769 }770 @Override771 public void appendTo(StringBuffer buffer) {772 buffer.append("inputStreamSourceContainsText(\"");773 buffer.append(text);774 buffer.append("\")");775 }776 });777 return null;778 }779 private File readInFile(String filename) throws IOException {780 File output = FileUtil.createTempFile("python-host-test", ".txt");781 InputStream stream =782 getClass()783 .getResourceAsStream(784 File.separator + "testtype" + File.separator + filename);785 FileUtil.writeToFile(stream, output);786 return output;787 }788}...
Source:PythonUnitTestRunnerTest.java
...21import com.android.tradefed.result.ITestInvocationListener;22import com.android.tradefed.result.TestDescription;23import com.android.tradefed.util.CommandResult;24import com.android.tradefed.util.CommandStatus;25import com.android.tradefed.util.IRunUtil;26import org.easymock.EasyMock;27import org.junit.Before;28import org.junit.Test;29import org.junit.runner.RunWith;30import org.junit.runners.JUnit4;31import java.util.HashMap;32/** Unit tests for {@link PythonUnitTestRunner}. */33@RunWith(JUnit4.class)34public class PythonUnitTestRunnerTest {35 private static final String[] TEST_PASS_STDERR = {36 "b (a) ... ok", "", PythonUnitTestResultParser.DASH_LINE, "Ran 1 tests in 1s", "", "OK",37 };38 private static final String[] TEST_FAIL_STDERR = {39 "b (a) ... ERROR",40 "",41 PythonUnitTestResultParser.EQUAL_LINE,42 "ERROR: b (a)",43 PythonUnitTestResultParser.DASH_LINE,44 "Traceback (most recent call last):",45 " File \"test_rangelib.py\", line 129, in test_reallyfail",46 " raise ValueError()",47 "ValueError",48 "",49 PythonUnitTestResultParser.DASH_LINE,50 "Ran 1 tests in 1s",51 "",52 "FAILED (errors=1)",53 };54 private static final String[] TEST_EXECUTION_FAIL_STDERR = {55 "Traceback (most recent call last):",56 " File \"/usr/lib/python2.7/runpy.py\", line 162, in _run_module_as_main",57 " \"__main__\", fname, loader, pkg_name)",58 " File \"/usr/lib/python2.7/runpy.py\", line 72, in _run_code",59 " exec code in run_globals",60 " File \"/usr/lib/python2.7/unittest/__main__.py\", line 12, in <module>",61 " main(module=None)",62 " File \"/usr/lib/python2.7/unittest/main.py\", line 94, in __init__",63 " self.parseArgs(argv)",64 " File \"/usr/lib/python2.7/unittest/main.py\", line 149, in parseArgs",65 " self.createTests()",66 " File \"/usr/lib/python2.7/unittest/main.py\", line 158, in createTests",67 " self.module)",68 " File \"/usr/lib/python2.7/unittest/loader.py\", line 130, in loadTestsFromNames",69 " suites = [self.loadTestsFromName(name, module) for name in names]",70 " File \"/usr/lib/python2.7/unittest/loader.py\", line 91, in loadTestsFromName",71 " module = __import__('.'.join(parts_copy))",72 "ImportError: No module named stub",73 };74 private enum UnitTestResult {75 PASS,76 FAIL,77 EXECUTION_FAIL,78 TIMEOUT;79 private String getStderr() {80 switch (this) {81 case PASS:82 return String.join("\n", TEST_PASS_STDERR);83 case FAIL:84 return String.join("\n", TEST_FAIL_STDERR);85 case EXECUTION_FAIL:86 return String.join("\n", TEST_EXECUTION_FAIL_STDERR);87 case TIMEOUT:88 return null;89 }90 return null;91 }92 private CommandStatus getStatus() {93 switch (this) {94 case PASS:95 return CommandStatus.SUCCESS;96 case FAIL:97 return CommandStatus.FAILED;98 case EXECUTION_FAIL:99 // UnitTest runner returns with exit code 1 if execution failed.100 return CommandStatus.FAILED;101 case TIMEOUT:102 return CommandStatus.TIMED_OUT;103 }104 return null;105 }106 public CommandResult getCommandResult() {107 CommandResult cr = new CommandResult();108 cr.setStderr(this.getStderr());109 cr.setStatus(this.getStatus());110 return cr;111 }112 }113 private PythonUnitTestRunner mRunner;114 private ITestInvocationListener mMockListener;115 @Before116 public void setUp() throws Exception {117 mRunner = new PythonUnitTestRunner();118 mMockListener = EasyMock.createMock(ITestInvocationListener.class);119 }120 @Test121 public void testCheckPythonVersion_276given270min() {122 CommandResult c = new CommandResult();123 c.setStderr("Python 2.7.6");124 mRunner.checkPythonVersion(c);125 }126 @Test127 public void testCheckPythonVersion_276given331min() {128 CommandResult c = new CommandResult();129 c.setStderr("Python 2.7.6");130 mRunner.setMinPythonVersion("3.3.1");131 try {132 mRunner.checkPythonVersion(c);133 fail("Should have thrown an exception.");134 } catch (RuntimeException expected) {135 // expected136 }137 }138 @Test139 public void testCheckPythonVersion_300given276min() {140 CommandResult c = new CommandResult();141 c.setStderr("Python 3.0.0");142 mRunner.setMinPythonVersion("2.7.6");143 mRunner.checkPythonVersion(c);144 }145 private IRunUtil getMockRunUtil(UnitTestResult testResult) {146 CommandResult expectedResult = testResult.getCommandResult();147 IRunUtil mockRunUtil = EasyMock.createMock(IRunUtil.class);148 // EasyMock checks the number of arguments when verifying method call.149 // The actual runTimedCmd() expected here looks like:150 // runTimedCmd(300000, null, "-m", "unittest", "-v", "")151 EasyMock.expect(152 mockRunUtil.runTimedCmd(153 EasyMock.anyLong(),154 (String) EasyMock.anyObject(),155 (String) EasyMock.anyObject(),156 (String) EasyMock.anyObject(),157 (String) EasyMock.anyObject(),158 (String) EasyMock.anyObject()))159 .andReturn(expectedResult)160 .times(1);161 return mockRunUtil;162 }163 private void setMockListenerExpectTestPass(boolean testPass) {164 mMockListener.testRunStarted((String) EasyMock.anyObject(), EasyMock.anyInt());165 EasyMock.expectLastCall().times(1);166 mMockListener.testStarted((TestDescription) EasyMock.anyObject());167 EasyMock.expectLastCall().times(1);168 if (!testPass) {169 mMockListener.testFailed(170 (TestDescription) EasyMock.anyObject(), (String) EasyMock.anyObject());171 EasyMock.expectLastCall().times(1);172 }173 mMockListener.testEnded(174 (TestDescription) EasyMock.anyObject(),175 (HashMap<String, Metric>) EasyMock.anyObject());176 EasyMock.expectLastCall().times(1);177 if (!testPass) {178 mMockListener.testRunFailed((String) EasyMock.anyObject());179 EasyMock.expectLastCall().times(1);180 }181 mMockListener.testRunEnded(182 EasyMock.anyLong(), (HashMap<String, Metric>) EasyMock.anyObject());183 EasyMock.expectLastCall().times(1);184 }185 /** Test execution succeeds and all test cases pass. */186 @Test187 public void testRunPass() {188 IRunUtil mockRunUtil = getMockRunUtil(UnitTestResult.PASS);189 setMockListenerExpectTestPass(true);190 EasyMock.replay(mMockListener, mockRunUtil);191 mRunner.doRunTest(mMockListener, mockRunUtil, "");192 EasyMock.verify(mMockListener, mockRunUtil);193 }194 /** Test execution succeeds and some test cases fail. */195 @Test196 public void testRunFail() {197 IRunUtil mockRunUtil = getMockRunUtil(UnitTestResult.FAIL);198 setMockListenerExpectTestPass(false);199 EasyMock.replay(mMockListener, mockRunUtil);200 mRunner.doRunTest(mMockListener, mockRunUtil, "");201 EasyMock.verify(mMockListener, mockRunUtil);202 }203 /** Test execution fails. */204 @Test205 public void testRunExecutionFail() {206 IRunUtil mockRunUtil = getMockRunUtil(UnitTestResult.EXECUTION_FAIL);207 EasyMock.replay(mockRunUtil);208 try {209 mRunner.doRunTest(mMockListener, mockRunUtil, "");210 fail("Should not reach here.");211 } catch (RuntimeException e) {212 assertEquals("Failed to parse Python unittest result", e.getMessage());213 }214 EasyMock.verify(mockRunUtil);215 }216 /** Test execution times out. */217 @Test218 public void testRunTimeout() {219 IRunUtil mockRunUtil = getMockRunUtil(UnitTestResult.TIMEOUT);220 EasyMock.replay(mockRunUtil);221 try {222 mRunner.doRunTest(mMockListener, mockRunUtil, "");223 fail("Should not reach here.");224 } catch (RuntimeException e) {225 assertTrue(e.getMessage().startsWith("Python unit test timed out after"));226 }227 EasyMock.verify(mockRunUtil);228 }229}...
Util
Using AI Code Generation
1package org.easymock.tests;2import org.easymock.EasyMock;3import org.easymock.IArgumentMatcher;4import org.easymock.IMocksControl;5import org.easymock.internal.LastControl;6import junit.framework.TestCase;7public class EasyMockTest extends TestCase {8 public void test() {9 IMocksControl control = EasyMock.createControl();10 IInterface mock = (IInterface) control.createMock(IInterface.class);11 mock.method(Util.method("a", 1));12 control.replay();13 mock.method(new Object());14 control.verify();15 }16}17package org.easymock.tests;18import org.easymock.EasyMock;19import org.easymock.IArgumentMatcher;20import org.easymock.IMocksControl;21import org.easymock.internal.LastControl;22import junit.framework.TestCase;23public class EasyMockTest extends TestCase {24 public void test() {25 IMocksControl control = EasyMock.createControl();26 IInterface mock = (IInterface) control.createMock(IInterface.class);27 mock.method(Util.method("a", 1));28 control.replay();29 mock.method(new Object());30 control.verify();31 }32}33package org.easymock.tests;34import org.easymock.EasyMock;35import org.easymock.IArgumentMatcher;36import org.easymock.IMocksControl;37import org.easymock.internal.LastControl;38import junit.framework.TestCase;39public class EasyMockTest extends TestCase {40 public void test() {41 IMocksControl control = EasyMock.createControl();42 IInterface mock = (IInterface) control.createMock(IInterface.class);43 mock.method(Util.method("a", 1));44 control.replay();45 mock.method(new Object());46 control.verify();47 }48}49package org.easymock.tests;50import org.easymock.EasyMock;51import org.easymock.IArgumentMatcher;52import org.easymock.IMocksControl;53import org.easymock.internal.LastControl;54import junit.framework.TestCase;
Util
Using AI Code Generation
1import org.easymock.tests.Util;2public class 1 {3 public static void main(String[] args) {4 Util util = new Util();5 util.foo();6 }7}8package org.easymock.tests;9public class Util {10 public void foo() {11 System.out.println("foo");12 }13}14[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-test) on project mockito-demo: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test failed: Unable to load the mojo 'test' in the plugin 'org.apache.maven.plugins:maven-surefire-plugin:2.10' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/apache/maven/plugin/MojoExecutionException : Unsupported major.minor version 51.015EasyMock.createMock(Util.class);
Util
Using AI Code Generation
1import org.easymock.tests.Util;2public class 1 {3 public static void main(String[] args) {4 Util util = new Util();5 util.print("Hello World");6 }7}8import org.easymock.tests.Util;9public class 2 {10 public static void main(String[] args) {11 Util util = new Util();12 util.print("Hello World");13 }14}15import org.easymock.tests.Util;16public class 3 {17 public static void main(String[] args) {18 Util util = new Util();19 util.print("Hello World");20 }21}22import org.easymock.tests.Util;23public class 4 {24 public static void main(String[] args) {25 Util util = new Util();26 util.print("Hello World");27 }28}29import org.easymock.tests.Util;30public class 5 {31 public static void main(String[] args) {32 Util util = new Util();33 util.print("Hello World");34 }35}36import org.easymock.tests.Util;37public class 6 {38 public static void main(String[] args) {39 Util util = new Util();40 util.print("Hello World");41 }42}43import org.easymock.tests.Util;44public class 7 {45 public static void main(String[] args) {46 Util util = new Util();47 util.print("Hello World");48 }49}50import org.easymock.tests.Util;51public class 8 {52 public static void main(String[] args) {53 Util util = new Util();54 util.print("Hello World");55 }56}
Util
Using AI Code Generation
1public class 1 {2 public void method() {3 Util.method();4 }5}6package org.easymock.tests;7public class Util {8 public static void method() {9 }10}
Util
Using AI Code Generation
1package org.easymock.tests;2public class 1 {3 public void test() {4 Util u = new Util();5 u.method1();6 u.method2();7 }8}9package org.easymock.tests;10public class Util {11 public void method1() {12 System.out.println("method1");13 }14 public void method2() {15 System.out.println("method2");16 }17}
Util
Using AI Code Generation
1package org.easymock.tests;2import org.easymock.tests.Util;3public class 1 {4 public void test() {5 Util u = new Util();6 u.getUtilMethod();7 }8}9package org.easymock;10import org.easymock.Util;11public class 2 {12 public void test() {13 Util u = new Util();14 u.getUtilMethod();15 }16}
Util
Using AI Code Generation
1import org.easymock.tests.Util;2public class UtilTest {3 public static void main(String[] args) {4 Util util = new Util();5 System.out.println(util.getHelloMessage());6 }7}8import org.easymock.tests.Util;9public class UtilTest {10 public static void main(String[] args) {11 Util util = new Util();12 System.out.println(util.getHelloMessage());13 }14}15import org.easymock.tests.Util;16public class UtilTest {17 public static void main(String[] args) {18 Util util = new Util();19 System.out.println(util.getHelloMessage());20 }21}22import org.easymock.tests.Util;23public class UtilTest {24 public static void main(String[] args) {25 Util util = new Util();26 System.out.println(util.getHelloMessage());27 }28}29import org.easymock.tests.Util;30public class UtilTest {31 public static void main(String[] args) {32 Util util = new Util();33 System.out.println(util.getHelloMessage());34 }35}36import org.easymock.tests.Util;37public class UtilTest {38 public static void main(String[] args) {39 Util util = new Util();40 System.out.println(util.getHelloMessage());41 }42}43import org.easymock.tests.Util;44public class UtilTest {45 public static void main(String[] args) {46 Util util = new Util();47 System.out.println(util.getHelloMessage());48 }49}50import org.easymock.tests.Util;51public class UtilTest {52 public static void main(String[] args) {53 Util util = new Util();54 System.out.println(util
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!!