Fix the naming conventions of the logs

This commit is contained in:
Burak Kaygusuz
2021-04-17 09:18:43 +03:00
parent 530bec0963
commit de5460fdca
3 changed files with 16 additions and 16 deletions

View File

@@ -13,18 +13,18 @@ import java.util.List;
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class DriverBase {
private static final Logger logger = LogManager.getLogger(DriverBase.class.getName());
private static final Logger LOGGER = LogManager.getLogger(DriverBase.class.getName());
private static final List<DriverFactory> threadPool = Collections.synchronizedList(new ArrayList<>());
private static ThreadLocal<DriverFactory> driverThread;
@BeforeAll
public void instantiateDriverObject() {
logger.info(String.format("Operating System : %s", System.getProperty("os.name").toUpperCase()));
logger.info(String.format("Version : %s", System.getProperty("os.version")));
logger.info(String.format("Arch : %s", System.getProperty("os.arch")));
logger.info(String.format("Grid URL : %s", DriverFactory.HUB_URL));
logger.info(String.format("Tests running on %d cores...)", Runtime.getRuntime().availableProcessors()));
LOGGER.info(String.format("Operating System : %s", System.getProperty("os.name").toUpperCase()));
LOGGER.info(String.format("Version : %s", System.getProperty("os.version")));
LOGGER.info(String.format("Arch : %s", System.getProperty("os.arch")));
LOGGER.info(String.format("Grid URL : %s", DriverFactory.HUB_URL));
LOGGER.info(String.format("Tests running on %d cores...)", Runtime.getRuntime().availableProcessors()));
driverThread = ThreadLocal.withInitial(() -> {
DriverFactory factory = new DriverFactory();
@@ -35,12 +35,12 @@ public class DriverBase {
@BeforeEach
public void beforeEach(TestInfo testInfo) {
logger.info(String.format("Test: %s started", testInfo.getDisplayName()));
LOGGER.info(String.format("Test: %s started", testInfo.getDisplayName()));
}
@AfterEach
public void afterEach(TestInfo testInfo) {
logger.info(String.format("Test: %s finished", testInfo.getDisplayName()));
LOGGER.info(String.format("Test: %s finished", testInfo.getDisplayName()));
}
@AfterAll

View File

@@ -14,7 +14,7 @@ import static com.burakkaygusuz.config.DriverType.*;
public class DriverFactory {
private static final Logger logger = LogManager.getLogger(DriverFactory.class.getName());
private static final Logger LOGGER = LogManager.getLogger(DriverFactory.class.getName());
private RemoteWebDriver driver;
protected static final String HUB_URL = getHubUrl();
@@ -35,12 +35,12 @@ public class DriverFactory {
throw new IllegalStateException(String.format("An unexpected driver has been attempted to init: \n %s", browser));
}
} catch (Exception e) {
logger.error(String.format("An unexpected error has occurred: \n %s", ExceptionUtils.getMessage(e)));
LOGGER.error(String.format("An unexpected error has occurred: \n %s", ExceptionUtils.getMessage(e)));
}
}
logger.info(String.format("Browser : %s", driver.getCapabilities().getBrowserName()));
logger.info(String.format("Version : %s", driver.getCapabilities().getBrowserVersion()));
LOGGER.info(String.format("Browser : %s", driver.getCapabilities().getBrowserName()));
LOGGER.info(String.format("Version : %s", driver.getCapabilities().getBrowserVersion()));
return driver;
}
@@ -58,7 +58,7 @@ public class DriverFactory {
Scanner scanner = new Scanner(inputStream).useDelimiter("\\A")) {
hubUrl = scanner.hasNext() ? scanner.next() : null;
} catch (IOException e) {
logger.error("An error occurred while getting the URL value: \n %s", e.getMessage());
LOGGER.error("An error occurred while getting the URL value: \n %s", e.getMessage());
}
return hubUrl;
}

View File

@@ -11,7 +11,7 @@ import org.openqa.selenium.support.ui.Select;
public class HomePage {
private static final Logger logger = LogManager.getLogger(HomePage.class.getName());
private static final Logger LOGGER = LogManager.getLogger(HomePage.class.getName());
@FindBy(id = "searchInput")
private WebElement searchInput;
@@ -30,14 +30,14 @@ public class HomePage {
private HomePage selectLanguage() {
Select dropdownList = new Select(selectLanguage);
dropdownList.selectByVisibleText("English");
logger.info(String.format("The English language was selected"));
LOGGER.info(String.format("The English language was selected"));
return this;
}
private HomePage searchTheItem() {
searchInput.clear();
searchInput.sendKeys("Selenium (software)" + Keys.ENTER);
logger.info(String.format("'Selenium (software)' was written in %s input", searchInput.getAttribute("name")));
LOGGER.info(String.format("'Selenium (software)' was written in %s input", searchInput.getAttribute("name")));
return this;
}