How to use SuiteRunner class of org.testng package

Best Testng code snippet using org.testng.SuiteRunner

Source:VerifyTests.java Github

copy

Full Screen

...47 at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)48 at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)49 at org.testng.TestRunner.privateRun(TestRunner.java:767)50 at org.testng.TestRunner.run(TestRunner.java:617)51 at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)52 at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)53 at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)54 at org.testng.SuiteRunner.run(SuiteRunner.java:240)55 at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)56 at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)57 at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)58 at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)59 at org.testng.TestNG.run(TestNG.java:1057)60 at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)61 at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)62 at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)63 Failure 2 of 364 org.muthu.VerificationError: test4 doesn't matches expected [test4] but found [test#]65 at org.testng.Assert.fail(Assert.java:94)66 at org.testng.Assert.failNotEquals(Assert.java:494)67 at org.testng.Assert.assertEquals(Assert.java:123)68 at org.testng.Assert.assertEquals(Assert.java:176)69 at org.muthu.Verify.verifyEquals(Verify.java:90)70 at org.muthu.TestVerify.test01(TestVerify.java:17)71 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)72 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)73 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)74 at java.lang.reflect.Method.invoke(Unknown Source)75 at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)76 at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)77 at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)78 at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)79 at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)80 at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)81 at org.testng.TestRunner.privateRun(TestRunner.java:767)82 at org.testng.TestRunner.run(TestRunner.java:617)83 at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)84 at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)85 at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)86 at org.testng.SuiteRunner.run(SuiteRunner.java:240)87 at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)88 at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)89 at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)90 at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)91 at org.testng.TestNG.run(TestNG.java:1057)92 at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)93 at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)94 at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)95 Failure 3 of 396 java.lang.AssertionError: test7 doesn't matches expected [test7] but found [test$]97 at org.testng.Assert.fail(Assert.java:94)98 at org.testng.Assert.failNotEquals(Assert.java:494)99 at org.testng.Assert.assertEquals(Assert.java:123)100 at org.testng.Assert.assertEquals(Assert.java:176)101 at org.muthu.TestVerify.test01(TestVerify.java:20)102 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)103 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)104 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)105 at java.lang.reflect.Method.invoke(Unknown Source)106 at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)107 at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)108 at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)109 at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)110 at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)111 at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)112 at org.testng.TestRunner.privateRun(TestRunner.java:767)113 at org.testng.TestRunner.run(TestRunner.java:617)114 at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)115 at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)116 at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)117 at org.testng.SuiteRunner.run(SuiteRunner.java:240)118 at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)119 at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)120 at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)121 at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)122 at org.testng.TestNG.run(TestNG.java:1057)123 at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)124 at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)125 at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)126 ===============================================127 Default test128 Tests run: 1, Failures: 1, Skips: 0129 ===============================================*/130 131 }132 133 @Test134 public void verifyNotEqualsTest(){135 136 /* verifyNotEquals */137 Verify.verifyNotEquals("test!", "test1", "test1 matches"); // pass138 Verify.verifyNotEquals("test2", "test2", "test2 matches"); // fail (continue)139 Verify.verifyNotEquals("test!", "test3", "test3 matches"); // pass140 Verify.verifyNotEquals("test4", "test4", "test4 matches"); // fail (continue)141 Verify.verifyNotEquals("test!", "test5", "test5 matches"); // pass142 Verify.verifyNotEquals("test!", "test6", "test6 matches"); // pass143 Assert.assertNotEquals("test7", "test7", "test7 matches"); // fail (exit) 144 Assert.assertNotEquals("test!", "test8", "test8 matches"); // not run!145 Verify.verifyNotEquals("test!", "test9", "test9 matches"); // not run!146 147 // Output148 149/* FAILED: verifyNotEqualsTest150 java.lang.Throwable: Multiple failures (3)151 (1)org.muthu.VerificationError:test2 matches152 (2)org.muthu.VerificationError:test4 matches153 (3)java.lang.AssertionError:test7 matches154 Failure 1 of 3155 org.muthu.VerificationError: test2 matches156 at org.testng.Assert.fail(Assert.java:94)157 at org.testng.Assert.assertNotEquals(Assert.java:854)158 at org.muthu.Verify.verifyNotEquals(Verify.java:434)159 at org.muthu.TestVerify.verifyNotEqualsTest(TestVerify.java:143)160 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)161 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)162 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)163 at java.lang.reflect.Method.invoke(Unknown Source)164 at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)165 at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)166 at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)167 at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)168 at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)169 at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)170 at org.testng.TestRunner.privateRun(TestRunner.java:767)171 at org.testng.TestRunner.run(TestRunner.java:617)172 at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)173 at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)174 at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)175 at org.testng.SuiteRunner.run(SuiteRunner.java:240)176 at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)177 at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)178 at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)179 at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)180 at org.testng.TestNG.run(TestNG.java:1057)181 at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)182 at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)183 at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)184 Failure 2 of 3185 org.muthu.VerificationError: test4 matches186 at org.testng.Assert.fail(Assert.java:94)187 at org.testng.Assert.assertNotEquals(Assert.java:854)188 at org.muthu.Verify.verifyNotEquals(Verify.java:434)189 at org.muthu.TestVerify.verifyNotEqualsTest(TestVerify.java:145)190 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)191 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)192 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)193 at java.lang.reflect.Method.invoke(Unknown Source)194 at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)195 at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)196 at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)197 at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)198 at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)199 at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)200 at org.testng.TestRunner.privateRun(TestRunner.java:767)201 at org.testng.TestRunner.run(TestRunner.java:617)202 at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)203 at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)204 at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)205 at org.testng.SuiteRunner.run(SuiteRunner.java:240)206 at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)207 at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)208 at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)209 at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)210 at org.testng.TestNG.run(TestNG.java:1057)211 at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)212 at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)213 at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)214 Failure 3 of 3215 java.lang.AssertionError: test7 matches216 at org.testng.Assert.fail(Assert.java:94)217 at org.testng.Assert.assertNotEquals(Assert.java:854)218 at org.muthu.TestVerify.verifyNotEqualsTest(TestVerify.java:148)219 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)220 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)221 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)222 at java.lang.reflect.Method.invoke(Unknown Source)223 at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)224 at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)225 at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)226 at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)227 at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)228 at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)229 at org.testng.TestRunner.privateRun(TestRunner.java:767)230 at org.testng.TestRunner.run(TestRunner.java:617)231 at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)232 at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)233 at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)234 at org.testng.SuiteRunner.run(SuiteRunner.java:240)235 at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)236 at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)237 at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)238 at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)239 at org.testng.TestNG.run(TestNG.java:1057)240 at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)241 at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)242 at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)243 ===============================================244 Default test245 Tests run: 1, Failures: 1, Skips: 0246 ===============================================247*/248 }249 @Test250 public void verifyTrueTest(){251 252 /* verifyTrue */253 Verify.verifyTrue(true, "test1 condition is false"); // pass254 Verify.verifyTrue(false, "test2 condition is false"); // fail (continue)255 Verify.verifyTrue(true, "test3 condition is false"); // pass256 Verify.verifyTrue(false, "test4 condition is false"); // fail (continue)257 Verify.verifyTrue(true, "test5 condition is false"); // pass258 Verify.verifyTrue(true, "test6 condition is false"); // pass259 Assert.assertTrue(false, "test7 condition is false"); // fail (exit) 260 Assert.assertTrue(true, "test8 condition is false"); // not run!261 Verify.verifyTrue(true, "test9 condition is false"); // not run!262 263 // Output264 265/* Failure 1 of 3266 org.muthu.VerificationError: test2 condition is false expected [true] but found [false]267 at org.testng.Assert.fail(Assert.java:94)268 at org.testng.Assert.failNotEquals(Assert.java:494)269 at org.testng.Assert.assertTrue(Assert.java:42)270 at org.muthu.Verify.verifyTrue(Verify.java:18)271 at org.muthu.TestVerify.verifyTrueTest(TestVerify.java:265)272 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)273 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)274 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)275 at java.lang.reflect.Method.invoke(Unknown Source)276 at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)277 at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)278 at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)279 at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)280 at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)281 at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)282 at org.testng.TestRunner.privateRun(TestRunner.java:767)283 at org.testng.TestRunner.run(TestRunner.java:617)284 at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)285 at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)286 at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)287 at org.testng.SuiteRunner.run(SuiteRunner.java:240)288 at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)289 at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)290 at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)291 at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)292 at org.testng.TestNG.run(TestNG.java:1057)293 at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)294 at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)295 at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)296 Failure 2 of 3297 org.muthu.VerificationError: test4 condition is false expected [true] but found [false]298 at org.testng.Assert.fail(Assert.java:94)299 at org.testng.Assert.failNotEquals(Assert.java:494)300 at org.testng.Assert.assertTrue(Assert.java:42)301 at org.muthu.Verify.verifyTrue(Verify.java:18)302 at org.muthu.TestVerify.verifyTrueTest(TestVerify.java:267)303 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)304 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)305 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)306 at java.lang.reflect.Method.invoke(Unknown Source)307 at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)308 at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)309 at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)310 at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)311 at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)312 at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)313 at org.testng.TestRunner.privateRun(TestRunner.java:767)314 at org.testng.TestRunner.run(TestRunner.java:617)315 at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)316 at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)317 at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)318 at org.testng.SuiteRunner.run(SuiteRunner.java:240)319 at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)320 at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)321 at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)322 at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)323 at org.testng.TestNG.run(TestNG.java:1057)324 at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)325 at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)326 at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)327 Failure 3 of 3328 java.lang.AssertionError: test7 condition is false expected [true] but found [false]329 at org.testng.Assert.fail(Assert.java:94)330 at org.testng.Assert.failNotEquals(Assert.java:494)331 at org.testng.Assert.assertTrue(Assert.java:42)332 at org.muthu.TestVerify.verifyTrueTest(TestVerify.java:270)333 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)334 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)335 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)336 at java.lang.reflect.Method.invoke(Unknown Source)337 at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)338 at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)339 at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)340 at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)341 at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)342 at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)343 at org.testng.TestRunner.privateRun(TestRunner.java:767)344 at org.testng.TestRunner.run(TestRunner.java:617)345 at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)346 at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)347 at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)348 at org.testng.SuiteRunner.run(SuiteRunner.java:240)349 at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)350 at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)351 at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)352 at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)353 at org.testng.TestNG.run(TestNG.java:1057)354 at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)355 at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)356 at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)357 ===============================================358 Default test359 Tests run: 1, Failures: 1, Skips: 0360 ===============================================361*/362 }363 364 @Test365 public void exceptionTest(){366 367 String str = null;368 369 /* verifyEquals */370 Verify.verifyEquals("test1", "test1", "test1 doesn't match"); // pass371 Verify.verifyEquals("test!", "test2", "test2 doesn't match"); // fail (continue)372 Verify.verifyEquals("test3", "test3", "test3 doesn't match"); // pass373 374 /*375 * Test run will not continue if there is any exception/error (except Assertion error) during verification 376 */377 Verify.verifyEquals("test#", str.substring(0), "test4 doesn't match"); // fail (exit) 378 379 380 Verify.verifyEquals("test5", "test5", "test5 doesn't match"); // not run!381 Verify.verifyEquals("test6", "test6", "test6 doesn't match"); // not run!382 Assert.assertEquals("test$", "test7", "test7 doesn't match"); // not run! 383 Assert.assertEquals("test8", "test8", "test8 doesn't match"); // not run!384 Verify.verifyEquals("test9", "test9", "test9 doesn't match"); // not run!385 // Output386 387/* FAILED: exceptionTest388 java.lang.Throwable: Multiple failures (2)389 (1)org.muthu.VerificationError:test2 doesn't match expected [test2] but found [test!]390 (2)java.lang.NullPointerException:null391 Failure 1 of 2392 org.muthu.VerificationError: test2 doesn't match expected [test2] but found [test!]393 at org.testng.Assert.fail(Assert.java:94)394 at org.testng.Assert.failNotEquals(Assert.java:494)395 at org.testng.Assert.assertEquals(Assert.java:123)396 at org.testng.Assert.assertEquals(Assert.java:176)397 at org.muthu.Verify.verifyEquals(Verify.java:90)398 at org.muthu.TestVerify.exceptionTest(TestVerify.java:386)399 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)400 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)401 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)402 at java.lang.reflect.Method.invoke(Unknown Source)403 at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)404 at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)405 at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)406 at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)407 at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)408 at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)409 at org.testng.TestRunner.privateRun(TestRunner.java:767)410 at org.testng.TestRunner.run(TestRunner.java:617)411 at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)412 at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)413 at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)414 at org.testng.SuiteRunner.run(SuiteRunner.java:240)415 at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)416 at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)417 at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)418 at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)419 at org.testng.TestNG.run(TestNG.java:1057)420 at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)421 at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)422 at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)423 Failure 2 of 2424 java.lang.NullPointerException425 at org.muthu.TestVerify.exceptionTest(TestVerify.java:392)426 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)427 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)428 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)429 at java.lang.reflect.Method.invoke(Unknown Source)430 at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)431 at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)432 at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)433 at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)434 at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)435 at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)436 at org.testng.TestRunner.privateRun(TestRunner.java:767)437 at org.testng.TestRunner.run(TestRunner.java:617)438 at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)439 at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)440 at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)441 at org.testng.SuiteRunner.run(SuiteRunner.java:240)442 at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)443 at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)444 at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)445 at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)446 at org.testng.TestNG.run(TestNG.java:1057)447 at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)448 at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)449 at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)450 ===============================================451 Default test452 Tests run: 1, Failures: 1, Skips: 0453 ===============================================454*/455 }456 457}...

Full Screen

Full Screen

Source:MavenArtifactTest.java Github

copy

Full Screen

...127 at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)128 at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)129 at org.testng.TestRunner.privateRun(TestRunner.java:767)130 at org.testng.TestRunner.run(TestRunner.java:617)131 at org.testng.SuiteRunner.runTest(SuiteRunner.java:348)132 at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:343)133 at org.testng.SuiteRunner.privateRun(SuiteRunner.java:305)134 at org.testng.SuiteRunner.run(SuiteRunner.java:254)135 at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)136 at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)137 at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)138 at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)139 at org.testng.TestNG.run(TestNG.java:1057)140 at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:115)141 at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeMulti(TestNGDirectoryTestSuite.java:205)142 at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:108)143 at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:111)144 at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)145 at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)146 at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)147 */148 @Test(groups={"Integration","Broken"})149 public void testRetrievalLocalIntegration() throws Exception {150 MavenArtifact m = MavenArtifact.fromCoordinate(MAVEN_JAR_PLUGIN_COORDINATE);151 String localPath = new MavenRetriever().getLocalPath(m);152 File f = new File(localPath);153 if (!f.exists())154 Assert.fail("Could not load "+localPath+" when testing MavenRetriever: do a maven build with no integration tests first to ensure this is installed, then rerun");155 156 checkValidMavenJarUrl(MavenRetriever.localUrl(m), "org/apache/maven/plugin/jar/JarMojo.class");157 }158 @Test(groups="Integration")159 public void testRetrievalHostedReleaseIntegration() throws Exception {160 MavenArtifact m = MavenArtifact.fromCoordinate(MAVEN_JAR_PLUGIN_COORDINATE);161 checkValidMavenJarUrl(new MavenRetriever().getHostedUrl(m), "org/apache/maven/plugin/jar/JarMojo.class");162 }163 protected void checkAvailableUrl(String url) throws Exception {164 try {165 InputStream stream = new URL(url).openStream();166 stream.read();167 stream.close();168 } catch (Exception e) {169 throw Exceptions.propagate(e);170 }171 }172 protected void checkValidMavenJarUrl(String url, String resource) throws Exception {173 // URLClassLoader doesn't follow redirects; find out the real URL174 // Note URLClassLoader.close was only added in Java 7; do not call it until Java 6 support is not needed!175 URL realUrl = followRedirects(new URL(url));176 URLClassLoader classLoader = new URLClassLoader(new URL[] { realUrl });177 try {178 URL innerU = classLoader.findResource(resource);179 InputStream innerUin = innerU.openConnection().getInputStream();180 innerUin.close();181 } finally {182 classLoader.close();183 }184 }185 /*186 Exception java.lang.AssertionError187 188 Message: Could not load /home/ubuntu/.m2/repository/org/apache/brooklyn/brooklyn-utils-common/(version)/brooklyn-utils-common-(version)-SNAPSHOT.jar when testing MavenRetriever: do a maven build with no integration tests first to ensure this is installed, then rerun189 Stacktrace:190 191 192 at org.testng.Assert.fail(Assert.java:94)193 at org.apache.brooklyn.util.maven.MavenArtifactTest.testRetrievalHostedSnapshotIntegration(MavenArtifactTest.java:176)194 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)195 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)196 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)197 at java.lang.reflect.Method.invoke(Method.java:606)198 at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)199 at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)200 at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)201 at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)202 at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)203 at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)204 at org.testng.TestRunner.privateRun(TestRunner.java:767)205 at org.testng.TestRunner.run(TestRunner.java:617)206 at org.testng.SuiteRunner.runTest(SuiteRunner.java:348)207 at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:343)208 at org.testng.SuiteRunner.privateRun(SuiteRunner.java:305)209 at org.testng.SuiteRunner.run(SuiteRunner.java:254)210 at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)211 at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)212 at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)213 at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)214 at org.testng.TestNG.run(TestNG.java:1057)215 at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:115)216 at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeMulti(TestNGDirectoryTestSuite.java:205)217 at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:108)218 at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:111)219 at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)220 at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)221 at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)222 */223 @Test(groups={"Integration","Broken"})224 public void testRetrievalHostedSnapshotIntegration() throws Exception {225 MavenArtifact m = MavenArtifact.fromCoordinate(...

Full Screen

Full Screen

Source:CliIntegrationTest.java Github

copy

Full Screen

...63 at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)64 at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)65 at org.testng.TestRunner.privateRun(TestRunner.java:767)66 at org.testng.TestRunner.run(TestRunner.java:617)67 at org.testng.SuiteRunner.runTest(SuiteRunner.java:348)68 at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:343)69 at org.testng.SuiteRunner.privateRun(SuiteRunner.java:305)70 at org.testng.SuiteRunner.run(SuiteRunner.java:254)71 at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)72 at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)73 at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)74 at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)75 at org.testng.TestNG.run(TestNG.java:1057)76 at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:115)77 at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeMulti(TestNGDirectoryTestSuite.java:205)78 at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:108)79 at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:111)80 at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)81 at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)82 at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)83 Caused by: java.io.IOException: error=2, No such file or directory84 at java.lang.UNIXProcess.forkAndExec(Native Method)85 at java.lang.UNIXProcess.<init>(UNIXProcess.java:186)86 at java.lang.ProcessImpl.start(ProcessImpl.java:130)87 at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028)88 ... 30 more89 */90 /**91 * Checks if launching an application using {@code brooklyn launch} produces the expected output.92 */93 @Test(groups = {"Integration","Broken"})94 public void testLaunchCliApp() throws Throwable {95 final Process brooklyn = startBrooklyn("--verbose", "launch", "--stopOnKeyPress", "--app", "org.apache.brooklyn.cli.BaseCliIntegrationTest$TestApplication", "--location", "localhost", "--noConsole");96 BrooklynCliTest test = new BrooklynCliTest(brooklyn) {97 @Override98 public void checkConsole() {99 assertConsoleOutput("Launching brooklyn app:"); // Launch message not output100 assertNoConsoleOutput("Initiating Jersey application"); // Web console started101 assertConsoleOutput("Started application BasicApplicationImpl"); // Application not started102 assertConsoleOutput("Server started. Press return to stop."); // Server started message not output103 assertConsoleErrorEmpty();104 }105 };106 testBrooklyn(brooklyn, test, 0, true);107 }108 /**109 * Checks if a correct error and help message is given if using incorrect param.110 */111 @Test(groups = {"Integration","Broken"})112 public void testLaunchCliAppParamError() throws Throwable {113 final Process brooklyn = startBrooklyn("launch", "nothing", "--app");114 BrooklynCliTest test = new BrooklynCliTest(brooklyn) {115 @Override116 public void checkConsole() {117 assertConsoleError("Parse error: Required values for option 'application class or file' not provided");118 assertConsoleError("NAME", "SYNOPSIS", "OPTIONS", "COMMANDS");119 assertConsoleOutputEmpty();120 }121 };122 testBrooklyn(brooklyn, test, 1);123 }124 /*125 Exception java.io.IOException126 127 Message: Cannot run program "./target/brooklyn-dist/bin/brooklyn": error=2, No such file or directory128 Stacktrace:129 130 131 at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)132 at org.apache.brooklyn.cli.BaseCliIntegrationTest.startBrooklyn(BaseCliIntegrationTest.java:75)133 at org.apache.brooklyn.cli.CliIntegrationTest.testLaunchCliAppCommandError(CliIntegrationTest.java:96)134 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)135 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)136 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)137 at java.lang.reflect.Method.invoke(Method.java:606)138 at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)139 at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)140 at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)141 at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)142 at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)143 at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)144 at org.testng.TestRunner.privateRun(TestRunner.java:767)145 at org.testng.TestRunner.run(TestRunner.java:617)146 at org.testng.SuiteRunner.runTest(SuiteRunner.java:348)147 at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:343)148 at org.testng.SuiteRunner.privateRun(SuiteRunner.java:305)149 at org.testng.SuiteRunner.run(SuiteRunner.java:254)150 at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)151 at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)152 at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)153 at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)154 at org.testng.TestNG.run(TestNG.java:1057)155 at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:115)156 at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeMulti(TestNGDirectoryTestSuite.java:205)157 at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:108)158 at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:111)159 at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)160 at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)161 at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)162 Caused by: java.io.IOException: error=2, No such file or directory163 at java.lang.UNIXProcess.forkAndExec(Native Method)164 at java.lang.UNIXProcess.<init>(UNIXProcess.java:186)165 at java.lang.ProcessImpl.start(ProcessImpl.java:130)...

Full Screen

Full Screen

Source:SuiteDispatcher.java Github

copy

Full Screen

...7import org.testng.ISuite;8import org.testng.ISuiteResult;9import org.testng.ITestListener;10import org.testng.ITestResult;11import org.testng.SuiteRunner;12import org.testng.TestNGException;13import org.testng.collections.Lists;14import org.testng.internal.IConfiguration;15import org.testng.internal.Invoker;16import org.testng.internal.PropertiesFile;17import org.testng.remote.adapter.DefaultMastertAdapter;18import org.testng.remote.adapter.IMasterAdapter;19import org.testng.remote.adapter.RemoteResultListener;20import org.testng.xml.XmlSuite;21import org.testng.xml.XmlTest;2223/**24 * Dispatches test suits according to the strategy defined.25 *26 *27 * @author Guy Korland28 * @since April 20, 200729 */30public class SuiteDispatcher31{32 /**33 * Properties allowed in remote.properties34 */35 public static final String MASTER_STRATEGY = "testng.master.strategy";36 public static final String VERBOSE = "testng.verbose";37 public static final String MASTER_ADPATER = "testng.master.adpter";3839 /**40 * Values allowed for STRATEGY41 */42 public static final String STRATEGY_TEST = "test";43 public static final String STRATEGY_SUITE = "suite";4445 final private int m_verbose;46 final private boolean m_isStrategyTest;4748 final private IMasterAdapter m_masterAdpter;495051 /**52 * Creates a new suite dispatcher.53 */54 public SuiteDispatcher( String propertiesFile) throws TestNGException55 {56 try57 {58 PropertiesFile file = new PropertiesFile( propertiesFile);59 Properties properties = file.getProperties();6061 m_verbose = Integer.parseInt( properties.getProperty(VERBOSE, "1"));6263 String strategy = properties.getProperty(MASTER_STRATEGY, STRATEGY_SUITE);64 m_isStrategyTest = STRATEGY_TEST.equalsIgnoreCase(strategy);6566 String adapter = properties.getProperty(MASTER_ADPATER);67 if( adapter == null)68 {69 m_masterAdpter = new DefaultMastertAdapter();70 }71 else72 {73 Class clazz = Class.forName(adapter);74 m_masterAdpter = (IMasterAdapter)clazz.newInstance();75 }76 m_masterAdpter.init(properties);77 }78 catch( Exception e)79 {80 throw new TestNGException( "Fail to initialize master mode", e);81 }82 }8384 /**85 * Dispatch test suites86 * @return suites result87 */88 public List<ISuite> dispatch(IConfiguration configuration,89 List<XmlSuite> suites, String outputDir, List<ITestListener> testListeners){90 List<ISuite> result = Lists.newArrayList();91 try92 {93 //94 // Dispatch the suites/tests95 //9697 for (XmlSuite suite : suites) {98 suite.setVerbose(m_verbose);99 SuiteRunner suiteRunner = new SuiteRunner(configuration, suite, outputDir);100 RemoteResultListener listener = new RemoteResultListener( suiteRunner);101 if (m_isStrategyTest) {102 for (XmlTest test : suite.getTests()) {103 XmlSuite tmpSuite = new XmlSuite();104 tmpSuite.setXmlPackages(suite.getXmlPackages());105 tmpSuite.setJUnit(suite.isJUnit());106 tmpSuite.setSkipFailedInvocationCounts(suite.skipFailedInvocationCounts());107 tmpSuite.setName("Temporary suite for " + test.getName());108 tmpSuite.setParallel(suite.getParallel());109 tmpSuite.setParentModule(suite.getParentModule());110 tmpSuite.setGuiceStage(suite.getGuiceStage());111 tmpSuite.setParameters(suite.getParameters());112 tmpSuite.setThreadCount(suite.getThreadCount());113 tmpSuite.setDataProviderThreadCount(suite.getDataProviderThreadCount()); ...

Full Screen

Full Screen

Source:JDITest.java Github

copy

Full Screen

...25 at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)26 at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)27 at org.testng.TestRunner.privateRun(TestRunner.java:648)28 at org.testng.TestRunner.run(TestRunner.java:505)29 at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)30 at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)31 at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)32 at org.testng.SuiteRunner.run(SuiteRunner.java:364)33 at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)34 at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)35 at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208)36 at org.testng.TestNG.runSuitesLocally(TestNG.java:1137)37 at org.testng.TestNG.runSuites(TestNG.java:1049)38 at org.testng.TestNG.run(TestNG.java:1017)39 at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72)40 at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:123)41java.lang.RuntimeException:42None Driver has been found for current thread. Probably Fixture configuration is wrong.43 at com.epam.jdi.light.common.Exceptions.exception(Exceptions.java:12)44 at com.epam.jdi.light.driver.WebDriverFactory.close(WebDriverFactory.java:188)45 at hw7.TestInit.afterSuite(TestInit.java:17)46 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)47 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)48 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)49 at java.lang.reflect.Method.invoke(Method.java:498)50 at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)51 at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59)52 at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:458)53 at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:222)54 at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142)55 at org.testng.SuiteRunner.privateRun(SuiteRunner.java:425)56 at org.testng.SuiteRunner.run(SuiteRunner.java:364)57 at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)58 at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)59 at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208)60 at org.testng.TestNG.runSuitesLocally(TestNG.java:1137)61 at org.testng.TestNG.runSuites(TestNG.java:1049)62 at org.testng.TestNG.run(TestNG.java:1017)63 at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72)64 at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:123)65 */66public class JDITest extends TestInit {67 private String[] sum = new String[]{"3", "8"};68 private Color color = Color.Red;69 private Metal metal = Metal.Selen;70 private Vegetables[] vegetables = new Vegetables[]{Vegetables.Cucumber, Vegetables.Tomato};71 private Elements[] elements = new Elements[]{Elements.Water, Elements.Fire};72 private TestData testData = new TestData(sum, elements, color, metal, vegetables);...

Full Screen

Full Screen

Source:SuiteRunnerWorker.java Github

copy

Full Screen

1package org.testng;2import org.testng.collections.Lists;3import org.testng.collections.Objects;4import org.testng.internal.SuiteRunnerMap;5import org.testng.internal.Utils;6import org.testng.internal.thread.graph.IWorker;7import org.testng.xml.XmlSuite;8import java.util.Collection;9import java.util.List;10import java.util.Map;11/**12 * An {@code IWorker} that is used to encapsulate and run Suite Runners13 *14 * @author cbeust, nullin15 */16public class SuiteRunnerWorker implements IWorker<ISuite> {17 private SuiteRunner m_suiteRunner;18 private Integer m_verbose;19 private String m_defaultSuiteName;20 private SuiteRunnerMap m_suiteRunnerMap;21 public SuiteRunnerWorker(ISuite suiteRunner,22 SuiteRunnerMap suiteRunnerMap,23 int verbose,24 String defaultSuiteName)25 {26 m_suiteRunnerMap = suiteRunnerMap;27 m_suiteRunner = (SuiteRunner) suiteRunner;28 m_verbose = verbose;29 m_defaultSuiteName = defaultSuiteName;30 }31 /**32 * Runs a suite33 * @param suiteRunnerMap map of suiteRunners that are updated with test results34 * @param xmlSuite XML suites to run35 */36 private void runSuite(SuiteRunnerMap suiteRunnerMap /* OUT */, XmlSuite xmlSuite)37 {38 if (m_verbose > 0) {39 StringBuffer allFiles = new StringBuffer();40 allFiles.append(" ").append(xmlSuite.getFileName() != null41 ? xmlSuite.getFileName() : m_defaultSuiteName).append('\n');42 Utils.log("TestNG", 0, "Running:\n" + allFiles.toString());43 }44 SuiteRunner suiteRunner = (SuiteRunner) suiteRunnerMap.get(xmlSuite);45 suiteRunner.run();46 //TODO: this should be handled properly47 // for (IReporter r : suiteRunner.getReporters()) {48 // addListener(r);49 // }50 // PoolService.getInstance().shutdown();51 //52 // Display the final statistics53 //54 if (xmlSuite.getVerbose() > 0) {55 SuiteResultCounts counts = new SuiteResultCounts();56 synchronized (suiteRunnerMap) {57 counts.calculateResultCounts(xmlSuite, suiteRunnerMap);58 }59 StringBuffer bufLog = new StringBuffer("\n===============================================\n")60 .append(xmlSuite.getName());61 bufLog.append("\nTotal tests run: ")62 .append(counts.m_total).append(", Failures: ").append(counts.m_failed)63 .append(", Skips: ").append(counts.m_skipped);64 if(counts.m_confFailures > 0 || counts.m_confSkips > 0) {65 bufLog.append("\nConfiguration Failures: ").append(counts.m_confFailures)66 .append(", Skips: ").append(counts.m_confSkips);67 }68 bufLog.append("\n===============================================\n");69 System.out.println(bufLog.toString());70 }71 }72 @Override73 public void run() {74 runSuite(m_suiteRunnerMap, m_suiteRunner.getXmlSuite());75 }76 @Override77 public int compareTo(IWorker<ISuite> arg0) {78 /*79 * Dummy Implementation80 *81 * Used by IWorkers to prioritize execution in parallel. Not required by82 * this Worker in current implementation83 */84 return 0;85 }86 @Override87 public List<ISuite> getTasks() {88 List<ISuite> suiteRunnerList = Lists.newArrayList();89 suiteRunnerList.add(m_suiteRunner);90 return suiteRunnerList;91 }92 @Override93 public String toString() {94 return Objects.toStringHelper(getClass())95 .add("name", m_suiteRunner.getName())96 .toString();97 }98 @Override99 public long getTimeOut()100 {101 return m_suiteRunner.getXmlSuite().getTimeOut(Long.MAX_VALUE);102 }103 @Override104 public int getPriority()105 {106 // this class doesnt support priorities yet107 return 0;108 }109}110/**111 * Class to help calculate result counts for tests run as part of a suite and112 * its children suites113 *114 * @author nullin115 *116 */117class SuiteResultCounts {118 int m_total = 0;119 int m_skipped = 0;120 int m_failed = 0;121 int m_confFailures = 0;122 int m_confSkips = 0;123 public void calculateResultCounts(XmlSuite xmlSuite, SuiteRunnerMap suiteRunnerMap)124 {125 ISuite iSuite = suiteRunnerMap.get(xmlSuite);126 if (iSuite != null) {127 Map<String, ISuiteResult> results = iSuite.getResults();128 if (results != null) {129 Collection<ISuiteResult> tempSuiteResult = results.values();130 for (ISuiteResult isr : tempSuiteResult) {131 ITestContext ctx = isr.getTestContext();132 int skipped = ctx.getSkippedTests().size();133 int failed = ctx.getFailedTests().size() + ctx.getFailedButWithinSuccessPercentageTests().size();134 m_skipped += skipped;135 m_failed += failed;136 m_confFailures += ctx.getFailedConfigurations().size();137 m_confSkips += ctx.getSkippedConfigurations().size();...

Full Screen

Full Screen

Source:RemoteResultListener.java Github

copy

Full Screen

...1011import org.testng.ISuite;12import org.testng.ISuiteResult;13import org.testng.ITestContext;14import org.testng.SuiteRunner;15import org.testng.reporters.TestHTMLReporter;1617/**18 * This listener is called by the {@link IWorkerAdapter} implementation when a remote test result is ready.19 *20 * @author Guy Korland21 * @since April 9, 200722 * @see IWorkerAdapter23 */24public class RemoteResultListener25{26 /**27 * Holds the corresponded {@link SuiteRunner} for the processed {@link org.testng.xml.XmlSuite}.28 */29 final private SuiteRunner m_runner;3031 /**32 * Creates a listener for an {@link org.testng.xml.XmlSuite} result.33 * @param runner the corresponded {@link SuiteRunner}34 */35 public RemoteResultListener( SuiteRunner runner)36 {37 m_runner = runner;38 }3940 /**41 * Should called by the {@link IWorkerAdapter} implementation when a remote suite result is ready.42 * @param remoteSuiteRunner remote result.43 */44 public void onResult( ISuite remoteSuiteRunner)45 {46 m_runner.setHost(remoteSuiteRunner.getHost());47 Map<String, ISuiteResult> tmpResults = remoteSuiteRunner.getResults();48 Map<String, ISuiteResult> suiteResults = m_runner.getResults();49 for (Map.Entry<String, ISuiteResult> entry : tmpResults.entrySet())50 {51 ISuiteResult suiteResult = entry.getValue();52 suiteResults.put(entry.getKey(), suiteResult);53 ITestContext tc = suiteResult.getTestContext();54 TestHTMLReporter.generateLog(tc, remoteSuiteRunner.getHost(),55 m_runner.getOutputDirectory(),56 tc.getFailedConfigurations().getAllResults(),57 tc.getSkippedConfigurations().getAllResults(),58 tc.getPassedTests().getAllResults(),59 tc.getFailedTests().getAllResults(),60 tc.getSkippedTests().getAllResults(),61 tc.getFailedButWithinSuccessPercentageTests().getAllResults());62 }63 }64} ...

Full Screen

Full Screen

Source:RemoteWorker.java Github

copy

Full Screen

1package org.testng.remote;2import org.testng.SuiteRunner;3import org.testng.internal.Utils;4import org.testng.internal.remote.SlavePool;5import org.testng.remote.adapter.RemoteResultListener;6import org.testng.xml.XmlSuite;7import java.io.IOException;8public class RemoteWorker {9 protected RemoteResultListener m_listener;10 private SlavePool m_slavePool;11 public RemoteWorker(RemoteResultListener listener, SlavePool slavePool) {12 m_listener = listener;13 m_slavePool = slavePool;14 }15 protected SlavePool getSlavePool() {16 return m_slavePool;17 }18 protected SuiteRunner sendSuite(ConnectionInfo ci, XmlSuite suite)19 throws IOException, ClassNotFoundException20 {21 log("Sending " + suite.getName() + " to "22 + ci.getSocket().getInetAddress().getCanonicalHostName() + ":"23 + ci.getSocket().getRemoteSocketAddress());24 ci.getOos().writeObject(suite);25 ci.getOos().flush();26 SuiteRunner result = (SuiteRunner) ci.getOis().readObject();27 log("Received results for " + result.getName());28 return result;29 }30 private void log(String string) {31 Utils.log("", 2, string);32 }33}...

Full Screen

Full Screen

SuiteRunner

Using AI Code Generation

copy

Full Screen

1import org.testng.SuiteRunner;2import org.testng.TestNG;3import org.testng.xml.XmlSuite;4import org.testng.xml.XmlTest;5import org.testng.xml.XmlClass;6import org.testng.xml.XmlInclude;7import org.testng.xml.XmlSuite;8import org.testng.xml.XmlTest;9import org.testng.xml.XmlClass;10import org.testng.xml.XmlInclude;11import org.testng.xml.XmlSuite;12import org.testng.xml.XmlTest;13import org.testng.xml.XmlClass;14import org.testng.xml.XmlInclude;15import org.testng.xml.XmlSuite;16import org.testng.xml.XmlTest;17import org.testng.xml.XmlClass;18import org.testng.xml.XmlInclude;19import org.testng.xml.XmlSuite;20import org.testng.xml.XmlTest;21import org.testng.xml.XmlClass;22import org.testng.xml.XmlInclude;23import org.testng.xml.XmlSuite;24import org.testng.xml.XmlTest;25import org.testng.xml.XmlClass;26import org.testng.xml.XmlInclude;27import org.testng.xml.Xml

Full Screen

Full Screen

SuiteRunner

Using AI Code Generation

copy

Full Screen

1import org.testng.SuiteRunner;2import org.testng.TestNG;3import org.testng.xml.XmlSuite;4import org.testng.xml.XmlTest;5import java.util.ArrayList;6import java.util.List;7public class TestNGRunner {8 public static void main(String[] args) {9 XmlSuite suite = new XmlSuite();10 suite.setName("Suite");11 XmlTest test = new XmlTest(suite);12 test.setName("Test");13 test.setPreserveOrder("true");14 test.addParameter("browser", "chrome");15 List<String> classes = new ArrayList<String>();16 classes.add("testng.TestNGTest1");17 classes.add("testng.TestNGTest2");18 test.setXmlClasses(classes);19 List<XmlSuite> suites = new ArrayList<XmlSuite>();20 suites.add(suite);21 TestNG tng = new TestNG();22 tng.setXmlSuites(suites);23 tng.run();24 }25}

Full Screen

Full Screen

SuiteRunner

Using AI Code Generation

copy

Full Screen

1import org.testng.TestNG;2import java.io.File;3public class TestNGRunner {4 public static void main(String[] args) {5 TestNG testNG = new TestNG();6 testNG.setTestSuites(new File[]{7 new File("testng.xml")8 });9 testNG.run();10 }11}

Full Screen

Full Screen

SuiteRunner

Using AI Code Generation

copy

Full Screen

1import org.testng.SuiteRunner;2import org.testng.TestNG;3import org.testng.xml.XmlSuite;4public class TestNGRunner {5 public static void main(String[] args) {6 TestNG testNG = new TestNG();7 XmlSuite suite = new XmlSuite();8 suite.setName("TestNG Suite");9 SuiteRunner runner = new SuiteRunner(suite, 1, null);10 runner.run();11 }12}13package org.testng;14import org.testng.xml.XmlSuite;15public class TestNGRunner {16 public static void main(String[] args) {17 TestNG testNG = new TestNG();18 XmlSuite suite = new XmlSuite();19 suite.setName("TestNG Suite");20 testNG.setXmlSuites(Arrays.asList(suite));21 testNG.run();22 }23}24package org.testng;25import java.util.ArrayList;26import java.util.List;27import org.testng.xml.XmlSuite;28public class TestNGRunner {29 public static void main(String[] args) {30 TestNG testNG = new TestNG();31 XmlSuite suite = new XmlSuite();32 suite.setName("TestNG Suite");33 List<XmlSuite> suites = new ArrayList<XmlSuite>();34 suites.add(suite);35 testNG.setXmlSuites(suites);36 testNG.run();37 }38}

Full Screen

Full Screen

SuiteRunner

Using AI Code Generation

copy

Full Screen

1import org.testng.SuiteRunner;2import org.testng.TestNG;3import org.testng.xml.XmlSuite;4import java.util.Arrays;5import java.util.List;6public class MainClass {7 public static void main(String[] args) {8 TestNG testNG = new TestNG();9 SuiteRunner suiteRunner = new SuiteRunner();10 XmlSuite xmlSuite = new XmlSuite();11 xmlSuite.setName("Sample Suite");12 List<XmlSuite> suites = Arrays.asList(xmlSuite);13 testNG.setXmlSuites(suites);14 testNG.run();15 }16}17C:\Users\Karthik\Desktop\testng\testng\src\test\java>java -cp .;C:\Users\Karthik\Desktop\testng\testng\src\test\resources\testng-7.3.0.jar MainClass18[main] INFO org.testng.TestNG - TestNG 7.3.0 by Cédric Beust (

Full Screen

Full Screen

SuiteRunner

Using AI Code Generation

copy

Full Screen

1import org.testng.TestNG;2import org.testng.xml.XmlSuite;3import java.util.ArrayList;4import java.util.List;5public class SuiteRunner {6 public static void main(String[] args) {7 TestNG runner = new TestNG();8 XmlSuite suite = new XmlSuite();9 suite.setName("Sample Suite");10 List<XmlSuite> suites = new ArrayList<>();11 suites.add(suite);12 runner.setXmlSuites(suites);13 runner.run();14 }15}

Full Screen

Full Screen
copy
1import java.io.File;2import java.io.FileInputStream;3import java.io.FileOutputStream;4import java.io.IOException;56import java.security.AlgorithmParameters;7import java.security.InvalidKeyException;8import java.security.NoSuchAlgorithmException;9import java.security.SecureRandom;10import java.security.spec.InvalidKeySpecException;11import java.security.spec.InvalidParameterSpecException;12import java.security.spec.KeySpec;1314import java.util.logging.Level;15import java.util.logging.Logger;1617import javax.crypto.BadPaddingException;18import javax.crypto.Cipher;19import javax.crypto.CipherInputStream;20import javax.crypto.IllegalBlockSizeException;21import javax.crypto.NoSuchPaddingException;22import javax.crypto.SecretKey;23import javax.crypto.SecretKeyFactory;24import javax.crypto.spec.IvParameterSpec;25import javax.crypto.spec.PBEKeySpec;26import javax.crypto.spec.SecretKeySpec;2728public class AES {29 public final static int SALT_LEN = 8;30 static final String HEXES = "0123456789ABCDEF";31 String mPassword = null;32 byte[] mInitVec = null;33 byte[] mSalt = new byte[SALT_LEN];34 Cipher mEcipher = null;35 Cipher mDecipher = null;36 private final int KEYLEN_BITS = 128; // see notes below where this is used.37 private final int ITERATIONS = 65536;38 private final int MAX_FILE_BUF = 1024;3940 /**41 * create an object with just the passphrase from the user. Don't do anything else yet42 * @param password43 */44 public AES(String password) {45 mPassword = password;46 }4748 public static String byteToHex(byte[] raw) {49 if (raw == null) {50 return null;51 }5253 final StringBuilder hex = new StringBuilder(2 * raw.length);5455 for (final byte b : raw) {56 hex.append(HEXES.charAt((b & 0xF0) >> 4)).append(HEXES.charAt((b & 0x0F)));57 }5859 return hex.toString();60 }6162 public static byte[] hexToByte(String hexString) {63 int len = hexString.length();64 byte[] ba = new byte[len / 2];6566 for (int i = 0; i < len; i += 2) {67 ba[i / 2] = (byte) ((Character.digit(hexString.charAt(i), 16) << 4)68 + Character.digit(hexString.charAt(i + 1), 16));69 }7071 return ba;72 }7374 /**75 * debug/print messages76 * @param msg77 */78 private void Db(String msg) {79 System.out.println("** Crypt ** " + msg);80 }8182 /**83 * This is where we write out the actual encrypted data to disk using the Cipher created in setupEncrypt().84 * Pass two file objects representing the actual input (cleartext) and output file to be encrypted.85 *86 * there may be a way to write a cleartext header to the encrypted file containing the salt, but I ran87 * into uncertain problems with that.88 *89 * @param input - the cleartext file to be encrypted90 * @param output - the encrypted data file91 * @throws IOException92 * @throws IllegalBlockSizeException93 * @throws BadPaddingException94 */95 public void WriteEncryptedFile(InputStream inputStream, OutputStream outputStream)96 throws IOException, IllegalBlockSizeException, BadPaddingException {97 try {98 long totalread = 0;99 int nread = 0;100 byte[] inbuf = new byte[MAX_FILE_BUF];101 SecretKeyFactory factory = null;102 SecretKey tmp = null;103104 // crate secureRandom salt and store as member var for later use105 mSalt = new byte[SALT_LEN];106107 SecureRandom rnd = new SecureRandom();108109 rnd.nextBytes(mSalt);110 Db("generated salt :" + byteToHex(mSalt));111 factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");112113 /*114 * Derive the key, given password and salt.115 *116 * in order to do 256 bit crypto, you have to muck with the files for Java's "unlimted security"117 * The end user must also install them (not compiled in) so beware.118 * see here: http://www.javamex.com/tutorials/cryptography/unrestricted_policy_files.shtml119 */120 KeySpec spec = new PBEKeySpec(mPassword.toCharArray(), mSalt, ITERATIONS, KEYLEN_BITS);121122 tmp = factory.generateSecret(spec);123124 SecretKey secret = new SecretKeySpec(tmp.getEncoded(), "AES");125126 /*127 * Create the Encryption cipher object and store as a member variable128 */129 mEcipher = Cipher.getInstance("AES/CBC/PKCS5Padding");130 mEcipher.init(Cipher.ENCRYPT_MODE, secret);131132 AlgorithmParameters params = mEcipher.getParameters();133134 // get the initialization vectory and store as member var135 mInitVec = params.getParameterSpec(IvParameterSpec.class).getIV();136 Db("mInitVec is :" + byteToHex(mInitVec));137 outputStream.write(mSalt);138 outputStream.write(mInitVec);139140 while ((nread = inputStream.read(inbuf)) > 0) {141 Db("read " + nread + " bytes");142 totalread += nread;143144 // create a buffer to write with the exact number of bytes read. Otherwise a short read fills inbuf with 0x0145 // and results in full blocks of MAX_FILE_BUF being written.146 byte[] trimbuf = new byte[nread];147148 for (int i = 0; i < nread; i++) {149 trimbuf[i] = inbuf[i];150 }151152 // encrypt the buffer using the cipher obtained previosly153 byte[] tmpBuf = mEcipher.update(trimbuf);154155 // I don't think this should happen, but just in case..156 if (tmpBuf != null) {157 outputStream.write(tmpBuf);158 }159 }160161 // finalize the encryption since we've done it in blocks of MAX_FILE_BUF162 byte[] finalbuf = mEcipher.doFinal();163164 if (finalbuf != null) {165 outputStream.write(finalbuf);166 }167168 outputStream.flush();169 inputStream.close();170 outputStream.close();171 outputStream.close();172 Db("wrote " + totalread + " encrypted bytes");173 } catch (InvalidKeyException ex) {174 Logger.getLogger(AES.class.getName()).log(Level.SEVERE, null, ex);175 } catch (InvalidParameterSpecException ex) {176 Logger.getLogger(AES.class.getName()).log(Level.SEVERE, null, ex);177 } catch (NoSuchAlgorithmException ex) {178 Logger.getLogger(AES.class.getName()).log(Level.SEVERE, null, ex);179 } catch (NoSuchPaddingException ex) {180 Logger.getLogger(AES.class.getName()).log(Level.SEVERE, null, ex);181 } catch (InvalidKeySpecException ex) {182 Logger.getLogger(AES.class.getName()).log(Level.SEVERE, null, ex);183 }184 }185186 /**187 * Read from the encrypted file (input) and turn the cipher back into cleartext. Write the cleartext buffer back out188 * to disk as (output) File.189 *190 * I left CipherInputStream in here as a test to see if I could mix it with the update() and final() methods of encrypting191 * and still have a correctly decrypted file in the end. Seems to work so left it in.192 *193 * @param input - File object representing encrypted data on disk194 * @param output - File object of cleartext data to write out after decrypting195 * @throws IllegalBlockSizeException196 * @throws BadPaddingException197 * @throws IOException198 */199 public void ReadEncryptedFile(InputStream inputStream, OutputStream outputStream)200 throws IllegalBlockSizeException, BadPaddingException, IOException {201 try {202 CipherInputStream cin;203 long totalread = 0;204 int nread = 0;205 byte[] inbuf = new byte[MAX_FILE_BUF];206207 // Read the Salt208 inputStream.read(this.mSalt);209 Db("generated salt :" + byteToHex(mSalt));210211 SecretKeyFactory factory = null;212 SecretKey tmp = null;213 SecretKey secret = null;214215 factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");216217 KeySpec spec = new PBEKeySpec(mPassword.toCharArray(), mSalt, ITERATIONS, KEYLEN_BITS);218219 tmp = factory.generateSecret(spec);220 secret = new SecretKeySpec(tmp.getEncoded(), "AES");221222 /* Decrypt the message, given derived key and initialization vector. */223 mDecipher = Cipher.getInstance("AES/CBC/PKCS5Padding");224225 // Set the appropriate size for mInitVec by Generating a New One226 AlgorithmParameters params = mDecipher.getParameters();227228 mInitVec = params.getParameterSpec(IvParameterSpec.class).getIV();229230 // Read the old IV from the file to mInitVec now that size is set.231 inputStream.read(this.mInitVec);232 Db("mInitVec is :" + byteToHex(mInitVec));233 mDecipher.init(Cipher.DECRYPT_MODE, secret, new IvParameterSpec(mInitVec));234235 // creating a decoding stream from the FileInputStream above using the cipher created from setupDecrypt()236 cin = new CipherInputStream(inputStream, mDecipher);237238 while ((nread = cin.read(inbuf)) > 0) {239 Db("read " + nread + " bytes");240 totalread += nread;241242 // create a buffer to write with the exact number of bytes read. Otherwise a short read fills inbuf with 0x0243 byte[] trimbuf = new byte[nread];244245 for (int i = 0; i < nread; i++) {246 trimbuf[i] = inbuf[i];247 }248249 // write out the size-adjusted buffer250 outputStream.write(trimbuf);251 }252253 outputStream.flush();254 cin.close();255 inputStream.close();256 outputStream.close();257 Db("wrote " + totalread + " encrypted bytes");258 } catch (Exception ex) {259 Logger.getLogger(AES.class.getName()).log(Level.SEVERE, null, ex);260 }261 }262263 /**264 * adding main() for usage demonstration. With member vars, some of the locals would not be needed265 */266 public static void main(String[] args) {267268 // create the input.txt file in the current directory before continuing269 File input = new File("input.txt");270 File eoutput = new File("encrypted.aes");271 File doutput = new File("decrypted.txt");272 String iv = null;273 String salt = null;274 AES en = new AES("mypassword");275276 /*277 * write out encrypted file278 */279 try {280 en.WriteEncryptedFile(new FileInputStream(input), new FileOutputStream(eoutput));281 System.out.printf("File encrypted to " + eoutput.getName() + "\niv:" + iv + "\nsalt:" + salt + "\n\n");282 } catch (IllegalBlockSizeException | BadPaddingException | IOException e) {283 e.printStackTrace();284 }285286 /*287 * decrypt file288 */289 AES dc = new AES("mypassword");290291 /*292 * write out decrypted file293 */294 try {295 dc.ReadEncryptedFile(new FileInputStream(eoutput), new FileOutputStream(doutput));296 System.out.println("decryption finished to " + doutput.getName());297 } catch (IllegalBlockSizeException | BadPaddingException | IOException e) {298 e.printStackTrace();299 }300 }301}302
Full Screen
copy
1Security.setProperty("crypto.policy", "unlimited");2
Full Screen
copy
1String password = "mysupersecretpassword"; 2Key key = KeyFactory.AES.keyFromPassword(password.toCharArray());3Encryptor encryptor = new Encryptor(key, "AES/CBC/PKCS7Padding", 16);4
Full Screen

TestNG tutorial

TestNG is a Java-based open-source framework for test automation that includes various test types, such as unit testing, functional testing, E2E testing, etc. TestNG is in many ways similar to JUnit and NUnit. But in contrast to its competitors, its extensive features make it a lot more reliable framework. One of the major reasons for its popularity is its ability to structure tests and improve the scripts' readability and maintainability. Another reason can be the important characteristics like the convenience of using multiple annotations, reliance, and priority that make this framework popular among developers and testers for test design. You can refer to the TestNG tutorial to learn why you should choose the TestNG framework.

Chapters

  1. JUnit 5 vs. TestNG: Compare and explore the core differences between JUnit 5 and TestNG from the Selenium WebDriver viewpoint.
  2. Installing TestNG in Eclipse: Start installing the TestNG Plugin and learn how to set up TestNG in Eclipse to begin constructing a framework for your test project.
  3. Create TestNG Project in Eclipse: Get started with creating a TestNG project and write your first TestNG test script.
  4. Automation using TestNG: Dive into how to install TestNG in this Selenium TestNG tutorial, the fundamentals of developing an automation script for Selenium automation testing.
  5. Parallel Test Execution in TestNG: Here are some essential elements of parallel testing with TestNG in this Selenium TestNG tutorial.
  6. Creating TestNG XML File: Here is a step-by-step tutorial on creating a TestNG XML file to learn why and how it is created and discover how to run the TestNG XML file being executed in parallel.
  7. Automation with Selenium, Cucumber & TestNG: Explore for an in-depth tutorial on automation using Selenium, Cucumber, and TestNG, as TestNG offers simpler settings and more features.
  8. JUnit Selenium Tests using TestNG: Start running your regular and parallel tests by looking at how to run test cases in Selenium using JUnit and TestNG without having to rewrite the tests.
  9. Group Test Cases in TestNG: Along with the explanation and demonstration using relevant TestNG group examples, learn how to group test cases in TestNG.
  10. Prioritizing Tests in TestNG: Get started with how to prioritize test cases in TestNG for Selenium automation testing.
  11. Assertions in TestNG: Examine what TestNG assertions are, the various types of TestNG assertions, and situations that relate to Selenium automated testing.
  12. DataProviders in TestNG: Deep dive into learning more about TestNG's DataProvider and how to effectively use it in our test scripts for Selenium test automation.
  13. Parameterization in TestNG: Here are the several parameterization strategies used in TestNG tests and how to apply them in Selenium automation scripts.
  14. TestNG Listeners in Selenium WebDriver: Understand the various TestNG listeners to utilize them effectively for your next plan when working with TestNG and Selenium automation.
  15. TestNG Annotations: Learn more about the execution order and annotation attributes, and refer to the prerequisites required to set up TestNG.
  16. TestNG Reporter Log in Selenium: Find out how to use the TestNG Reporter Log and learn how to eliminate the need for external software with TestNG Reporter Class to boost productivity.
  17. TestNG Reports in Jenkins: Discover how to generate TestNG reports in Jenkins if you want to know how to create, install, and share TestNG reports in Jenkins.

Certification

You can push your abilities to do automated testing using TestNG and advance your career by earning a TestNG certification. Check out our TestNG certification.

YouTube

Watch this complete tutorial to learn how you can leverage the capabilities of the TestNG framework for Selenium automation testing.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful