NPE in sauce_testng's SauceOnDemandTestListener when running locally.
I want to add a configuration option to execute local test runs by re-using SauceOnDemandTestListener::SELENIUM_IS_LOCAL variable, which skips initialization of sauceRest when the runtime property variable is set to true.
SauceOnDemandTestListener's onTestStart and onTestFailure both have null checks prior to de-referencing SauceOnDemandSessionIdProvider::getSessionId, but onTestSuccess does not.
This leads to NPEs with the following stack trace, one for each successful test:
SauceOnDemandSessionID=null job-name=testThree
java.lang.NullPointerException
at com.saucelabs.testng.SauceOnDemandTestListener.markJobStatus(SauceOnDemandTestListener.java:115)
at com.saucelabs.testng.SauceOnDemandTestListener.onTestSuccess(SauceOnDemandTestListener.java:142)
at org.testng.internal.TestListenerHelper.runTestListeners(TestListenerHelper.java:70)
at org.testng.internal.Invoker.runTestListeners(Invoker.java:1379)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:624)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:707)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:979)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
SauceOnDemandTestListener::onTestSuccess should have null checks, or perhaps better yet, skip their RPCs if isLocal property is true.
I'm running on this issue as well on sauce_testng 2.1.25. Any updates?