tvarchive / optimusTemplate

This is a cucumber jvm implementation template using the optimus mobile automation framework. If you like it, star it, help spread the word.
http://docs.testvagrant.com
66 stars 23 forks source link

NullPointerException on ReportParser.getDeviceName #8

Closed ochubey closed 6 years ago

ochubey commented 6 years ago

After successful execution of simple test on real device NullPointerException happens when distributionReport tries to parse JSON with getDeviceName() method:

What went wrong: Execution failed for task ':distributionReport'. java.lang.NullPointerException (no error message)

Please see gist with stack trace of the error: https://gist.github.com/ochubey/2f414d91e4ecdadfc5ef76d98a869c85#file-gistfile1-txt

TestFeed configuration file: https://gist.github.com/ochubey/d1a3f72064bdd19a9197d7bad27dbb0f#file-iphonedevicese-json

Same issue when using Android device and or simulators/emulators

Versions used:

java 1.8.0_131 optimus-cli 1.4.4 "gradle.plugin.com.testvagrant.optimus:OptimusGradle:2.1" 'com.testvagrant:optimus:2.+' 'com.testvagrant.stepdefs:stepdefs:1.+'

KrishnB commented 6 years ago

@ochubey does this issue occur for FragmentationTask as well?

ochubey commented 6 years ago

Confirmed. The issue is also reproducible with FragmentationTask. Not sure what can be the reason of this, but cucumber report in JSON doesn't have required field output in the last step of the scenario: https://gist.github.com/ochubey/20436182c8507e548d188ff073499e55#file-startscreen2-feature-json

ochubey commented 6 years ago

Mystery solved :) While experimenting I've moved controller.deRegisterSmartBOTs(smartBOTs); within the if (scenario.isFailed()) in @After method. Small suggestion - check on null when trying to read output JSON value with for example following message "make sure to deregister smart bots in tear down method" in order to help someone like ME to not report unneeded issues :).

sukesh15 commented 6 years ago

Sure, we will take care of that.