Skip to content

Commit

Permalink
better logging and bumped version to 14.0.1 (#1105)
Browse files Browse the repository at this point in the history
  • Loading branch information
anandbagmar committed Oct 17, 2023
1 parent 90ade75 commit 75109e3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.saikrishna321</groupId>
<artifactId>AppiumTestDistribution</artifactId>
<version>14.0.0</version>
<version>14.0.1</version>
<packaging>jar</packaging>
<name>AppiumTestDistribution</name>
<description>A tool run Android and iOS test in parallel across devices</description>
Expand Down
22 changes: 14 additions & 8 deletions src/main/java/com/appium/manager/AppiumDriverManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import org.openqa.selenium.remote.DesiredCapabilities;

import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.stream.Collectors;

import static com.appium.manager.AppiumDeviceManager.getMobilePlatform;
import static com.appium.utils.ConfigFileManager.CAPS;
Expand All @@ -30,17 +30,23 @@ public static AppiumDriver getDriver() {
}

protected static void setDriver(AppiumDriver driver) {
LOGGER.info("AppiumDriverManager: Created AppiumDriver with capabilities: ");
Capabilities capabilities = driver.getCapabilities();
capabilities.getCapabilityNames().forEach(key -> LOGGER.info("\t" + key
+ ":: " + capabilities.getCapability(key)));
String allCapabilities = driver.getCapabilities().getCapabilityNames().stream()
.map(key -> String.format("%n\t%s:: %s", key,
driver.getCapabilities().getCapability(key)))
.collect(Collectors.joining(""));
LOGGER.info(String.format("AppiumDriverManager: Created AppiumDriver with capabilities: %s",
allCapabilities));
appiumDriver.set(driver);
}

private AppiumDriver initialiseDriver(DesiredCapabilities desiredCapabilities) {
LOGGER.info("Initialise Driver with Capabilities: ");
desiredCapabilities.getCapabilityNames().forEach(key -> LOGGER.info("\t" + key
+ ":: " + desiredCapabilities.getCapability(key)));
String allCapabilities = desiredCapabilities.getCapabilityNames().stream()
.map(key -> String.format("%n\t%s:: %s", key,
desiredCapabilities.getCapability(key)))
.collect(Collectors.joining(""));

LOGGER.info(String.format("Initialise Driver with Capabilities: %s",
allCapabilities));
AppiumServerManager appiumServerManager = new AppiumServerManager();
String remoteWDHubIP = appiumServerManager.getRemoteWDHubIP();
return createAppiumDriver(desiredCapabilities, remoteWDHubIP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class CucumberScenarioListener implements ConcurrentEventListener {
private Map<String, Integer> scenarioRunCounts = new HashMap<String, Integer>();

public CucumberScenarioListener() throws Exception {
LOGGER.info(String.format("ThreadID: %d: CucumberScenarioListener\n",
LOGGER.info(String.format("ThreadID: %d: CucumberScenarioListener%n",
Thread.currentThread().getId()));
new ATDRunner();
appiumServerManager = new AppiumServerManager();
Expand Down Expand Up @@ -71,7 +71,7 @@ public void setEventPublisher(EventPublisher eventPublisher) {

private void runStartedHandler(TestRunStarted event) {
LOGGER.info("runStartedHandler");
LOGGER.info(String.format("ThreadID: %d: beforeSuite: \n",
LOGGER.info(String.format("ThreadID: %d: beforeSuite: %n",
Thread.currentThread().getId()));
}

Expand All @@ -98,7 +98,7 @@ private void caseStartedHandler(TestCaseStarted event) {
Integer scenarioRunCount = getScenarioRunCount(scenarioName);
String normalisedScenarioName = normaliseScenarioName(scenarioName);
LOGGER.info(
String.format("ThreadID: %d: beforeScenario: for scenario: %s\n",
String.format("ThreadID: %d: beforeScenario: for scenario: %s%n",
Thread.currentThread().getId(), scenarioName));
String scenarioReportDirectory = FileLocations.REPORTS_DIRECTORY
+ normalisedScenarioName + File.separator;
Expand Down Expand Up @@ -189,7 +189,7 @@ private void caseFinishedHandler(TestCaseFinished event) {
LOGGER.info("caseFinishedHandler Name: " + scenarioName);
long threadId = Thread.currentThread().getId();
LOGGER.info(
String.format("ThreadID: %d: afterScenario: for scenario: %s\n",
String.format("ThreadID: %d: afterScenario: for scenario: %s%n",
threadId, event.getTestCase().toString()));

TestExecutionContext testExecutionContext =
Expand Down

0 comments on commit 75109e3

Please sign in to comment.