@@ -40,16 +40,17 @@ public static AppiumDriver getDriver() {
4040 protected static void setDriver (AppiumDriver driver ) {
4141 LOGGER .info ("AppiumDriverManager: Created AppiumDriver with capabilities: " );
4242 Capabilities capabilities = driver .getCapabilities ();
43- capabilities .getCapabilityNames ().forEach (key -> {
44- LOGGER .info ("\t " + key + ":: " + capabilities .getCapability (key ));
45- });
43+ capabilities .getCapabilityNames ().forEach (
44+ key -> LOGGER .info ("\t " + key + ":: " + capabilities .getCapability (key )));
4645 appiumDriver .set (driver );
4746 }
4847
4948
5049 private AppiumDriver <MobileElement > initialiseDriver (DesiredCapabilities desiredCapabilities )
5150 throws Exception {
52- LOGGER .info ("Initialise Driver with Capabilities: " + desiredCapabilities .toString ());
51+ LOGGER .info ("Initialise Driver with Capabilities: " );
52+ desiredCapabilities .getCapabilityNames ().forEach (
53+ key -> LOGGER .info ("\t " + key + ":: " + desiredCapabilities .getCapability (key )));
5354 String remoteWDHubIP = getRemoteWDHubIP ();
5455 return createAppiumDriver (desiredCapabilities , remoteWDHubIP );
5556 }
@@ -79,9 +80,8 @@ private AppiumDriver createAppiumDriver(DesiredCapabilities desiredCapabilities,
7980 }
8081 LOGGER .info ("Session Created for "
8182 + AppiumDeviceManager .getMobilePlatform ().name ()
82- + " ---- "
83- + currentDriverSession .getSessionId () + "---"
84- + currentDriverSession .getSessionDetail ("udid" ));
83+ + "\n \t Session Id: " + currentDriverSession .getSessionId ()
84+ + "\n \t UDID: " + currentDriverSession .getSessionDetail ("udid" ));
8585 return currentDriverSession ;
8686 }
8787
@@ -95,7 +95,8 @@ private String getRemoteWDHubIP() throws Exception {
9595 private AppiumDriver <MobileElement > startAppiumDriverInstance (
9696 Optional <DesiredCapabilities > desiredCapabilities )
9797 throws Exception {
98- System .out .println ("inside ATD:beforeInvocation" );
98+ LOGGER .info ("startAppiumDriverInstance" );
99+ System .out .println ("inside ATD:beforeInvocation" );
99100 LOGGER .info ("startAppiumDriverInstance: capabilities: " + desiredCapabilities );
100101 AppiumDriver <MobileElement > currentDriverSession =
101102 initialiseDriver (desiredCapabilities .get ());
@@ -104,13 +105,16 @@ private AppiumDriver<MobileElement> startAppiumDriverInstance(
104105 }
105106
106107 // Should be used by Cucumber as well
107- public AppiumDriver <MobileElement > startAppiumDriverInstance () throws Exception {
108+ public AppiumDriver <MobileElement > startAppiumDriverInstance (String testMethodName )
109+ throws Exception {
108110 LOGGER .info ("startAppiumDriverInstance" );
109- System .out .println ("inside startAppiumDriverInstance" );
110- return startAppiumDriverInstance (Optional .ofNullable (buildDesiredCapabilities (CAPS .get ())));
111+ System .out .println ("inside startAppiumDriverInstance" );
112+ return startAppiumDriverInstance (
113+ Optional .ofNullable (buildDesiredCapabilities (testMethodName , CAPS .get ())));
111114 }
112115
113- private DesiredCapabilities buildDesiredCapabilities (String capabilityFilePath )
116+ private DesiredCapabilities buildDesiredCapabilities (String testMethodName ,
117+ String capabilityFilePath )
114118 throws Exception {
115119 String absolutePathToCapabilities = capabilityFilePath ;
116120 if (new File (capabilityFilePath ).exists ()) {
@@ -120,7 +124,7 @@ private DesiredCapabilities buildDesiredCapabilities(String capabilityFilePath)
120124 .toAbsolutePath ().toString ();
121125 }
122126 desiredCapabilityBuilder
123- .buildDesiredCapability (absolutePathToCapabilities );
127+ .buildDesiredCapability (testMethodName , absolutePathToCapabilities );
124128 return DesiredCapabilityBuilder .getDesiredCapability ();
125129 } else {
126130 throw new RuntimeException ("Capability file not found" );
0 commit comments