Skip to content

WebFixture can now read external browserSetup files#83

Open
kbayraktar wants to merge 2 commits intomasterfrom
feature/externalizeBrowserSetup
Open

WebFixture can now read external browserSetup files#83
kbayraktar wants to merge 2 commits intomasterfrom
feature/externalizeBrowserSetup

Conversation

@kbayraktar
Copy link
Member

No description provided.

// First try to resolve the file through environment variable
result = getResourceOverEnvironmentVariable(browserSetupFilePath);
if (StringUtils.isNotBlank(result)) {
logger.debug("Browser capabilities read from file : {}", browserSetupFilePath);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be trace

result = CharStreams.toString(new InputStreamReader(inputStream, StandardCharsets.UTF_8));

} catch (IOException e) {
logger.info("The file with the name {} can not be read in the resource folder."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trace and then (re)throw the exception. the caller should then wrap this in a fixture exception

// throw new FixtureException("file could not be found in resource folder",
// FixtureException.keyValues("fileName", fileName));
} catch (NullPointerException e) {
logger.error("The file with the name {} can not be found in the resource folder.", fileName);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trace and then (re)throw the exception. the caller should then wrap this in a fixture exception

/**
* For reading content of a JSON-File where the path is defined through the environment variable
* <code>TEST_EDITOR_BROWSER_SETUP_PATH</code>.<br>
* Usage under Linux : Set TEST_EDITOR_BROWSER_SETUP_PATH=~/your_prefered_folder/fileName.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no set, rather export

if (StringUtils.isNotBlank(path)) {
fileContent = FileUtils.readFileToString(new File(path), StandardCharsets.UTF_8);
} else {
logger.debug("Can not find environment variable '{}' with path entry for browser "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trace


}

private void getBrowserSetupFile() throws FixtureException, IOException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

split test in two parts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants