Best Easymock code snippet using org.easymock.tests.Util.getName
Source:PythonBinaryHostTestTest.java
...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(...
Source:RustBinaryHostTestTest.java
...123 }124 /** Add mocked testRunStarted call to the listener. */125 private void mockListenerStarted(File binary, int count) throws Exception {126 mMockListener.testRunStarted(127 EasyMock.eq(binary.getName()),128 EasyMock.eq(count),129 EasyMock.anyInt(),130 EasyMock.anyLong());131 }132 /** Add mocked call to check listener log file. */133 private void mockListenerLog(File binary, boolean error) {134 if (error) {135 mMockListener.testLog(136 EasyMock.eq(binary.getName() + "-stderr"),137 EasyMock.eq(LogDataType.TEXT),138 EasyMock.anyObject());139 }140 mMockListener.testLog(141 EasyMock.eq(binary.getName() + "-stdout"),142 EasyMock.eq(LogDataType.TEXT),143 EasyMock.anyObject());144 }145 private void mockTestRunExpect(File binary, CommandResult res) throws Exception {146 EasyMock.expect(147 mMockRunUtil.runTimedCmd(148 EasyMock.anyLong(), EasyMock.eq(binary.getAbsolutePath())))149 .andReturn(res);150 }151 private void mockBenchmarkRunExpect(File binary, String output) throws Exception {152 CommandResult res = newCommandResult(CommandStatus.SUCCESS, "", "");153 EasyMock.expect(154 mMockRunUtil.runTimedCmd(155 EasyMock.anyLong(),156 EasyMock.eq(binary.getAbsolutePath()),157 EasyMock.eq("--bench"),158 EasyMock.eq("--color"),159 EasyMock.eq("never")))160 .andReturn(successResult("", output));161 }162 /** Add mocked call to testRunEnded. */163 private void mockTestRunEnded() {164 mMockListener.testRunEnded(165 EasyMock.anyLong(), EasyMock.<HashMap<String, Metric>>anyObject());166 }167 /** Call replay/run/verify. */168 private void callReplayRunVerify() throws Exception {169 EasyMock.replay(mMockRunUtil, mMockBuildInfo, mMockListener);170 mTest.run(mTestInfo, mMockListener);171 EasyMock.verify(mMockRunUtil, mMockBuildInfo, mMockListener);172 }173 /** Test that when running a rust binary the output is parsed to obtain results. */174 @Test175 public void testRun() throws Exception {176 File binary = FileUtil.createTempFile("rust-dir", "");177 try {178 OptionSetter setter = new OptionSetter(mTest);179 setter.setOptionValue("test-file", binary.getAbsolutePath());180 mockCountTests(binary, 9);181 mockListenerStarted(binary, 9);182 mockListenerLog(binary, false);183 CommandResult res = successResult("", resultCount(6, 1, 2));184 mockTestRunExpect(binary, res);185 mMockListener.testRunFailed("Test run incomplete. Started 2 tests, finished 0");186 mockTestRunEnded();187 callReplayRunVerify();188 } finally {189 FileUtil.deleteFile(binary);190 }191 }192 /**193 * Test running the rust tests when an adb path has been set. In that case we ensure the rust194 * test will use the provided adb.195 */196 @Test197 public void testRun_withAdbPath() throws Exception {198 mMockBuildInfo = EasyMock.createMock(IBuildInfo.class);199 mTest.setBuild(mMockBuildInfo);200 File binary = FileUtil.createTempFile("rust-dir", "");201 try {202 OptionSetter setter = new OptionSetter(mTest);203 setter.setOptionValue("test-file", binary.getAbsolutePath());204 mockCountTests(binary, 9);205 mockListenerStarted(binary, 9);206 mockListenerLog(binary, false);207 CommandResult res = successResult("", resultCount(6, 1, 2));208 mockTestRunExpect(binary, res);209 mMockListener.testRunFailed("Test run incomplete. Started 2 tests, finished 0");210 mockTestRunEnded();211 callReplayRunVerify();212 } finally {213 FileUtil.deleteFile(binary);214 }215 }216 /** If the binary returns an exception status, it is treated as a failed test. */217 @Test218 public void testRunFail_exception() throws Exception {219 File binary = FileUtil.createTempFile("rust-dir", "");220 try {221 OptionSetter setter = new OptionSetter(mTest);222 setter.setOptionValue("test-file", binary.getAbsolutePath());223 mockCountTests(binary, 2);224 mockListenerStarted(binary, 2);225 mockListenerLog(binary, true);226 CommandResult res =227 newCommandResult(228 CommandStatus.EXCEPTION, "Err.", "running 2 tests\nException.");229 mockTestRunExpect(binary, res);230 mMockListener.testRunFailed("Test run incomplete. Started 2 tests, finished 0");231 mMockListener.testRunFailed((FailureDescription) EasyMock.anyObject());232 mockTestRunEnded();233 callReplayRunVerify();234 } finally {235 FileUtil.deleteFile(binary);236 }237 }238 /**239 * If the binary reports a FAILED status when trying to count tests, it is treated as a failed240 * test.241 */242 @Test243 public void testRunFail_list() throws Exception {244 File binary = FileUtil.createTempFile("rust-dir", "");245 try {246 OptionSetter setter = new OptionSetter(mTest);247 setter.setOptionValue("test-file", binary.getAbsolutePath());248 CommandResult listRes = newCommandResult(CommandStatus.FAILED, "", "");249 EasyMock.expect(250 mMockRunUtil.runTimedCmdSilently(251 EasyMock.anyLong(),252 EasyMock.eq(binary.getAbsolutePath()),253 EasyMock.eq("--list")))254 .andReturn(listRes);255 mMockListener.testRunStarted(binary.getName(), 0);256 mMockListener.testRunFailed((FailureDescription) EasyMock.anyObject());257 mockTestRunEnded();258 callReplayRunVerify();259 } finally {260 FileUtil.deleteFile(binary);261 }262 }263 /** If the binary reports a FAILED status, it is treated as a failed test. */264 @Test265 public void testRunFail_failureOnly() throws Exception {266 File binary = FileUtil.createTempFile("rust-dir", "");267 try {268 OptionSetter setter = new OptionSetter(mTest);269 setter.setOptionValue("test-file", binary.getAbsolutePath());270 mockCountTests(binary, 9);271 mockListenerStarted(binary, 9);272 mockListenerLog(binary, false);273 CommandResult res = newCommandResult(CommandStatus.FAILED, "", resultCount(6, 1, 2));274 mockTestRunExpect(binary, res);275 mMockListener.testRunFailed("Test run incomplete. Started 2 tests, finished 0");276 mMockListener.testRunFailed((FailureDescription) EasyMock.anyObject());277 mockTestRunEnded();278 callReplayRunVerify();279 } finally {280 FileUtil.deleteFile(binary);281 }282 }283 /** Test the exclude filtering of test methods. */284 @Test285 public void testExcludeFilter() throws Exception {286 File binary = FileUtil.createTempFile("rust-dir", "");287 try {288 OptionSetter setter = new OptionSetter(mTest);289 setter.setOptionValue("test-file", binary.getAbsolutePath());290 setter.setOptionValue("exclude-filter", "NotMe");291 setter.setOptionValue("exclude-filter", "Long");292 EasyMock.expect(293 mMockRunUtil.runTimedCmdSilently(294 EasyMock.anyLong(),295 EasyMock.eq(binary.getAbsolutePath()),296 EasyMock.eq("--skip"),297 EasyMock.eq("NotMe"),298 EasyMock.eq("--skip"),299 EasyMock.eq("Long"),300 EasyMock.eq("--list")))301 .andReturn(successResult("", runListOutput(9)));302 mockListenerStarted(binary, 9);303 mockListenerLog(binary, false);304 CommandResult res = successResult("", resultCount(6, 1, 2));305 EasyMock.expect(306 mMockRunUtil.runTimedCmd(307 EasyMock.anyLong(),308 EasyMock.eq(binary.getAbsolutePath()),309 EasyMock.eq("--skip"),310 EasyMock.eq("NotMe"),311 EasyMock.eq("--skip"),312 EasyMock.eq("Long")))313 .andReturn(res);314 mMockListener.testRunFailed("Test run incomplete. Started 2 tests, finished 0");315 mockTestRunEnded();316 callReplayRunVerify();317 } finally {318 FileUtil.deleteFile(binary);319 }320 }321 /** Test both include and exclude filters. */322 @Test323 public void testIncludeExcludeFilter() throws Exception {324 File binary = FileUtil.createTempFile("rust-dir", "");325 try {326 OptionSetter setter = new OptionSetter(mTest);327 setter.setOptionValue("test-file", binary.getAbsolutePath());328 setter.setOptionValue("exclude-filter", "MyTest#NotMe");329 setter.setOptionValue("include-filter", "MyTest#OnlyMe");330 setter.setOptionValue("exclude-filter", "Other");331 // We always pass the include-filter before exclude-filter strings.332 EasyMock.expect(333 mMockRunUtil.runTimedCmdSilently(334 EasyMock.anyLong(),335 EasyMock.eq(binary.getAbsolutePath()),336 EasyMock.eq("OnlyMe"),337 EasyMock.eq("--skip"),338 EasyMock.eq("NotMe"),339 EasyMock.eq("--skip"),340 EasyMock.eq("Other"),341 EasyMock.eq("--list")))342 .andReturn(successResult("", runListOutput(3)));343 mockListenerStarted(binary, 3);344 mockListenerLog(binary, false);345 CommandResult res = successResult("", resultCount(3, 0, 0));346 EasyMock.expect(347 mMockRunUtil.runTimedCmd(348 EasyMock.anyLong(),349 EasyMock.eq(binary.getAbsolutePath()),350 EasyMock.eq("OnlyMe"),351 EasyMock.eq("--skip"),352 EasyMock.eq("NotMe"),353 EasyMock.eq("--skip"),354 EasyMock.eq("Other")))355 .andReturn(res);356 mMockListener.testRunFailed("Test run incomplete. Started 2 tests, finished 0");357 mockTestRunEnded();358 callReplayRunVerify();359 } finally {360 FileUtil.deleteFile(binary);361 }362 }363 /** Test multiple include and exclude filters. */364 @Test365 public void testMultipleIncludeExcludeFilter() throws Exception {366 File binary = FileUtil.createTempFile("rust-dir", "");367 try {368 OptionSetter setter = new OptionSetter(mTest);369 setter.setOptionValue("test-file", binary.getAbsolutePath());370 setter.setOptionValue("exclude-filter", "NotMe");371 setter.setOptionValue("include-filter", "MyTest#OnlyMe");372 setter.setOptionValue("exclude-filter", "MyTest#Other");373 setter.setOptionValue("include-filter", "Me2");374 // Multiple include filters are run one by one with --list.375 String[] selection1 = new String[] {"test1", "test2"};376 EasyMock.expect(377 mMockRunUtil.runTimedCmdSilently(378 EasyMock.anyLong(),379 EasyMock.eq(binary.getAbsolutePath()),380 EasyMock.eq("OnlyMe"),381 EasyMock.eq("--skip"),382 EasyMock.eq("NotMe"),383 EasyMock.eq("--skip"),384 EasyMock.eq("Other"),385 EasyMock.eq("--list")))386 .andReturn(successResult("", runListOutput(selection1)));387 String[] selection2 = new String[] {"test2", "test3", "test4"};388 EasyMock.expect(389 mMockRunUtil.runTimedCmdSilently(390 EasyMock.anyLong(),391 EasyMock.eq(binary.getAbsolutePath()),392 EasyMock.eq("Me2"),393 EasyMock.eq("--skip"),394 EasyMock.eq("NotMe"),395 EasyMock.eq("--skip"),396 EasyMock.eq("Other"),397 EasyMock.eq("--list")))398 .andReturn(successResult("", runListOutput(selection2)));399 // Union of selection1 and selection2 has 4 tests.400 mockListenerStarted(binary, 4);401 // Multiple include filters are run one by one.402 mockListenerLog(binary, false);403 CommandResult res = successResult("", resultCount(2, 0, 0));404 EasyMock.expect(405 mMockRunUtil.runTimedCmd(406 EasyMock.anyLong(),407 EasyMock.eq(binary.getAbsolutePath()),408 EasyMock.eq("OnlyMe"),409 EasyMock.eq("--skip"),410 EasyMock.eq("NotMe"),411 EasyMock.eq("--skip"),412 EasyMock.eq("Other")))413 .andReturn(res);414 mMockListener.testRunFailed("Test run incomplete. Started 2 tests, finished 0");415 mockListenerLog(binary, false);416 res = successResult("", resultCount(3, 0, 0));417 EasyMock.expect(418 mMockRunUtil.runTimedCmd(419 EasyMock.anyLong(),420 EasyMock.eq(binary.getAbsolutePath()),421 EasyMock.eq("Me2"),422 EasyMock.eq("--skip"),423 EasyMock.eq("NotMe"),424 EasyMock.eq("--skip"),425 EasyMock.eq("Other")))426 .andReturn(res);427 mMockListener.testRunFailed("Test run incomplete. Started 2 tests, finished 0");428 mockTestRunEnded();429 callReplayRunVerify();430 } finally {431 FileUtil.deleteFile(binary);432 }433 }434 /** Test benchmark run */435 @Test436 public void testRun_benchmark() throws Exception {437 File binary = FileUtil.createTempFile("rust-dir", "");438 try {439 OptionSetter setter = new OptionSetter(mTest);440 setter.setOptionValue("test-file", binary.getAbsolutePath());441 setter.setOptionValue("is-benchmark", "true");442 mockCountBenchmarks(binary, 2);443 mockListenerStarted(binary, 2);444 mockListenerLog(binary, false);445 mockBenchmarkRunExpect(446 binary,447 "Benchmarking test1\n"448 + "test time: [0.1 ms 0.1 ms 0.1 ms]\n"449 + "Benchmarking test2\n"450 + "test time: [0.1 ms 0.1 ms 0.1 ms]\n");451 TestDescription desc1 = new TestDescription(binary.getName(), "test1");452 TestDescription desc2 = new TestDescription(binary.getName(), "test2");453 mMockListener.testStarted(desc1);454 mMockListener.testEnded(455 EasyMock.eq(desc1), EasyMock.<HashMap<String, Metric>>anyObject());456 mMockListener.testStarted(desc2);457 mMockListener.testEnded(458 EasyMock.eq(desc2), EasyMock.<HashMap<String, Metric>>anyObject());459 mockTestRunEnded();460 callReplayRunVerify();461 } finally {462 FileUtil.deleteFile(binary);463 }464 }465 @Test466 public void testRun_benchmarkDoubleStart() throws Exception {467 File binary = FileUtil.createTempFile("rust-dir", "");468 try {469 OptionSetter setter = new OptionSetter(mTest);470 setter.setOptionValue("test-file", binary.getAbsolutePath());471 setter.setOptionValue("is-benchmark", "true");472 mockCountBenchmarks(binary, 2);473 mockListenerStarted(binary, 2);474 mockListenerLog(binary, false);475 mockBenchmarkRunExpect(476 binary,477 "Benchmarking test1\n"478 + "Benchmarking test2\n"479 + "test time: [0.1 ms 0.1 ms 0.1 ms]\n");480 TestDescription desc1 = new TestDescription(binary.getName(), "test1");481 TestDescription desc2 = new TestDescription(binary.getName(), "test2");482 mMockListener.testStarted(desc1);483 mMockListener.testFailed(EasyMock.eq(desc1), EasyMock.<String>anyObject());484 mMockListener.testEnded(485 EasyMock.eq(desc1), EasyMock.<HashMap<String, Metric>>anyObject());486 mMockListener.testStarted(desc2);487 mMockListener.testEnded(488 EasyMock.eq(desc2), EasyMock.<HashMap<String, Metric>>anyObject());489 mockTestRunEnded();490 callReplayRunVerify();491 } finally {492 FileUtil.deleteFile(binary);493 }494 }495 @Test496 public void testRun_benchmarkNotFinished() throws Exception {497 File binary = FileUtil.createTempFile("rust-dir", "");498 try {499 OptionSetter setter = new OptionSetter(mTest);500 setter.setOptionValue("test-file", binary.getAbsolutePath());501 setter.setOptionValue("is-benchmark", "true");502 mockCountBenchmarks(binary, 2);503 mockListenerStarted(binary, 2);504 mockListenerLog(binary, false);505 mockBenchmarkRunExpect(506 binary,507 "Benchmarking test1\n"508 + "test time: [0.1 ms 0.1 ms 0.1 ms]\n"509 + "Benchmarking test2\n");510 TestDescription desc1 = new TestDescription(binary.getName(), "test1");511 TestDescription desc2 = new TestDescription(binary.getName(), "test2");512 mMockListener.testStarted(desc1);513 mMockListener.testEnded(514 EasyMock.eq(desc1), EasyMock.<HashMap<String, Metric>>anyObject());515 mMockListener.testStarted(desc2);516 mMockListener.testFailed(EasyMock.eq(desc2), EasyMock.<String>anyObject());517 mMockListener.testEnded(518 EasyMock.eq(desc2), EasyMock.<HashMap<String, Metric>>anyObject());519 mMockListener.testRunFailed(EasyMock.<String>anyObject());520 mockTestRunEnded();521 callReplayRunVerify();522 } finally {523 FileUtil.deleteFile(binary);524 }525 }...
getName
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 System.out.println(util.getName());6 }7}8import org.easymock.tests.Util;9public class 2 {10 public static void main(String[] args) {11 Util util = new Util();12 System.out.println(util.getName());13 }14}15import org.easymock.tests.Util;16public class 3 {17 public static void main(String[] args) {18 Util util = new Util();19 System.out.println(util.getName());20 }21}22import org.easymock.tests.Util;23public class 4 {24 public static void main(String[] args) {25 Util util = new Util();26 System.out.println(util.getName());27 }28}29import org.easymock.tests.Util;30public class 5 {31 public static void main(String[] args) {32 Util util = new Util();33 System.out.println(util.getName());34 }35}36import org.easymock.tests.Util;37public class 6 {38 public static void main(String[] args) {39 Util util = new Util();40 System.out.println(util.getName());41 }42}43import org.easymock.tests.Util;44public class 7 {45 public static void main(String[] args) {46 Util util = new Util();47 System.out.println(util.getName());48 }49}50import org.easymock.tests.Util;51public class 8 {52 public static void main(String[] args) {53 Util util = new Util();54 System.out.println(util.getName());55 }56}
getName
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 String name = util.getName();6 System.out.println(name);7 }8}
getName
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 String name = util.getName();6 System.out.println("name: " + name);7 }8}9import org.easymock.tests.Util;10public class 2 {11 public static void main(String[] args) {12 Util util = new Util();13 String name = util.getName();14 System.out.println("name: " + name);15 }16}17import org.easymock.tests.Util;18public class 3 {19 public static void main(String[] args) {20 Util util = new Util();21 String name = util.getName();22 System.out.println("name: " + name);23 }24}25import org.easymock.tests.Util;26public class 4 {27 public static void main(String[] args) {28 Util util = new Util();29 String name = util.getName();30 System.out.println("name: " + name);31 }32}33import org.easymock.tests.Util;34public class 5 {35 public static void main(String[] args) {36 Util util = new Util();37 String name = util.getName();38 System.out.println("name: " + name);39 }40}41import org.easymock.tests.Util;42public class 6 {43 public static void main(String[] args) {44 Util util = new Util();45 String name = util.getName();46 System.out.println("name: " + name);47 }48}49import org.easymock.tests.Util;50public class 7 {51 public static void main(String[] args) {52 Util util = new Util();53 String name = util.getName();54 System.out.println("name: " + name
getName
Using AI Code Generation
1package org.easymock.tests;2public class 1 {3 public static void main(String[] args) {4 Util util = new Util();5 System.out.println(util.getName());6 }7}8package org.easymock.tests;9public class Util {10 public String getName() {11 return "Hello";12 }13}
getName
Using AI Code Generation
1import org.easymock.tests.Util;2import org.easymock.MockControl;3import java.util.List;4import java.util.ArrayList;5public class 1 {6 public static void main(String[] args) {7 List list = new ArrayList();8 list.add("one");9 list.add("two");10 list.add("three");11 MockControl control = MockControl.createStrictControl(List.class);12 List mock = (List) control.getMock();13 mock.add("one");14 mock.add("two");15 mock.add("three");16 control.replay();17 mock.add("one");18 mock.add("two");19 mock.add("three");20 control.verify();21 Util.getName();22 }23}
getName
Using AI Code Generation
1package org.easymock.tests;2import org.easymock.*;3import org.easymock.tests.Util;4{5 public static void main(String[] args)6 {7 MockControl control = MockControl.createControl(Util.class);8 Util util = (Util) control.getMock();9 util.getName();10 control.setReturnValue("easymock");11 control.replay();12 System.out.println("Name is " + util.getName());13 control.verify();14 }15}16package org.easymock.tests;17import org.easymock.*;18import org.easymock.tests.Util;19{20 public static void main(String[] args)21 {22 MockControl control = MockControl.createControl(Util.class);23 Util util = (Util) control.getMock();24 util.getName();25 control.setReturnValue("easymock");26 control.replay();27 System.out.println("Name is " + util.getName());28 control.verify();29 }30}31package org.easymock.tests;32import org.easymock.*;33import org.easymock.tests.Util;34{35 public static void main(String[] args)36 {37 MockControl control = MockControl.createControl(Util.class);38 Util util = (Util) control.getMock();39 util.getName();40 control.setReturnValue("easymock");41 control.replay();42 System.out.println("Name is " + util.getName());43 control.verify();44 }45}46package org.easymock.tests;47import org.easymock.*;48import org.easymock.tests.Util;49{50 public static void main(String[] args)51 {52 MockControl control = MockControl.createControl(Util.class);53 Util util = (Util) control.getMock();54 util.getName();55 control.setReturnValue("easymock");56 control.replay();57 System.out.println("Name is " + util.getName());58 control.verify();59 }60}
getName
Using AI Code Generation
1import org.easymock.tests.Util;2import java.util.*;3public class 1 {4 public static void main(String args[]){5 String name = Util.getName();6 System.out.println("Name is "+name);7 }8}9import org.easymock.tests.Util;10import java.util.*;11public class 2 {12 public static void main(String args[]){13 String name = Util.getName();14 System.out.println("Name is "+name);15 }16}17import org.easymock.tests.Util;18import java.util.*;19public class 3 {20 public static void main(String args[]){21 String name = Util.getName();22 System.out.println("Name is "+name);23 }24}25import org.easymock.tests.Util;26import java.util.*;27public class 4 {28 public static void main(String args[]){29 String name = Util.getName();30 System.out.println("Name is "+name);31 }32}33import org.easymock.tests.Util;34import java.util.*;35public class 5 {36 public static void main(String args[]){37 String name = Util.getName();38 System.out.println("Name is "+name);39 }40}41import org.easymock.tests.Util;42import java.util.*;43public class 6 {44 public static void main(String args[]){45 String name = Util.getName();46 System.out.println("Name is "+name);47 }48}49import org.easymock.tests.Util;50import java.util.*;51public class 7 {52 public static void main(String args[]){53 String name = Util.getName();54 System.out.println("Name is "+name);55 }56}57import org.easymock.tests.Util;58import java.util.*;59public class 8 {
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!!