allWebdriver = instance.getAllWebdriver();
+ for (WebDriver wd : allWebdriver)
+ {
+ try
+ {
+ LOGGER.debug("Quit web driver: " + wd.toString());
+ wd.quit();
+ instance.removeWebDriver(wd);
+ }
+ catch (Exception e)
+ {
+ LOGGER.debug("Error on quitting web driver", e);
+ }
+ }
+ }
}
diff --git a/src/main/java/com/xceptance/neodymium/module/statement/browser/multibrowser/WebDriverCacheCleanupHook.java b/src/main/java/com/xceptance/neodymium/module/statement/browser/multibrowser/WebDriverCacheCleanupHook.java
index 0244e18d7..7e7a939ea 100644
--- a/src/main/java/com/xceptance/neodymium/module/statement/browser/multibrowser/WebDriverCacheCleanupHook.java
+++ b/src/main/java/com/xceptance/neodymium/module/statement/browser/multibrowser/WebDriverCacheCleanupHook.java
@@ -3,8 +3,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.xceptance.neodymium.module.statement.browser.BrowserStatement;
-
public class WebDriverCacheCleanupHook extends Thread
{
@@ -14,6 +12,6 @@ public class WebDriverCacheCleanupHook extends Thread
public void run()
{
LOGGER.debug("All tests finished. Quit cached browser");
- BrowserStatement.quitCachedBrowser();
+ WebDriverCache.quitCachedBrowsers();
}
}
diff --git a/src/main/java/com/xceptance/neodymium/module/statement/browser/multibrowser/configuration/BrowserConfigurationMapper.java b/src/main/java/com/xceptance/neodymium/module/statement/browser/multibrowser/configuration/BrowserConfigurationMapper.java
index f0fbb28e9..2171a06e8 100644
--- a/src/main/java/com/xceptance/neodymium/module/statement/browser/multibrowser/configuration/BrowserConfigurationMapper.java
+++ b/src/main/java/com/xceptance/neodymium/module/statement/browser/multibrowser/configuration/BrowserConfigurationMapper.java
@@ -29,6 +29,12 @@ public class BrowserConfigurationMapper
private static final String SCREEN_RESOLUTION = "screenResolution";
+ private static final String MAXIMUM_DURATION = "maxDuration";
+
+ private static final String IDLE_TIMEOUT = "idleTimeout";
+
+ private static final String SELENIUM_VERSION = "seleniumVersion";
+
private static final String BROWSER_RESOLUTION = "browserResolution";
private static final String CHROME_EMULATION_PROFILE = "chromeEmulationProfile";
@@ -110,7 +116,7 @@ else if ("opera".equals(emulatedBrowser))
}
/*
- * SauceLabs configuration
+ * SauceLabs/TestingBot configuration
*/
String emulatedPlatform = browserProfileConfiguration.get(PLATFORM);
if (!StringUtils.isEmpty(emulatedPlatform))
@@ -128,21 +134,67 @@ else if ("opera".equals(emulatedBrowser))
if (!StringUtils.isEmpty(emulatedDeviceName))
capabilities.setCapability("deviceName", emulatedDeviceName);
- String emulatedDeviceOrienation = browserProfileConfiguration.get(DEVICE_ORIENTATION);
- if (!StringUtils.isEmpty(emulatedDeviceOrienation))
- capabilities.setCapability("deviceOrientation", emulatedDeviceOrienation);
+ String emulatedDeviceOrientation = browserProfileConfiguration.get(DEVICE_ORIENTATION);
+ if (!StringUtils.isEmpty(emulatedDeviceOrientation))
+ capabilities.setCapability("deviceOrientation", emulatedDeviceOrientation);
String emulatedDeviceScreenResolution = browserProfileConfiguration.get(SCREEN_RESOLUTION);
if (!StringUtils.isEmpty(emulatedDeviceScreenResolution))
{
// SauceLabs
capabilities.setCapability("screenResolution", emulatedDeviceScreenResolution);
- // testingBot
+ // TestingBot
capabilities.setCapability("screen-resolution", emulatedDeviceScreenResolution);
}
- // appium
+ String emulatedMaximumTestDuration = browserProfileConfiguration.get(MAXIMUM_DURATION);
+ if (!StringUtils.isEmpty(emulatedMaximumTestDuration))
+ {
+ int maxDura = 0;
+ try
+ {
+ maxDura = Integer.parseInt(emulatedMaximumTestDuration);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(MAXIMUM_DURATION + " configured within the browser profiles couldn't be parsed into an int value. Given value: \""
+ + emulatedMaximumTestDuration + "\"", e);
+ }
+ // SauceLabs
+ capabilities.setCapability("maxDuration", maxDura);
+ // TestingBot
+ capabilities.setCapability("maxduration", maxDura);
+ }
+
+ String emulatedIdleTimeout = browserProfileConfiguration.get(IDLE_TIMEOUT);
+ if (!StringUtils.isEmpty(emulatedIdleTimeout))
+ {
+ int idleTim = 0;
+ try
+ {
+ idleTim = Integer.parseInt(emulatedIdleTimeout);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(IDLE_TIMEOUT + " configured within the browser profiles couldn't be parsed into an int value. Given value: \""
+ + emulatedIdleTimeout + "\"", e);
+ }
+ // SauceLabs
+ capabilities.setCapability("idleTimeout", idleTim);
+ // TestingBot
+ capabilities.setCapability("idletimeout", idleTim);
+ }
+
+ String emulatedSeleniumVersion = browserProfileConfiguration.get(SELENIUM_VERSION);
+ if (!StringUtils.isEmpty(emulatedSeleniumVersion))
+ {
+ // SauceLabs
+ capabilities.setCapability("seleniumVersion", emulatedSeleniumVersion);
+ // TestingBot
+ capabilities.setCapability("selenium-version", emulatedSeleniumVersion);
+ }
+ // appium
String appiumVersion = browserProfileConfiguration.get(APPIUM_VERSION);
if (!StringUtils.isEmpty(appiumVersion))
capabilities.setCapability(APPIUM_VERSION, appiumVersion);
@@ -151,13 +203,13 @@ else if ("opera".equals(emulatedBrowser))
if (!StringUtils.isEmpty(browserName))
capabilities.setCapability(BROWSER_NAME, browserName);
- String plattformVersion = browserProfileConfiguration.get(PLATFORM_VERSION);
- if (!StringUtils.isEmpty(plattformVersion))
- capabilities.setCapability(PLATFORM_VERSION, plattformVersion);
+ String platformVersion = browserProfileConfiguration.get(PLATFORM_VERSION);
+ if (!StringUtils.isEmpty(platformVersion))
+ capabilities.setCapability(PLATFORM_VERSION, platformVersion);
- String plattformName = browserProfileConfiguration.get(PLATFORM_NAME);
- if (!StringUtils.isEmpty(plattformName))
- capabilities.setCapability(PLATFORM_NAME, plattformName);
+ String platformName = browserProfileConfiguration.get(PLATFORM_NAME);
+ if (!StringUtils.isEmpty(platformName))
+ capabilities.setCapability(PLATFORM_NAME, platformName);
String app = browserProfileConfiguration.get(APP);
if (!StringUtils.isEmpty(app))
@@ -167,9 +219,9 @@ else if ("opera".equals(emulatedBrowser))
if (!StringUtils.isEmpty(automationName))
capabilities.setCapability(AUTOMATION_NAME, automationName);
- String oriantation = browserProfileConfiguration.get(ORIENTATION);
- if (!StringUtils.isEmpty(oriantation))
- capabilities.setCapability(ORIENTATION, oriantation);
+ String orientation = browserProfileConfiguration.get(ORIENTATION);
+ if (!StringUtils.isEmpty(orientation))
+ capabilities.setCapability(ORIENTATION, orientation);
/*
* Chrome device emulation
diff --git a/src/main/java/com/xceptance/neodymium/module/statement/browser/multibrowser/configuration/TestEnvironment.java b/src/main/java/com/xceptance/neodymium/module/statement/browser/multibrowser/configuration/TestEnvironment.java
index 7dac37252..325c57dee 100644
--- a/src/main/java/com/xceptance/neodymium/module/statement/browser/multibrowser/configuration/TestEnvironment.java
+++ b/src/main/java/com/xceptance/neodymium/module/statement/browser/multibrowser/configuration/TestEnvironment.java
@@ -33,7 +33,7 @@ protected TestEnvironment(Properties properties, String baseKey)
proxyHost = properties.getProperty(baseKey + ".proxy.host");
if (StringUtils.isBlank(proxyHost))
{
- throw new RuntimeException("The proxy host configured for evironment: \"" + baseKey + "\" needs to be set.");
+ throw new RuntimeException("The proxy host configured for environment: \"" + baseKey + "\" needs to be set.");
}
String port = properties.getProperty(baseKey + ".proxy.port");
@@ -45,12 +45,12 @@ protected TestEnvironment(Properties properties, String baseKey)
}
catch (NumberFormatException e)
{
- throw new RuntimeException("The proxy port configured for evironment: \"" + baseKey + "\" needs to be an Integer.");
+ throw new RuntimeException("The proxy port configured for environment: \"" + baseKey + "\" needs to be an Integer.");
}
}
else
{
- throw new RuntimeException("The proxy port configured for evironment: \"" + baseKey + "\" needs to be set.");
+ throw new RuntimeException("The proxy port configured for environment: \"" + baseKey + "\" needs to be set.");
}
proxyUsername = properties.getProperty(baseKey + ".proxy.username");
proxyPassword = properties.getProperty(baseKey + ".proxy.password");
diff --git a/src/main/java/com/xceptance/neodymium/module/statement/parameter/ParameterStatement.java b/src/main/java/com/xceptance/neodymium/module/statement/parameter/ParameterStatement.java
index 70ffc7eff..bd81d2d82 100644
--- a/src/main/java/com/xceptance/neodymium/module/statement/parameter/ParameterStatement.java
+++ b/src/main/java/com/xceptance/neodymium/module/statement/parameter/ParameterStatement.java
@@ -182,7 +182,7 @@ else if (fieldType == boolean.class || fieldType == Boolean.class)
}
catch (Exception e)
{
- throw new RuntimeException("An error occured during conversion of input string \"" + (String) value + "\" to type " +
+ throw new RuntimeException("An error occurred during conversion of input string \"" + (String) value + "\" to type " +
fieldType.getName() + " for field \"" + field.getName() + "\"", e);
}
}
diff --git a/src/main/java/com/xceptance/neodymium/module/statement/testdata/DataFile.java b/src/main/java/com/xceptance/neodymium/module/statement/testdata/DataFile.java
new file mode 100644
index 000000000..9d38c5867
--- /dev/null
+++ b/src/main/java/com/xceptance/neodymium/module/statement/testdata/DataFile.java
@@ -0,0 +1,26 @@
+package com.xceptance.neodymium.module.statement.testdata;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation can be used to override the data sets file location. Usually, this file is expected to be named as
+ * the test case and to be located in the same package in the resource folder.
+ *
+ * The file referred to by this annotation needs to reside within the resource path. Provide the full path to the file
+ * relative to the resource folder, including the file extension.
+ *
+ * @author m.pfotenhauer
+ */
+@Retention(RUNTIME)
+@Target(
+{
+ TYPE
+})
+public @interface DataFile
+{
+ String value() default "";
+}
diff --git a/src/main/java/com/xceptance/neodymium/module/statement/testdata/DataSet.java b/src/main/java/com/xceptance/neodymium/module/statement/testdata/DataSet.java
index 5aa3752ab..bdeefb948 100644
--- a/src/main/java/com/xceptance/neodymium/module/statement/testdata/DataSet.java
+++ b/src/main/java/com/xceptance/neodymium/module/statement/testdata/DataSet.java
@@ -1,7 +1,8 @@
package com.xceptance.neodymium.module.statement.testdata;
-import static java.lang.annotation.ElementType.*;
-import static java.lang.annotation.RetentionPolicy.*;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
@@ -23,9 +24,9 @@
*/
@Retention(RUNTIME)
@Target(
- {
- TYPE, METHOD
- })
+{
+ TYPE, METHOD
+})
@Repeatable(DataSets.class)
public @interface DataSet
{
diff --git a/src/main/java/com/xceptance/neodymium/module/statement/testdata/TestdataStatement.java b/src/main/java/com/xceptance/neodymium/module/statement/testdata/TestdataStatement.java
index cab6fb9d7..929604a71 100644
--- a/src/main/java/com/xceptance/neodymium/module/statement/testdata/TestdataStatement.java
+++ b/src/main/java/com/xceptance/neodymium/module/statement/testdata/TestdataStatement.java
@@ -53,7 +53,6 @@ public TestdataStatement(Statement next, TestdataStatementData parameter)
testData.put(newDataEntry.getKey(), newDataEntry.getValue());
}
}
-
}
public TestdataStatement()
@@ -134,7 +133,7 @@ private List processDuplicates(List iterations)
{
// now the funny part, we encountered an duplicated object
- // always set the first occurance of an object to 1
+ // always set the first occurrence of an object to 1
TestdataStatementData existingObject = (TestdataStatementData) object;
existingObject.setIterationIndex(1);
diff --git a/src/main/java/com/xceptance/neodymium/module/statement/testdata/util/TestDataUtils.java b/src/main/java/com/xceptance/neodymium/module/statement/testdata/util/TestDataUtils.java
index 7ee41bbcb..38856d6dc 100644
--- a/src/main/java/com/xceptance/neodymium/module/statement/testdata/util/TestDataUtils.java
+++ b/src/main/java/com/xceptance/neodymium/module/statement/testdata/util/TestDataUtils.java
@@ -24,6 +24,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.xceptance.neodymium.module.statement.testdata.DataFile;
+
/**
* Utility class for test data handling.
*
@@ -52,17 +54,36 @@ public static List> getDataSets(final Class> testClass) th
// no specific file -> try the usual suspects
final Set fileNames = new LinkedHashSet();
- final String dottedName = testClass.getName();
- final String slashedName = dottedName.replace('.', '/');
+ DataFile dataFile = testClass.getAnnotation(DataFile.class);
+ String filePath = dataFile != null ? dataFile.value() : null;
+
+ if (StringUtils.isBlank(filePath))
+ {
+ final String dottedName = testClass.getName();
+ final String slashedName = dottedName.replace('.', '/');
- String[] filetype = new String[]
+ String[] filetype = new String[]
{
- ".csv", ".json", ".xml"
+ ".csv", ".json", ".xml"
};
- for (final String fileExtension : filetype)
+ for (final String fileExtension : filetype)
+ {
+ fileNames.add(slashedName + fileExtension);
+ fileNames.add(dottedName + fileExtension);
+ }
+ }
+ else
{
- fileNames.add(slashedName + fileExtension);
- fileNames.add(dottedName + fileExtension);
+ InputStream inputStream = testClass.getResourceAsStream("/" + filePath);
+ if (inputStream != null)
+ {
+ fileNames.add(filePath);
+ }
+ else
+ {
+ throw new RuntimeException("The data file:\"" + filePath + "\" provided within the test class:\"" + testClass.getSimpleName()
+ + "\" can't be read.");
+ }
}
List dataSetFileDirs = new LinkedList<>();
diff --git a/src/main/java/com/xceptance/neodymium/util/Neodymium.java b/src/main/java/com/xceptance/neodymium/util/Neodymium.java
index 5e54ecbab..05f923424 100644
--- a/src/main/java/com/xceptance/neodymium/util/Neodymium.java
+++ b/src/main/java/com/xceptance/neodymium/util/Neodymium.java
@@ -40,7 +40,7 @@ public class Neodymium
// our data for anywhere access
private final Map data = new HashMap<>();
- public final static String TEMPORARY_CONFIG_FILE_PROPTERY_NAME = "neodymium.temporaryConfigFile";
+ public final static String TEMPORARY_CONFIG_FILE_PROPERTY_NAME = "neodymium.temporaryConfigFile";
/**
* Constructor
@@ -48,9 +48,9 @@ public class Neodymium
private Neodymium()
{
// the property needs to be a valid URI in order to satisfy the Owner framework
- if (null == ConfigFactory.getProperty(TEMPORARY_CONFIG_FILE_PROPTERY_NAME))
+ if (null == ConfigFactory.getProperty(TEMPORARY_CONFIG_FILE_PROPERTY_NAME))
{
- ConfigFactory.setProperty(TEMPORARY_CONFIG_FILE_PROPTERY_NAME, "file:this/path/should/never/exist/noOneShouldCreateMe.properties");
+ ConfigFactory.setProperty(TEMPORARY_CONFIG_FILE_PROPERTY_NAME, "file:this/path/should/never/exist/noOneShouldCreateMe.properties");
}
configuration = ConfigFactory.create(NeodymiumConfiguration.class, System.getProperties(), System.getenv());
localization = NeodymiumLocalization.build(configuration.localizationFile());
@@ -279,7 +279,7 @@ public static boolean isTablet()
/**
* Desktop of any kind?
*
- * @return boolean value indicating whether it is a device desktop (isLargeDesktop() or isExtaLargeDesktop()) or not
+ * @return boolean value indicating whether it is a device desktop (isLargeDesktop() or isExtraLargeDesktop()) or not
* @see Neodymium
*/
public static boolean isDesktop()
diff --git a/src/main/java/com/xceptance/neodymium/util/SelenideAddons.java b/src/main/java/com/xceptance/neodymium/util/SelenideAddons.java
index 09fcc0a31..2f5606da8 100644
--- a/src/main/java/com/xceptance/neodymium/util/SelenideAddons.java
+++ b/src/main/java/com/xceptance/neodymium/util/SelenideAddons.java
@@ -4,6 +4,7 @@
import java.util.function.Supplier;
import java.util.stream.Collectors;
+import org.apache.commons.lang3.StringUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.StaleElementReferenceException;
import org.openqa.selenium.WebElement;
@@ -266,10 +267,21 @@ public static void wrapAssertionError(final Runnable runnable)
catch (AssertionError e)
{
Driver driver = WebDriverRunner.driver();
- SelenideLogger.commitStep(new SelenideLog("Assertion error", e.getMessage()), e);
+ String message = "No error message provided by the Assertion.";
+ if (StringUtils.isNotBlank(e.getMessage()))
+ {
+ message = e.getMessage();
+ }
+ else
+ {
+ AssertionError wrapper = new AssertionError(message, e.getCause());
+ wrapper.setStackTrace(e.getStackTrace());
+ e = wrapper;
+ }
+ SelenideLogger.commitStep(new SelenideLog("Assertion error", message), e);
if (!driver.config().assertionMode().equals(AssertionMode.SOFT))
{
- throw UIAssertionError.wrap(driver, e, System.currentTimeMillis());
+ throw UIAssertionError.wrap(driver, e, 0);
}
}
}
diff --git a/src/main/java/com/xceptance/neodymium/util/WebDriverUtils.java b/src/main/java/com/xceptance/neodymium/util/WebDriverUtils.java
index 54544a971..4fbe18662 100644
--- a/src/main/java/com/xceptance/neodymium/util/WebDriverUtils.java
+++ b/src/main/java/com/xceptance/neodymium/util/WebDriverUtils.java
@@ -7,8 +7,9 @@
import org.apache.commons.lang3.StringUtils;
import com.xceptance.neodymium.module.statement.browser.BrowserStatement;
+import com.xceptance.neodymium.module.statement.browser.multibrowser.WebDriverCache;
-import cucumber.api.Scenario;
+import io.cucumber.core.api.Scenario;
public class WebDriverUtils
{
@@ -61,6 +62,26 @@ public static void setUpWithBrowserTag(Scenario scenario)
browserStatement.get().setUpTest(browserProfileName);
}
+ /**
+ * This function can be used within a function of a JUnit test case that is annotated with @After to prevent the
+ * reuse of the current WebDriver
+ *
+ *
+ * @After
+ * public void after()
+ * {
+ * if (someConditionIsFulfilled)
+ * {
+ * WebDriverUtils.preventReuseAndTearDown();
+ * }
+ * }
+ *
+ **/
+ public static void preventReuseAndTearDown()
+ {
+ browserStatement.get().teardown(false, true, Neodymium.getDriver());
+ }
+
/**
* @param scenario
* Scenario is a Cucumber API class that can be gathered in hooks via dependency injection
@@ -87,6 +108,26 @@ public static void tearDown(boolean isFailed)
browserStatement.get().teardown(isFailed);
}
+ /**
+ * This function can be used within a function of a JUnit test case that is annotated with @AfterClass to clear the
+ * WebDriverCache of the WebDrivers ready for reuse.
+ *
+ * Attention: It is save to run this function during a sequential test execution. It can have repercussions
+ * (e.g. longer test duration) in a parallel execution environment.
+ *
+ *
+ * @AfterClass
+ * public void afterClass()
+ * {
+ * WebDriverUtils.quitReusableCachedBrowsers();
+ * }
+ *
+ **/
+ public static void quitReusableCachedBrowsers()
+ {
+ WebDriverCache.quitCachedBrowsers();
+ }
+
static String getFirstMatchingBrowserTag(Scenario scenario)
{
Collection scenarioTags = scenario.getSourceTagNames();
diff --git a/src/main/java/com/xceptance/neodymium/util/YamlProperties.java b/src/main/java/com/xceptance/neodymium/util/YamlProperties.java
index d3f28a214..a0f3a59fd 100644
--- a/src/main/java/com/xceptance/neodymium/util/YamlProperties.java
+++ b/src/main/java/com/xceptance/neodymium/util/YamlProperties.java
@@ -61,7 +61,7 @@ private String buildKey(final Deque state)
* @param entry
* the entry
* @param state
- * the current staate of the stack
+ * the current state of the stack
*/
private void handleTypes(final Object entry, final Deque state)
{
diff --git a/src/main/java/com/xceptance/neodymium/visual/ai/AI.java b/src/main/java/com/xceptance/neodymium/visual/ai/AI.java
index b8e889310..942a75dee 100644
--- a/src/main/java/com/xceptance/neodymium/visual/ai/AI.java
+++ b/src/main/java/com/xceptance/neodymium/visual/ai/AI.java
@@ -227,7 +227,7 @@ public void execute(final WebDriver webdriver, String testCaseName, String actio
Assert.assertNotNull("Screenshot couldn't be taken by the WebDriver", screenshot);
// if the network is not done with training check the training folder for changes
- // if there are changes, all unknwon images get loaded
+ // if there are changes, all unknown images get loaded
imgList.add(screenshot);
if (Constants.NETWORK_MODE)
{
diff --git a/src/main/java/com/xceptance/neodymium/visual/ai/NetworkTrainer.java b/src/main/java/com/xceptance/neodymium/visual/ai/NetworkTrainer.java
index 7bd9b9a9c..26e6841b8 100644
--- a/src/main/java/com/xceptance/neodymium/visual/ai/NetworkTrainer.java
+++ b/src/main/java/com/xceptance/neodymium/visual/ai/NetworkTrainer.java
@@ -105,7 +105,7 @@ public static void main(String[] args)
PerceptronLearning pl = new PerceptronLearning(an);
pl.setLearningRate(Constants.LEARNING_RATE);
- double resultVerfication = 0.0;
+ double resultVerification = 0.0;
for (PatternHelper pattern : patternList)
{
pl.run(pattern.getPatternList());
@@ -113,11 +113,11 @@ public static void main(String[] args)
for (PatternHelper pattern : patternList)
{
- resultVerfication += an.checkForRecognitionAsDouble(pattern.getPatternList());
+ resultVerification += an.checkForRecognitionAsDouble(pattern.getPatternList());
System.out.println("Recognized value of image " + pattern.getTagName() + " = " + an.checkForRecognitionAsString(pattern.getPatternList()) + " %");
}
- System.out.println("Selftest value summed: " + (resultVerfication / patternList.size()));
+ System.out.println("Selftest value summed: " + (resultVerification / patternList.size()));
an.setInternalParameter(im.getAverageMetric());
an.Save(networkFile.toString());
diff --git a/src/main/java/com/xceptance/neodymium/visual/ai/core/FloatRange.java b/src/main/java/com/xceptance/neodymium/visual/ai/core/FloatRange.java
index ac06c38f5..137947f2b 100644
--- a/src/main/java/com/xceptance/neodymium/visual/ai/core/FloatRange.java
+++ b/src/main/java/com/xceptance/neodymium/visual/ai/core/FloatRange.java
@@ -46,7 +46,7 @@
public class FloatRange implements Serializable
{
/**
- * Auto genreated serial number.
+ * Auto generated serial number.
*/
private static final long serialVersionUID = 1L;
@@ -186,4 +186,4 @@ public String toString()
* Maximum Value.
*/
private float max;
-}
\ No newline at end of file
+}
diff --git a/src/main/java/com/xceptance/neodymium/visual/ai/corner/Fast9.java b/src/main/java/com/xceptance/neodymium/visual/ai/corner/Fast9.java
index 6760c6ef8..c82989208 100644
--- a/src/main/java/com/xceptance/neodymium/visual/ai/corner/Fast9.java
+++ b/src/main/java/com/xceptance/neodymium/visual/ai/corner/Fast9.java
@@ -140,7 +140,7 @@ public Fast9(int threshold)
* @param threshold
* Threshold.
* @param suppress
- * Supress.
+ * Suppress.
*/
public Fast9(int threshold, boolean suppress)
{
diff --git a/src/main/java/com/xceptance/neodymium/visual/ai/corner/FastCornersDetector.java b/src/main/java/com/xceptance/neodymium/visual/ai/corner/FastCornersDetector.java
index 8c2478ce3..d76bde07d 100644
--- a/src/main/java/com/xceptance/neodymium/visual/ai/corner/FastCornersDetector.java
+++ b/src/main/java/com/xceptance/neodymium/visual/ai/corner/FastCornersDetector.java
@@ -152,7 +152,7 @@ public FastCornersDetector(Algorithm algorithm)
* @param threshold
* Threshold.
* @param suppress
- * Supress.
+ * Suppress.
*/
public FastCornersDetector(int threshold, boolean suppress)
{
@@ -166,7 +166,7 @@ public FastCornersDetector(int threshold, boolean suppress)
* @param threshold
* Threshold.
* @param suppress
- * Supress.
+ * Suppress.
* @param algorithm
* Algorithm.
*/
diff --git a/src/main/java/com/xceptance/neodymium/visual/ai/image/FastBitmap.java b/src/main/java/com/xceptance/neodymium/visual/ai/image/FastBitmap.java
index 8770f7abc..5cc14761d 100644
--- a/src/main/java/com/xceptance/neodymium/visual/ai/image/FastBitmap.java
+++ b/src/main/java/com/xceptance/neodymium/visual/ai/image/FastBitmap.java
@@ -60,7 +60,7 @@
public class FastBitmap
{
/**
- * Coodinate system.
+ * Coordinate system.
*/
public static enum CoordinateSystem
{
diff --git a/src/main/java/com/xceptance/neodymium/visual/ai/image/HistogramStatistics.java b/src/main/java/com/xceptance/neodymium/visual/ai/image/HistogramStatistics.java
index 1465fd3f8..38c8e601d 100644
--- a/src/main/java/com/xceptance/neodymium/visual/ai/image/HistogramStatistics.java
+++ b/src/main/java/com/xceptance/neodymium/visual/ai/image/HistogramStatistics.java
@@ -96,7 +96,7 @@ public static double Entropy(int[] values)
* Values.
* @param percent
* Values percentage around median.
- * @return Returns the range which containes specifies percentage of values.
+ * @return Returns the range which contains specified percentage of values.
*/
public static IntRange GetRange(int[] values, double percent)
{
diff --git a/src/main/java/com/xceptance/neodymium/visual/ai/machine_learning/Network.java b/src/main/java/com/xceptance/neodymium/visual/ai/machine_learning/Network.java
index cf90425ef..67cb6c780 100644
--- a/src/main/java/com/xceptance/neodymium/visual/ai/machine_learning/Network.java
+++ b/src/main/java/com/xceptance/neodymium/visual/ai/machine_learning/Network.java
@@ -114,7 +114,7 @@ public Layer getLayer()
/**
* Get Network's output vector.
- *
+ *
* @return Network's output vector.
*/
public ArrayList getOutput()
@@ -218,11 +218,11 @@ public boolean onSelfTest(ArrayList validationList, Boolean flag)
if (flag)
{
// compute the summed value for already seen pattern
- double resultVerfication = 0.0;
+ double resultVerification = 0.0;
for (PatternHelper element : internalList)
{
- resultVerfication += layer.computeSum(element.getPatternList());
+ resultVerification += layer.computeSum(element.getPatternList());
}
// compute the summed value for counter examples
@@ -231,13 +231,13 @@ public boolean onSelfTest(ArrayList validationList, Boolean flag)
{
resultValidation += layer.computeSum(element.getPatternList());
}
- System.out.println("Selftest value training dir: " + (resultVerfication / internalList.size()));
+ System.out.println("Selftest value training dir: " + (resultVerification / internalList.size()));
System.out.println("Selftest value validation dir: " + (resultValidation / internalList.size()));
int validationSize = (validationList.size() != 0 ? validationList.size() : 1);
// check if the summed value for recognition is near the intended barrier
// and check if the summed counter example value is under the intended barrier
- if ((resultVerfication / internalList.size()) >= Constants.INTENDED_PERCENTAGE_MATCH &&
+ if ((resultVerification / internalList.size()) >= Constants.INTENDED_PERCENTAGE_MATCH &&
resultValidation / validationSize < Constants.INTENDED_PERCENTAGE_MATCH)
{
// disable self test for further use
diff --git a/src/main/java/com/xceptance/neodymium/visual/ai/machine_learning/Neuron.java b/src/main/java/com/xceptance/neodymium/visual/ai/machine_learning/Neuron.java
index a2c21de19..4d746c152 100644
--- a/src/main/java/com/xceptance/neodymium/visual/ai/machine_learning/Neuron.java
+++ b/src/main/java/com/xceptance/neodymium/visual/ai/machine_learning/Neuron.java
@@ -86,7 +86,7 @@ public class Neuron implements Serializable
/**
* Get the range.
*
- * @return range FloatRagne value
+ * @return range FloatRange value
*/
public static FloatRange getRange()
{
diff --git a/src/main/java/com/xceptance/neodymium/visual/ai/pre_processing/PreProcessing.java b/src/main/java/com/xceptance/neodymium/visual/ai/pre_processing/PreProcessing.java
index 662a70f46..d0c892672 100644
--- a/src/main/java/com/xceptance/neodymium/visual/ai/pre_processing/PreProcessing.java
+++ b/src/main/java/com/xceptance/neodymium/visual/ai/pre_processing/PreProcessing.java
@@ -158,7 +158,7 @@ private void findGroups(List edges, FastBitmap currentImage)
}
/**
- * Auto generatef serial number.
+ * Auto generated serial number.
*/
private static final long serialVersionUID = 1L;
diff --git a/src/main/java/com/xceptance/neodymium/visual/ai/util/Helper.java b/src/main/java/com/xceptance/neodymium/visual/ai/util/Helper.java
index 1aa57dc0f..5cf8a8298 100644
--- a/src/main/java/com/xceptance/neodymium/visual/ai/util/Helper.java
+++ b/src/main/java/com/xceptance/neodymium/visual/ai/util/Helper.java
@@ -202,7 +202,7 @@ public static void setImageParameter()
* Transform a given image to an BufferedImkage with with exact same width and height as the original.
*
* @param img
- * Image to transform into BuferedImage.
+ * Image to transform into BufferedImage.
* @param imageType
* Chosen int value of the target ImageType.
* @return bi BufferedImage
@@ -281,11 +281,11 @@ public static FastBitmap imageToFastImage(Image img, String tagName)
*/
public static BufferedImage ArrayToBufferedImage(double[][] array, int imageType)
{
- int xLenght = array.length;
+ int xLength = array.length;
int yLength = array[0].length;
- BufferedImage b = new BufferedImage(xLenght, yLength, imageType);
+ BufferedImage b = new BufferedImage(xLength, yLength, imageType);
- for (int x = 0; x < xLenght; x++)
+ for (int x = 0; x < xLength; x++)
{
for (int y = 0; y < yLength; y++)
{
@@ -480,13 +480,13 @@ public static ArrayList loadAllImagesScaled_FastBitmap(String path)
*
* @param path
* String full path name to the folder
- * @param heigth
+ * @param height
* int value for scaling
* @param width
* int value for scaling
* @return ArrayList all found BufferedImages in the folder
*/
- public static ArrayList loadAllImagesScaled_BufferedImage(String path, int heigth, int width)
+ public static ArrayList loadAllImagesScaled_BufferedImage(String path, int height, int width)
{
ArrayList pictureList = new ArrayList<>();
File[] list = scanFolder(path);
@@ -495,7 +495,7 @@ public static ArrayList loadAllImagesScaled_BufferedImage(String
for (File element : list)
{
BufferedImage tempimage = loadImage(path + File.separator + element.getName());
- pictureList.add(imageToBufferedImageScaled(tempimage, BufferedImage.TYPE_INT_RGB, heigth, width));
+ pictureList.add(imageToBufferedImageScaled(tempimage, BufferedImage.TYPE_INT_RGB, height, width));
}
}
return pictureList;
diff --git a/src/test/java/com/xceptance/neodymium/module/statement/browser/multibrowser/configuration/BadProxyEnvironmentConfiguration.java b/src/test/java/com/xceptance/neodymium/module/statement/browser/multibrowser/configuration/BadProxyEnvironmentConfiguration.java
index f60925ac3..1687436a0 100644
--- a/src/test/java/com/xceptance/neodymium/module/statement/browser/multibrowser/configuration/BadProxyEnvironmentConfiguration.java
+++ b/src/test/java/com/xceptance/neodymium/module/statement/browser/multibrowser/configuration/BadProxyEnvironmentConfiguration.java
@@ -20,7 +20,7 @@ public void testProxyWithoutHost()
}
catch (RuntimeException e)
{
- Assert.assertEquals("The proxy host configured for evironment: \"browserprofile.testEnvironment.badProxy\" needs to be set.", e.getMessage());
+ Assert.assertEquals("The proxy host configured for environment: \"browserprofile.testEnvironment.badProxy\" needs to be set.", e.getMessage());
}
}
@@ -36,7 +36,7 @@ public void testProxyWithoutPort()
}
catch (RuntimeException e)
{
- Assert.assertEquals("The proxy port configured for evironment: \"browserprofile.testEnvironment.badProxy\" needs to be set.", e.getMessage());
+ Assert.assertEquals("The proxy port configured for environment: \"browserprofile.testEnvironment.badProxy\" needs to be set.", e.getMessage());
}
}
@@ -53,7 +53,7 @@ public void testProxyWithCharacterPort()
}
catch (RuntimeException e)
{
- Assert.assertEquals("The proxy port configured for evironment: \"browserprofile.testEnvironment.badProxy\" needs to be an Integer.",
+ Assert.assertEquals("The proxy port configured for environment: \"browserprofile.testEnvironment.badProxy\" needs to be an Integer.",
e.getMessage());
}
}
diff --git a/src/test/java/com/xceptance/neodymium/testclasses/context/ContextGetsCleared.java b/src/test/java/com/xceptance/neodymium/testclasses/context/ContextGetsCleared.java
index 5b268a65f..4d92b311f 100644
--- a/src/test/java/com/xceptance/neodymium/testclasses/context/ContextGetsCleared.java
+++ b/src/test/java/com/xceptance/neodymium/testclasses/context/ContextGetsCleared.java
@@ -27,7 +27,7 @@ public void test1() throws Exception
@SuppressDataSets
public void test2() throws Exception
{
- // supressing data sets makes sure we dont
+ // suppressing data sets makes sure we don't
Assert.assertNull(Neodymium.dataValue("key1"));
}
}
diff --git a/src/test/java/com/xceptance/neodymium/testclasses/context/OverrideNeodymiumConfiguration.java b/src/test/java/com/xceptance/neodymium/testclasses/context/OverrideNeodymiumConfiguration.java
index f843cf892..a41c6747c 100644
--- a/src/test/java/com/xceptance/neodymium/testclasses/context/OverrideNeodymiumConfiguration.java
+++ b/src/test/java/com/xceptance/neodymium/testclasses/context/OverrideNeodymiumConfiguration.java
@@ -14,13 +14,13 @@
public class OverrideNeodymiumConfiguration
{
@Test
- public void testStandarConfigurationStillAvailable() throws Exception
+ public void testStandardConfigurationStillAvailable() throws Exception
{
Assert.assertEquals("/some/opera/path/just/for/test/purpose", Neodymium.configuration().getOperaDriverPath());
}
@Test
- public void testConfigurationContainsOveriddenParts() throws Exception
+ public void testConfigurationContainsOverriddenParts() throws Exception
{
Assert.assertEquals("/some/phantomjs/path/just/for/test/newPurpose", Neodymium.configuration().getPhantomJsDriverPath());
}
diff --git a/src/test/java/com/xceptance/neodymium/testclasses/context/cucumbercontextclear/CucumberContextGetsCleared.java b/src/test/java/com/xceptance/neodymium/testclasses/context/cucumbercontextclear/CucumberContextGetsCleared.java
index aadbcf492..18e249455 100644
--- a/src/test/java/com/xceptance/neodymium/testclasses/context/cucumbercontextclear/CucumberContextGetsCleared.java
+++ b/src/test/java/com/xceptance/neodymium/testclasses/context/cucumbercontextclear/CucumberContextGetsCleared.java
@@ -4,7 +4,7 @@
import com.xceptance.neodymium.NeodymiumCucumberRunner;
-import cucumber.api.CucumberOptions;
+import io.cucumber.junit.CucumberOptions;
@RunWith(NeodymiumCucumberRunner.class)
@CucumberOptions(features = "src/test/resources/com/xceptance/neodymium/testclasses/context/cucumbercontextclear", glue = "com/xceptance/neodymium/testclasses/context/cucumbercontextclear")
diff --git a/src/test/java/com/xceptance/neodymium/testclasses/context/cucumbercontextclear/CucumberContextSteps.java b/src/test/java/com/xceptance/neodymium/testclasses/context/cucumbercontextclear/CucumberContextSteps.java
index 4f3021df5..7adb338fc 100644
--- a/src/test/java/com/xceptance/neodymium/testclasses/context/cucumbercontextclear/CucumberContextSteps.java
+++ b/src/test/java/com/xceptance/neodymium/testclasses/context/cucumbercontextclear/CucumberContextSteps.java
@@ -6,10 +6,10 @@
import com.xceptance.neodymium.util.NeodymiumConfiguration;
import com.xceptance.neodymium.util.WebDriverUtils;
-import cucumber.api.Scenario;
-import cucumber.api.java.After;
-import cucumber.api.java.Before;
-import cucumber.api.java.en.Given;
+import io.cucumber.core.api.Scenario;
+import io.cucumber.java.After;
+import io.cucumber.java.Before;
+import io.cucumber.java.en.Given;
public class CucumberContextSteps
{
diff --git a/src/test/java/com/xceptance/neodymium/testclasses/cucumber/CucumberSetBrowserViaTag.java b/src/test/java/com/xceptance/neodymium/testclasses/cucumber/CucumberSetBrowserViaTag.java
index f0b1c86fb..491b27bfa 100644
--- a/src/test/java/com/xceptance/neodymium/testclasses/cucumber/CucumberSetBrowserViaTag.java
+++ b/src/test/java/com/xceptance/neodymium/testclasses/cucumber/CucumberSetBrowserViaTag.java
@@ -4,7 +4,7 @@
import com.xceptance.neodymium.NeodymiumCucumberRunner;
-import cucumber.api.CucumberOptions;
+import io.cucumber.junit.CucumberOptions;
@RunWith(NeodymiumCucumberRunner.class)
@CucumberOptions(features = "src/test/resources/com/xceptance/neodymium/testclasses/cucumber/CucumberSetBrowserViaTag.feature", glue = "com/xceptance/neodymium/testclasses/cucumber")
diff --git a/src/test/java/com/xceptance/neodymium/testclasses/cucumber/CucumberSetBrowserViaTagFail.java b/src/test/java/com/xceptance/neodymium/testclasses/cucumber/CucumberSetBrowserViaTagFail.java
index 4787da4ad..85498a397 100644
--- a/src/test/java/com/xceptance/neodymium/testclasses/cucumber/CucumberSetBrowserViaTagFail.java
+++ b/src/test/java/com/xceptance/neodymium/testclasses/cucumber/CucumberSetBrowserViaTagFail.java
@@ -4,11 +4,10 @@
import com.xceptance.neodymium.NeodymiumCucumberRunner;
-import cucumber.api.CucumberOptions;
+import io.cucumber.junit.CucumberOptions;
@RunWith(NeodymiumCucumberRunner.class)
-@CucumberOptions(features = "src/test/resources/com/xceptance/neodymium/testclasses/cucumber/CucumberSetBrowserViaTagFail.feature",
- glue = "com/xceptance/neodymium/testclasses/cucumber", plugin = "null_summary")
+@CucumberOptions(features = "src/test/resources/com/xceptance/neodymium/testclasses/cucumber/CucumberSetBrowserViaTagFail.feature", glue = "com/xceptance/neodymium/testclasses/cucumber", plugin = "null_summary")
public class CucumberSetBrowserViaTagFail
{
}
diff --git a/src/test/java/com/xceptance/neodymium/testclasses/cucumber/CucumberSetBrowserViaTestData.java b/src/test/java/com/xceptance/neodymium/testclasses/cucumber/CucumberSetBrowserViaTestData.java
index 60392326e..d166f3e53 100644
--- a/src/test/java/com/xceptance/neodymium/testclasses/cucumber/CucumberSetBrowserViaTestData.java
+++ b/src/test/java/com/xceptance/neodymium/testclasses/cucumber/CucumberSetBrowserViaTestData.java
@@ -4,7 +4,7 @@
import com.xceptance.neodymium.NeodymiumCucumberRunner;
-import cucumber.api.CucumberOptions;
+import io.cucumber.junit.CucumberOptions;
@RunWith(NeodymiumCucumberRunner.class)
@CucumberOptions(features = "src/test/resources/com/xceptance/neodymium/testclasses/cucumber/CucumberSetBrowserViaTestData.feature", glue = "com/xceptance/neodymium/testclasses/cucumber")
diff --git a/src/test/java/com/xceptance/neodymium/testclasses/cucumber/CucumberSetBrowserViaTestDataFail.java b/src/test/java/com/xceptance/neodymium/testclasses/cucumber/CucumberSetBrowserViaTestDataFail.java
index f5fd4d75a..399fc1a8a 100644
--- a/src/test/java/com/xceptance/neodymium/testclasses/cucumber/CucumberSetBrowserViaTestDataFail.java
+++ b/src/test/java/com/xceptance/neodymium/testclasses/cucumber/CucumberSetBrowserViaTestDataFail.java
@@ -4,11 +4,10 @@
import com.xceptance.neodymium.NeodymiumCucumberRunner;
-import cucumber.api.CucumberOptions;
+import io.cucumber.junit.CucumberOptions;
@RunWith(NeodymiumCucumberRunner.class)
-@CucumberOptions(features = "src/test/resources/com/xceptance/neodymium/testclasses/cucumber/CucumberSetBrowserViaTestDataFail.feature",
- glue = "com/xceptance/neodymium/testclasses/cucumber", plugin = "null_summary")
+@CucumberOptions(features = "src/test/resources/com/xceptance/neodymium/testclasses/cucumber/CucumberSetBrowserViaTestDataFail.feature", glue = "com/xceptance/neodymium/testclasses/cucumber", plugin = "null_summary")
public class CucumberSetBrowserViaTestDataFail
{
}
diff --git a/src/test/java/com/xceptance/neodymium/testclasses/cucumber/CucumberSupport.java b/src/test/java/com/xceptance/neodymium/testclasses/cucumber/CucumberSupport.java
index ba1b10562..775c3462a 100644
--- a/src/test/java/com/xceptance/neodymium/testclasses/cucumber/CucumberSupport.java
+++ b/src/test/java/com/xceptance/neodymium/testclasses/cucumber/CucumberSupport.java
@@ -7,11 +7,11 @@
import com.xceptance.neodymium.util.Neodymium;
import com.xceptance.neodymium.util.WebDriverUtils;
-import cucumber.api.Scenario;
-import cucumber.api.java.After;
-import cucumber.api.java.Before;
-import cucumber.api.java.en.Given;
-import cucumber.api.java.en.Then;
+import io.cucumber.core.api.Scenario;
+import io.cucumber.java.After;
+import io.cucumber.java.Before;
+import io.cucumber.java.en.Given;
+import io.cucumber.java.en.Then;
public class CucumberSupport
{
diff --git a/src/test/java/com/xceptance/neodymium/testclasses/cucumber/CucumberValidateAllureSelenideListenerIsActive.java b/src/test/java/com/xceptance/neodymium/testclasses/cucumber/CucumberValidateAllureSelenideListenerIsActive.java
index bf5e12559..304236fd8 100644
--- a/src/test/java/com/xceptance/neodymium/testclasses/cucumber/CucumberValidateAllureSelenideListenerIsActive.java
+++ b/src/test/java/com/xceptance/neodymium/testclasses/cucumber/CucumberValidateAllureSelenideListenerIsActive.java
@@ -4,7 +4,7 @@
import com.xceptance.neodymium.NeodymiumCucumberRunner;
-import cucumber.api.CucumberOptions;
+import io.cucumber.junit.CucumberOptions;
@RunWith(NeodymiumCucumberRunner.class)
@CucumberOptions(features = "src/test/resources/com/xceptance/neodymium/testclasses/cucumber/CucumberValidateAllureSelenideListenerIsActive.feature", glue = "com/xceptance/neodymium/testclasses/cucumber", plugin = "null_summary")
diff --git a/src/test/java/com/xceptance/neodymium/testclasses/data/file/json/CanReadDataSetJson.java b/src/test/java/com/xceptance/neodymium/testclasses/data/file/json/CanReadDataSetJson.java
new file mode 100644
index 000000000..cfbc39d10
--- /dev/null
+++ b/src/test/java/com/xceptance/neodymium/testclasses/data/file/json/CanReadDataSetJson.java
@@ -0,0 +1,25 @@
+package com.xceptance.neodymium.testclasses.data.file.json;
+
+import java.util.Map;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import com.xceptance.neodymium.NeodymiumRunner;
+import com.xceptance.neodymium.module.statement.testdata.DataFile;
+import com.xceptance.neodymium.util.Neodymium;
+
+@RunWith(NeodymiumRunner.class)
+@DataFile("com/xceptance/neodymium/testclasses/data/set/json/CanReadDataSetJson.json")
+public class CanReadDataSetJson
+{
+ @Test
+ public void test()
+ {
+ Map data = Neodymium.getData();
+ Assert.assertEquals(2, data.size());
+ Assert.assertEquals("Json Value1", data.get("testParam1"));
+ Assert.assertEquals("Json Value2", data.get("testParam2"));
+ }
+}
diff --git a/src/test/java/com/xceptance/neodymium/testclasses/data/file/xml/CanNotReadDataSetXml.java b/src/test/java/com/xceptance/neodymium/testclasses/data/file/xml/CanNotReadDataSetXml.java
new file mode 100644
index 000000000..a2f08d384
--- /dev/null
+++ b/src/test/java/com/xceptance/neodymium/testclasses/data/file/xml/CanNotReadDataSetXml.java
@@ -0,0 +1,19 @@
+package com.xceptance.neodymium.testclasses.data.file.xml;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import com.xceptance.neodymium.NeodymiumRunner;
+import com.xceptance.neodymium.module.statement.testdata.DataFile;
+import com.xceptance.neodymium.util.Neodymium;
+
+@RunWith(NeodymiumRunner.class)
+@DataFile("can/not/read/data/set/xml/DoesNotExist.xml")
+public class CanNotReadDataSetXml
+{
+ @Test()
+ public void test()
+ {
+ Neodymium.getData();
+ }
+}
diff --git a/src/test/java/com/xceptance/neodymium/testclasses/datautils/DataUtilsTests.java b/src/test/java/com/xceptance/neodymium/testclasses/datautils/DataUtilsTests.java
index 0f3b2cb98..203be4480 100644
--- a/src/test/java/com/xceptance/neodymium/testclasses/datautils/DataUtilsTests.java
+++ b/src/test/java/com/xceptance/neodymium/testclasses/datautils/DataUtilsTests.java
@@ -252,13 +252,13 @@ private void expectException(Runnable function, Class extends Throwable> expec
caughtException = e;
}
- String caughtExeptionName = "no exception!";
+ String caughtExceptionName = "no exception!";
if (caughtException != null)
- caughtExeptionName = caughtException.getClass().toString();
+ caughtExceptionName = caughtException.getClass().toString();
if (caughtException == null || caughtException.getClass() != expectedException)
{
- Assert.fail(MessageFormat.format("Expected exception {0} but caught {1}", expectedException.toString(), caughtExeptionName));
+ Assert.fail(MessageFormat.format("Expected exception {0} but caught {1}", expectedException.toString(), caughtExceptionName));
}
}
diff --git a/src/test/java/com/xceptance/neodymium/testclasses/datautils/DataUtilsTestsXml.java b/src/test/java/com/xceptance/neodymium/testclasses/datautils/DataUtilsTestsXml.java
index fa2ddc17f..77f3b6d7f 100644
--- a/src/test/java/com/xceptance/neodymium/testclasses/datautils/DataUtilsTestsXml.java
+++ b/src/test/java/com/xceptance/neodymium/testclasses/datautils/DataUtilsTestsXml.java
@@ -252,13 +252,13 @@ private void expectException(Runnable function, Class extends Throwable> expec
caughtException = e;
}
- String caughtExeptionName = "no exception!";
+ String caughtExceptionName = "no exception!";
if (caughtException != null)
- caughtExeptionName = caughtException.getClass().toString();
+ caughtExceptionName = caughtException.getClass().toString();
if (caughtException == null || caughtException.getClass() != expectedException)
{
- Assert.fail(MessageFormat.format("Expected exception {0} but caught {1}", expectedException.toString(), caughtExeptionName));
+ Assert.fail(MessageFormat.format("Expected exception {0} but caught {1}", expectedException.toString(), caughtExceptionName));
}
}
diff --git a/src/test/java/com/xceptance/neodymium/testclasses/multibrowser/EnvironmentAndBrowserConfiguration.java b/src/test/java/com/xceptance/neodymium/testclasses/multibrowser/EnvironmentAndBrowserConfiguration.java
index 6072d4747..6a9e41a03 100644
--- a/src/test/java/com/xceptance/neodymium/testclasses/multibrowser/EnvironmentAndBrowserConfiguration.java
+++ b/src/test/java/com/xceptance/neodymium/testclasses/multibrowser/EnvironmentAndBrowserConfiguration.java
@@ -11,7 +11,7 @@
public class EnvironmentAndBrowserConfiguration
{
@Test
- public void testEnvionmentApi()
+ public void testEnvironmentApi()
{
TestEnvironment environment = MultibrowserConfiguration.getInstance().getTestEnvironment("unittest");
diff --git a/src/test/java/com/xceptance/neodymium/testclasses/parameter/ParameterFieldButNoGenerator.java b/src/test/java/com/xceptance/neodymium/testclasses/parameter/ParameterFieldButNoGenerator.java
index c1add3b43..bdd2be6d0 100644
--- a/src/test/java/com/xceptance/neodymium/testclasses/parameter/ParameterFieldButNoGenerator.java
+++ b/src/test/java/com/xceptance/neodymium/testclasses/parameter/ParameterFieldButNoGenerator.java
@@ -11,7 +11,7 @@
public class ParameterFieldButNoGenerator
{
/**
- * Neodymium emulates JUnit's parmeterized runner with a few differences. Running this test with JUnits parameterized
+ * Neodymium emulates JUnit's parameterized runner with a few differences. Running this test with JUnits parameterized
* runner will fail since this runner expects an generator function. Neodymium on the other site handles parameters as
* optional. So if there is no generator function but parameterized members it just will ignore these annotation and run
* only the test methods. So the only thing to test in absence of a generator is that the members don't change their
diff --git a/src/test/java/com/xceptance/neodymium/testclasses/webDriver/ValidateClearReuseWebDriverCache.java b/src/test/java/com/xceptance/neodymium/testclasses/webDriver/ValidateClearReuseWebDriverCache.java
new file mode 100644
index 000000000..bf16bfcdd
--- /dev/null
+++ b/src/test/java/com/xceptance/neodymium/testclasses/webDriver/ValidateClearReuseWebDriverCache.java
@@ -0,0 +1,93 @@
+package com.xceptance.neodymium.testclasses.webDriver;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.aeonbits.owner.ConfigFactory;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openqa.selenium.WebDriver;
+
+import com.xceptance.neodymium.NeodymiumRunner;
+import com.xceptance.neodymium.module.statement.browser.multibrowser.Browser;
+import com.xceptance.neodymium.module.statement.browser.multibrowser.WebDriverCache;
+import com.xceptance.neodymium.tests.NeodymiumTest;
+import com.xceptance.neodymium.tests.NeodymiumWebDriverTest;
+import com.xceptance.neodymium.util.Neodymium;
+
+@RunWith(NeodymiumRunner.class)
+public class ValidateClearReuseWebDriverCache
+{
+ private static WebDriver webDriver1;
+
+ private static File tempConfigFile;
+
+ @BeforeClass
+ public static void beforeClass()
+ {
+ // set up a temporary neodymium.properties
+ final String fileLocation = "config/temp-ValidateClearReuseWebDriverCache-neodymium.properties";
+ tempConfigFile = new File("./" + fileLocation);
+ Map properties = new HashMap<>();
+ properties.put("neodymium.webDriver.reuseDriver", "true");
+ NeodymiumTest.writeMapToPropertiesFile(properties, tempConfigFile);
+ ConfigFactory.setProperty(Neodymium.TEMPORARY_CONFIG_FILE_PROPERTY_NAME, "file:" + fileLocation);
+
+ Assert.assertNull(webDriver1);
+ Assert.assertNull(Neodymium.getDriver());
+ }
+
+ @Before
+ public void before()
+ {
+ if (webDriver1 == null)
+ {
+ webDriver1 = Neodymium.getDriver();
+ }
+ else
+ {
+ Assert.assertNotNull(Neodymium.getDriver());
+ }
+ Assert.assertNotNull(webDriver1);
+ }
+
+ @Test
+ @Browser("Chrome_headless")
+ public void test1()
+ {
+ Assert.assertEquals(webDriver1, Neodymium.getDriver());
+ Assert.assertNotNull(webDriver1);
+ }
+
+ @Test
+ @Browser("Chrome_headless")
+ public void test2()
+ {
+ Assert.assertEquals(webDriver1, Neodymium.getDriver());
+ Assert.assertNotNull(webDriver1);
+ }
+
+ @After
+ public void after()
+ {
+ NeodymiumWebDriverTest.assertWebDriverAlive(webDriver1);
+ }
+
+ @AfterClass
+ public static void afterClass()
+ {
+ Assert.assertEquals(1, WebDriverCache.instance.getAllWebdriver().size());
+ WebDriverCache.quitCachedBrowsers();
+ Assert.assertEquals(0, WebDriverCache.instance.getAllWebdriver().size());
+
+ NeodymiumWebDriverTest.assertWebDriverClosed(webDriver1);
+
+ NeodymiumTest.deleteTempFile(tempConfigFile);
+ }
+}
diff --git a/src/test/java/com/xceptance/neodymium/testclasses/webDriver/ValidateKeepWebDriverOpen.java b/src/test/java/com/xceptance/neodymium/testclasses/webDriver/ValidateKeepWebDriverOpen.java
new file mode 100644
index 000000000..4770072e6
--- /dev/null
+++ b/src/test/java/com/xceptance/neodymium/testclasses/webDriver/ValidateKeepWebDriverOpen.java
@@ -0,0 +1,100 @@
+package com.xceptance.neodymium.testclasses.webDriver;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.aeonbits.owner.ConfigFactory;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openqa.selenium.WebDriver;
+
+import com.xceptance.neodymium.NeodymiumRunner;
+import com.xceptance.neodymium.module.statement.browser.multibrowser.Browser;
+import com.xceptance.neodymium.tests.NeodymiumTest;
+import com.xceptance.neodymium.tests.NeodymiumWebDriverTest;
+import com.xceptance.neodymium.util.Neodymium;
+
+@RunWith(NeodymiumRunner.class)
+public class ValidateKeepWebDriverOpen
+{
+ private static WebDriver webDriver1;
+
+ private static WebDriver webDriver2;
+
+ private static File tempConfigFile;
+
+ @BeforeClass
+ public static void beforeClass()
+ {
+ // set up a temporary neodymium.properties
+ final String fileLocation = "config/temp-ValidateReuseWebDriver-neodymium.properties";
+ tempConfigFile = new File("./" + fileLocation);
+ Map properties = new HashMap<>();
+ properties.put("neodymium.webDriver.keepBrowserOpen", "true");
+ NeodymiumTest.writeMapToPropertiesFile(properties, tempConfigFile);
+ ConfigFactory.setProperty(Neodymium.TEMPORARY_CONFIG_FILE_PROPERTY_NAME, "file:" + fileLocation);
+
+ Assert.assertNull(webDriver1);
+ Assert.assertNull(Neodymium.getDriver());
+ }
+
+ @Before
+ public void before()
+ {
+ if (webDriver1 == null)
+ {
+ webDriver1 = Neodymium.getDriver();
+ }
+ else if (webDriver2 == null)
+ {
+ webDriver2 = Neodymium.getDriver();
+ }
+ else
+ {
+ Assert.assertNotNull(Neodymium.getDriver());
+ }
+ Assert.assertNotNull(webDriver1);
+ }
+
+ @Test
+ @Browser("Chrome_1024x768")
+ public void test1()
+ {
+ Assert.assertEquals(webDriver1, Neodymium.getDriver());
+ NeodymiumWebDriverTest.assertWebDriverAlive(webDriver1);
+ }
+
+ @Test
+ @Browser("Chrome_1024x768")
+ public void test2()
+ {
+ Assert.assertNotEquals(webDriver1, webDriver2);
+ Assert.assertEquals(webDriver2, Neodymium.getDriver());
+ NeodymiumWebDriverTest.assertWebDriverAlive(webDriver1);
+ NeodymiumWebDriverTest.assertWebDriverAlive(webDriver2);
+ }
+
+ @After
+ public void after()
+ {
+ NeodymiumWebDriverTest.assertWebDriverAlive(Neodymium.getDriver());
+ }
+
+ @AfterClass
+ public static void afterClass()
+ {
+ NeodymiumWebDriverTest.assertWebDriverAlive(webDriver1);
+ NeodymiumWebDriverTest.assertWebDriverAlive(webDriver2);
+ webDriver1.quit();
+ webDriver2.quit();
+ NeodymiumWebDriverTest.assertWebDriverClosed(webDriver1);
+ NeodymiumWebDriverTest.assertWebDriverClosed(webDriver2);
+ NeodymiumTest.deleteTempFile(tempConfigFile);
+ }
+}
diff --git a/src/test/java/com/xceptance/neodymium/testclasses/webDriver/ValidateKeepWebDriverOpenOnFailure.java b/src/test/java/com/xceptance/neodymium/testclasses/webDriver/ValidateKeepWebDriverOpenOnFailure.java
new file mode 100644
index 000000000..4ecec8d7f
--- /dev/null
+++ b/src/test/java/com/xceptance/neodymium/testclasses/webDriver/ValidateKeepWebDriverOpenOnFailure.java
@@ -0,0 +1,114 @@
+package com.xceptance.neodymium.testclasses.webDriver;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.aeonbits.owner.ConfigFactory;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openqa.selenium.WebDriver;
+
+import com.codeborne.selenide.Condition;
+import com.codeborne.selenide.Selenide;
+import com.xceptance.neodymium.NeodymiumRunner;
+import com.xceptance.neodymium.module.statement.browser.multibrowser.Browser;
+import com.xceptance.neodymium.tests.NeodymiumTest;
+import com.xceptance.neodymium.tests.NeodymiumWebDriverTest;
+import com.xceptance.neodymium.util.Neodymium;
+
+@RunWith(NeodymiumRunner.class)
+@Browser("Chrome_1024x768")
+public class ValidateKeepWebDriverOpenOnFailure
+{
+ private static WebDriver webDriver1;
+
+ private static WebDriver webDriver2;
+
+ private static WebDriver webDriver3;
+
+ private static File tempConfigFile;
+
+ @BeforeClass
+ public static void beforeClass()
+ {
+ // set up a temporary neodymium.properties
+ final String fileLocation = "config/temp-ValidateKeepWebDriverOpenOnFailure-neodymium.properties";
+ tempConfigFile = new File("./" + fileLocation);
+ Map properties = new HashMap<>();
+ properties.put("neodymium.webDriver.keepBrowserOpenOnFailure", "true");
+ NeodymiumTest.writeMapToPropertiesFile(properties, tempConfigFile);
+ ConfigFactory.setProperty(Neodymium.TEMPORARY_CONFIG_FILE_PROPERTY_NAME, "file:" + fileLocation);
+
+ Assert.assertNull(webDriver1);
+ Assert.assertNull(Neodymium.getDriver());
+ }
+
+ @Before
+ public void before()
+ {
+ if (webDriver1 == null)
+ {
+ webDriver1 = Neodymium.getDriver();
+ }
+ else if (webDriver2 == null)
+ {
+ webDriver2 = Neodymium.getDriver();
+ }
+ else if (webDriver3 == null)
+ {
+ webDriver3 = Neodymium.getDriver();
+ }
+ else
+ {
+ Assert.assertNotNull(Neodymium.getDriver());
+ }
+ Assert.assertNotNull(webDriver1);
+ }
+
+ @Test
+ public void test1()
+ {
+ Assert.assertEquals(webDriver1, Neodymium.getDriver());
+ NeodymiumWebDriverTest.assertWebDriverAlive(webDriver1);
+ }
+
+ @Test
+ public void test2()
+ {
+ Assert.assertNotEquals(webDriver1, webDriver2);
+ Assert.assertEquals(webDriver2, Neodymium.getDriver());
+ NeodymiumWebDriverTest.assertWebDriverClosed(webDriver1);
+ NeodymiumWebDriverTest.assertWebDriverAlive(webDriver2);
+
+ Selenide.$("#cantFindMe").should(Condition.exist);
+ }
+
+ @Test
+ public void test3()
+ {
+ Assert.assertNotEquals(webDriver1, webDriver2);
+ Assert.assertNotEquals(webDriver2, webDriver3);
+ Assert.assertNotEquals(webDriver1, webDriver3);
+ Assert.assertEquals(webDriver3, Neodymium.getDriver());
+ NeodymiumWebDriverTest.assertWebDriverClosed(webDriver1);
+ NeodymiumWebDriverTest.assertWebDriverAlive(webDriver2);
+ NeodymiumWebDriverTest.assertWebDriverAlive(webDriver3);
+
+ }
+
+ @AfterClass
+ public static void afterClass()
+ {
+ NeodymiumWebDriverTest.assertWebDriverAlive(webDriver2);
+ webDriver2.quit();
+ NeodymiumWebDriverTest.assertWebDriverClosed(webDriver1);
+ NeodymiumWebDriverTest.assertWebDriverClosed(webDriver2);
+ NeodymiumWebDriverTest.assertWebDriverClosed(webDriver3);
+ NeodymiumTest.deleteTempFile(tempConfigFile);
+ }
+}
diff --git a/src/test/java/com/xceptance/neodymium/testclasses/webDriver/ValidatePreventReuseWebDriver.java b/src/test/java/com/xceptance/neodymium/testclasses/webDriver/ValidatePreventReuseWebDriver.java
new file mode 100644
index 000000000..217b0e6db
--- /dev/null
+++ b/src/test/java/com/xceptance/neodymium/testclasses/webDriver/ValidatePreventReuseWebDriver.java
@@ -0,0 +1,129 @@
+package com.xceptance.neodymium.testclasses.webDriver;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.aeonbits.owner.ConfigFactory;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openqa.selenium.WebDriver;
+
+import com.xceptance.neodymium.NeodymiumRunner;
+import com.xceptance.neodymium.module.statement.browser.multibrowser.Browser;
+import com.xceptance.neodymium.module.statement.browser.multibrowser.WebDriverCache;
+import com.xceptance.neodymium.tests.NeodymiumTest;
+import com.xceptance.neodymium.tests.NeodymiumWebDriverTest;
+import com.xceptance.neodymium.util.Neodymium;
+import com.xceptance.neodymium.util.WebDriverUtils;
+
+@RunWith(NeodymiumRunner.class)
+public class ValidatePreventReuseWebDriver
+{
+ private static WebDriver webDriver1;
+
+ private static WebDriver webDriver2;
+
+ private static WebDriver webDriver3;
+
+ private static File tempConfigFile;
+
+ @BeforeClass
+ public static void beforeClass()
+ {
+ // set up a temporary neodymium.properties
+ final String fileLocation = "config/temp-ValidateReuseWebDriver-neodymium.properties";
+ tempConfigFile = new File("./" + fileLocation);
+ Map properties = new HashMap<>();
+ properties.put("neodymium.webDriver.reuseDriver", "true");
+ NeodymiumTest.writeMapToPropertiesFile(properties, tempConfigFile);
+ ConfigFactory.setProperty(Neodymium.TEMPORARY_CONFIG_FILE_PROPERTY_NAME, "file:" + fileLocation);
+
+ Assert.assertNull(webDriver1);
+ Assert.assertNull(Neodymium.getDriver());
+ }
+
+ @Before
+ public void before()
+ {
+ if (webDriver1 == null)
+ {
+ webDriver1 = Neodymium.getDriver();
+ }
+ else if (webDriver2 == null)
+ {
+ webDriver2 = Neodymium.getDriver();
+ }
+ else if (webDriver3 == null)
+ {
+ webDriver3 = Neodymium.getDriver();
+ }
+ else
+ {
+ Assert.assertNotNull(Neodymium.getDriver());
+ }
+ Assert.assertNotNull(webDriver1);
+ }
+
+ @Test
+ @Browser("Chrome_headless")
+ public void test1()
+ {
+ Assert.assertEquals(webDriver1, Neodymium.getDriver());
+ Assert.assertNotNull(webDriver1);
+ Assert.assertNotEquals(webDriver1, webDriver2);
+
+ Assert.assertEquals(0, WebDriverCache.instance.getAllWebdriver().size());
+ }
+
+ @Test
+ @Browser("Chrome_headless")
+ public void test2()
+ {
+ Assert.assertEquals(webDriver2, Neodymium.getDriver());
+ Assert.assertNotNull(webDriver1);
+ Assert.assertNotNull(webDriver2);
+ Assert.assertNotEquals(webDriver1, webDriver2);
+
+ Assert.assertEquals(0, WebDriverCache.instance.getAllWebdriver().size());
+ }
+
+ @Test
+ @Browser("Chrome_headless")
+ public void test3()
+ {
+ Assert.assertEquals(webDriver3, Neodymium.getDriver());
+ Assert.assertNotNull(webDriver1);
+ Assert.assertNotNull(webDriver2);
+ Assert.assertNotNull(webDriver3);
+ Assert.assertNotEquals(webDriver1, webDriver2);
+ Assert.assertEquals(webDriver2, webDriver3);
+
+ Assert.assertEquals(0, WebDriverCache.instance.getAllWebdriver().size());
+ }
+
+ @After
+ public void after()
+ {
+ if (webDriver2 == null)
+ {
+ WebDriverUtils.preventReuseAndTearDown();
+ }
+ }
+
+ @AfterClass
+ public static void afterClass()
+ {
+ NeodymiumWebDriverTest.assertWebDriverClosed(webDriver1);
+ NeodymiumWebDriverTest.assertWebDriverAlive(webDriver2);
+ NeodymiumWebDriverTest.assertWebDriverAlive(webDriver3);
+ Assert.assertEquals(1, WebDriverCache.instance.getAllWebdriver().size());
+
+ NeodymiumTest.deleteTempFile(tempConfigFile);
+ }
+}
diff --git a/src/test/java/com/xceptance/neodymium/testclasses/webDriver/ValidateReuseWebDriver.java b/src/test/java/com/xceptance/neodymium/testclasses/webDriver/ValidateReuseWebDriver.java
new file mode 100644
index 000000000..fedc6fcd6
--- /dev/null
+++ b/src/test/java/com/xceptance/neodymium/testclasses/webDriver/ValidateReuseWebDriver.java
@@ -0,0 +1,86 @@
+package com.xceptance.neodymium.testclasses.webDriver;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.aeonbits.owner.ConfigFactory;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openqa.selenium.WebDriver;
+
+import com.xceptance.neodymium.NeodymiumRunner;
+import com.xceptance.neodymium.module.statement.browser.multibrowser.Browser;
+import com.xceptance.neodymium.tests.NeodymiumTest;
+import com.xceptance.neodymium.tests.NeodymiumWebDriverTest;
+import com.xceptance.neodymium.util.Neodymium;
+
+@RunWith(NeodymiumRunner.class)
+public class ValidateReuseWebDriver
+{
+ private static WebDriver webDriver1;
+
+ private static File tempConfigFile;
+
+ @BeforeClass
+ public static void beforeClass()
+ {
+ // set up a temporary neodymium.properties
+ final String fileLocation = "config/temp-ValidateReuseWebDriver-neodymium.properties";
+ tempConfigFile = new File("./" + fileLocation);
+ Map properties = new HashMap<>();
+ properties.put("neodymium.webDriver.reuseDriver", "true");
+ NeodymiumTest.writeMapToPropertiesFile(properties, tempConfigFile);
+ ConfigFactory.setProperty(Neodymium.TEMPORARY_CONFIG_FILE_PROPERTY_NAME, "file:" + fileLocation);
+
+ Assert.assertNull(webDriver1);
+ Assert.assertNull(Neodymium.getDriver());
+ }
+
+ @Before
+ public void before()
+ {
+ if (webDriver1 == null)
+ {
+ webDriver1 = Neodymium.getDriver();
+ }
+ else
+ {
+ Assert.assertNotNull(Neodymium.getDriver());
+ }
+ Assert.assertNotNull(webDriver1);
+ }
+
+ @Test
+ @Browser("Chrome_headless")
+ public void test1()
+ {
+ Assert.assertEquals(webDriver1, Neodymium.getDriver());
+ Assert.assertNotNull(webDriver1);
+ }
+
+ @Test
+ @Browser("Chrome_headless")
+ public void test2()
+ {
+ Assert.assertEquals(webDriver1, Neodymium.getDriver());
+ Assert.assertNotNull(webDriver1);
+ }
+
+ @After
+ public void after()
+ {
+ NeodymiumWebDriverTest.assertWebDriverAlive(webDriver1);
+ }
+
+ @AfterClass
+ public static void afterClass()
+ {
+ NeodymiumTest.deleteTempFile(tempConfigFile);
+ }
+}
diff --git a/src/test/java/com/xceptance/neodymium/testclasses/webDriver/ValidateWebDriverClosed.java b/src/test/java/com/xceptance/neodymium/testclasses/webDriver/ValidateWebDriverClosed.java
new file mode 100644
index 000000000..ed01f78a4
--- /dev/null
+++ b/src/test/java/com/xceptance/neodymium/testclasses/webDriver/ValidateWebDriverClosed.java
@@ -0,0 +1,79 @@
+package com.xceptance.neodymium.testclasses.webDriver;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openqa.selenium.WebDriver;
+
+import com.xceptance.neodymium.NeodymiumRunner;
+import com.xceptance.neodymium.module.statement.browser.multibrowser.Browser;
+import com.xceptance.neodymium.tests.NeodymiumWebDriverTest;
+import com.xceptance.neodymium.util.Neodymium;
+
+@RunWith(NeodymiumRunner.class)
+public class ValidateWebDriverClosed
+{
+ private static WebDriver webDriver1;
+
+ private static WebDriver webDriver2;
+
+ @BeforeClass
+ public static void beforeClass()
+ {
+ Assert.assertNull(webDriver1);
+ Assert.assertNull(Neodymium.getDriver());
+ }
+
+ @Before
+ public void before()
+ {
+ if (webDriver1 == null)
+ {
+ webDriver1 = Neodymium.getDriver();
+ }
+ else if (webDriver2 == null)
+ {
+ webDriver2 = Neodymium.getDriver();
+ }
+ else
+ {
+ Assert.assertNotNull(Neodymium.getDriver());
+ }
+ Assert.assertNotNull(webDriver1);
+ }
+
+ @Test
+ @Browser("Chrome_headless")
+ public void test1()
+ {
+ Assert.assertEquals(webDriver1, Neodymium.getDriver());
+ NeodymiumWebDriverTest.assertWebDriverAlive(webDriver1);
+ }
+
+ @Test
+ @Browser("Chrome_headless")
+ public void test2()
+ {
+ Assert.assertNotEquals(webDriver1, Neodymium.getDriver());
+ Assert.assertEquals(webDriver2, Neodymium.getDriver());
+ NeodymiumWebDriverTest.assertWebDriverClosed(webDriver1);
+ NeodymiumWebDriverTest.assertWebDriverAlive(webDriver2);
+ }
+
+ @After
+ public void after()
+ {
+ Assert.assertNotNull(Neodymium.getDriver());
+ }
+
+ @AfterClass
+ public static void afterClass()
+ {
+ NeodymiumWebDriverTest.assertWebDriverClosed(webDriver1);
+ NeodymiumWebDriverTest.assertWebDriverClosed(webDriver2);
+ }
+}
diff --git a/src/test/java/com/xceptance/neodymium/tests/BrowserStatementConfigurationTestError.java b/src/test/java/com/xceptance/neodymium/tests/BrowserStatementConfigurationTestError.java
new file mode 100644
index 000000000..9d3685445
--- /dev/null
+++ b/src/test/java/com/xceptance/neodymium/tests/BrowserStatementConfigurationTestError.java
@@ -0,0 +1,80 @@
+package com.xceptance.neodymium.tests;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.xceptance.neodymium.module.statement.browser.multibrowser.configuration.MultibrowserConfiguration;
+
+public class BrowserStatementConfigurationTestError extends NeodymiumTest
+{
+
+ File tempConfigFile;
+
+ @After
+ public void after() throws IOException
+ {
+ deleteTempFile(tempConfigFile);
+ }
+
+ @Test
+ public void testParseErrorIdleTimeout()
+ {
+ String unparsableInt = "ABC122";
+ try
+ {
+ Map properties = new HashMap<>();
+ properties.put("browserprofile.testEnvironmentFlags.name", "Test Environment Browser");
+ properties.put("browserprofile.testEnvironmentFlags.browser", "chrome");
+ properties.put("browserprofile.testEnvironmentFlags.idleTimeout", unparsableInt);
+
+ tempConfigFile = File.createTempFile("browser", "", new File("./config/"));
+ tempFiles.add(tempConfigFile);
+ writeMapToPropertiesFile(properties, tempConfigFile);
+
+ MultibrowserConfiguration.clearAllInstances();
+ MultibrowserConfiguration.getInstance(tempConfigFile.getPath());
+
+ Assert.assertTrue("This point will not reached if the awaited RuntimeException is thrown.", false);
+ }
+ catch (Exception e)
+ {
+ Assert.assertTrue(e instanceof RuntimeException);
+ Assert.assertEquals("idleTimeout configured within the browser profiles couldn't be parsed into an int value. Given value: \""
+ + unparsableInt + "\"", e.getMessage());
+ }
+ }
+
+ @Test
+ public void testParseErrorMaxiumumDuration()
+ {
+ String unparsableInt = "ABC122";
+ try
+ {
+ Map properties = new HashMap<>();
+ properties.put("browserprofile.testEnvironmentFlags.name", "Test Environment Browser");
+ properties.put("browserprofile.testEnvironmentFlags.browser", "chrome");
+ properties.put("browserprofile.testEnvironmentFlags.maxDuration", unparsableInt);
+
+ tempConfigFile = File.createTempFile("browser", "", new File("./config/"));
+ tempFiles.add(tempConfigFile);
+ writeMapToPropertiesFile(properties, tempConfigFile);
+
+ MultibrowserConfiguration.clearAllInstances();
+ MultibrowserConfiguration.getInstance(tempConfigFile.getPath());
+
+ Assert.assertTrue("This point will not reached if the awaited RuntimeException is thrown.", false);
+ }
+ catch (Exception e)
+ {
+ Assert.assertTrue(e instanceof RuntimeException);
+ Assert.assertEquals("maxDuration configured within the browser profiles couldn't be parsed into an int value. Given value: \""
+ + unparsableInt + "\"", e.getMessage());
+ }
+ }
+}
diff --git a/src/test/java/com/xceptance/neodymium/tests/BrowserStatementTest.java b/src/test/java/com/xceptance/neodymium/tests/BrowserStatementTest.java
index 57db95597..0c04f8676 100644
--- a/src/test/java/com/xceptance/neodymium/tests/BrowserStatementTest.java
+++ b/src/test/java/com/xceptance/neodymium/tests/BrowserStatementTest.java
@@ -13,6 +13,7 @@
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.openqa.selenium.MutableCapabilities;
+import org.openqa.selenium.Platform;
import org.openqa.selenium.remote.CapabilityType;
import com.xceptance.neodymium.module.statement.browser.multibrowser.configuration.BrowserConfiguration;
@@ -55,6 +56,18 @@ public static void beforeClass() throws IOException
properties.put("browserprofile.multiChrome.browser", "chrome");
properties.put("browserprofile.multiChrome.arguments", " -crash-test ; -window-position=0,0 ;-window-size=1024,768 ");
+ properties.put("browserprofile.testEnvironmentFlags.name", "Test Environment Browser");
+ properties.put("browserprofile.testEnvironmentFlags.browser", "chrome");
+ properties.put("browserprofile.testEnvironmentFlags.idleTimeout", "1234");
+ properties.put("browserprofile.testEnvironmentFlags.maxDuration", "5678");
+ properties.put("browserprofile.testEnvironmentFlags.seleniumVersion", "3.1234");
+ properties.put("browserprofile.testEnvironmentFlags.screenResolution", "800x600");
+ properties.put("browserprofile.testEnvironmentFlags.platform", "Windows 7");
+ properties.put("browserprofile.testEnvironmentFlags.platformName", "Windows 10");
+ properties.put("browserprofile.testEnvironmentFlags.deviceName", "MyDevice");
+ properties.put("browserprofile.testEnvironmentFlags.deviceOrientation", "portrait");
+ properties.put("browserprofile.testEnvironmentFlags.orientation", "landscape");
+
File tempConfigFile = File.createTempFile("browser", "", new File("./config/"));
tempFiles.add(tempConfigFile);
writeMapToPropertiesFile(properties, tempConfigFile);
@@ -176,9 +189,10 @@ public void testMultibrowserConfiguration() throws Throwable
checkMultiChrome(browserProfiles.get("multiChrome"));
checkFirefox(browserProfiles.get("firefox"));
checkMultiFirefox(browserProfiles.get("multiFirefox"));
+ checkTestEnvironment(browserProfiles.get("testEnvironmentFlags"));
}
- public void checkChrome(BrowserConfiguration config)
+ private void checkChrome(BrowserConfiguration config)
{
Assert.assertNotNull(config);
Assert.assertEquals("chrome", config.getConfigTag());
@@ -192,7 +206,7 @@ public void checkChrome(BrowserConfiguration config)
Assert.assertEquals(list, config.getArguments());
}
- public void checkMultiChrome(BrowserConfiguration config)
+ private void checkMultiChrome(BrowserConfiguration config)
{
Assert.assertNotNull(config);
Assert.assertEquals("multiChrome", config.getConfigTag());
@@ -206,7 +220,7 @@ public void checkMultiChrome(BrowserConfiguration config)
Assert.assertEquals(list, config.getArguments());
}
- public void checkFirefox(BrowserConfiguration config)
+ private void checkFirefox(BrowserConfiguration config)
{
Assert.assertNotNull(config);
Assert.assertEquals("firefox", config.getConfigTag());
@@ -219,7 +233,7 @@ public void checkFirefox(BrowserConfiguration config)
Assert.assertEquals(list, config.getArguments());
}
- public void checkMultiFirefox(BrowserConfiguration config)
+ private void checkMultiFirefox(BrowserConfiguration config)
{
Assert.assertNotNull(config);
Assert.assertEquals("multiFirefox", config.getConfigTag());
@@ -232,4 +246,26 @@ public void checkMultiFirefox(BrowserConfiguration config)
list.add("-height=768");
Assert.assertEquals(list, config.getArguments());
}
+
+ private void checkTestEnvironment(BrowserConfiguration config)
+ {
+ Assert.assertNotNull(config);
+ Assert.assertEquals("testEnvironmentFlags", config.getConfigTag());
+ Assert.assertEquals("Test Environment Browser", config.getName());
+ MutableCapabilities testCapabilities = config.getCapabilities();
+ Assert.assertEquals("chrome", testCapabilities.getBrowserName());
+ Assert.assertEquals(1234, testCapabilities.getCapability("idleTimeout"));
+ Assert.assertEquals(1234, testCapabilities.getCapability("idletimeout"));
+ Assert.assertEquals(5678, testCapabilities.getCapability("maxDuration"));
+ Assert.assertEquals(5678, testCapabilities.getCapability("maxduration"));
+ Assert.assertEquals("3.1234", testCapabilities.getCapability("seleniumVersion"));
+ Assert.assertEquals("3.1234", testCapabilities.getCapability("selenium-version"));
+ Assert.assertEquals("800x600", testCapabilities.getCapability("screenResolution"));
+ Assert.assertEquals("800x600", testCapabilities.getCapability("screen-resolution"));
+ Assert.assertEquals(Platform.VISTA, testCapabilities.getCapability("platform"));
+ Assert.assertEquals("Windows 10", testCapabilities.getCapability("platformName"));
+ Assert.assertEquals("MyDevice", testCapabilities.getCapability("deviceName"));
+ Assert.assertEquals("portrait", testCapabilities.getCapability("deviceOrientation"));
+ Assert.assertEquals("landscape", testCapabilities.getCapability("orientation"));
+ }
}
diff --git a/src/test/java/com/xceptance/neodymium/tests/CucumberTest.java b/src/test/java/com/xceptance/neodymium/tests/CucumberTest.java
index 2d8049b60..381ea4bf6 100644
--- a/src/test/java/com/xceptance/neodymium/tests/CucumberTest.java
+++ b/src/test/java/com/xceptance/neodymium/tests/CucumberTest.java
@@ -22,7 +22,7 @@ public void testSetBrowserViaTestData() throws Exception
public void testSetBrowserViaTestDataFail() throws Exception
{
Result result = JUnitCore.runClasses(CucumberSetBrowserViaTestDataFail.class);
- checkFail(result, 1, 0, 2, null);
+ checkFail(result, 1, 0, 1, null);
}
@Test
@@ -36,6 +36,6 @@ public void testSetBrowserViaTag() throws Exception
public void testSetBrowserViaTagFail() throws Exception
{
Result result = JUnitCore.runClasses(CucumberSetBrowserViaTagFail.class);
- checkFail(result, 1, 0, 2, null);
+ checkFail(result, 1, 0, 1, null);
}
}
diff --git a/src/test/java/com/xceptance/neodymium/tests/EnvironmentAndBrowserConfigurationTest.java b/src/test/java/com/xceptance/neodymium/tests/EnvironmentAndBrowserConfigurationTest.java
index 159b9c43f..b53abfc0f 100644
--- a/src/test/java/com/xceptance/neodymium/tests/EnvironmentAndBrowserConfigurationTest.java
+++ b/src/test/java/com/xceptance/neodymium/tests/EnvironmentAndBrowserConfigurationTest.java
@@ -30,7 +30,7 @@ public class EnvironmentAndBrowserConfigurationTest extends NeodymiumTest
public static final String BROWSERNAME = "My new name for Samsung S3";
- public static final String ENVIRONMENTNAME = "someEnvrionment";
+ public static final String ENVIRONMENTNAME = "someEnvironment";
public static final Boolean USEPROXY1 = true;
diff --git a/src/test/java/com/xceptance/neodymium/tests/LocalizationInitalizationErrorTest.java b/src/test/java/com/xceptance/neodymium/tests/LocalizationInitializationErrorTest.java
similarity index 95%
rename from src/test/java/com/xceptance/neodymium/tests/LocalizationInitalizationErrorTest.java
rename to src/test/java/com/xceptance/neodymium/tests/LocalizationInitializationErrorTest.java
index df8dc7bbb..555f24d32 100644
--- a/src/test/java/com/xceptance/neodymium/tests/LocalizationInitalizationErrorTest.java
+++ b/src/test/java/com/xceptance/neodymium/tests/LocalizationInitializationErrorTest.java
@@ -14,7 +14,7 @@
import com.xceptance.neodymium.util.Neodymium;
@RunWith(NeodymiumRunner.class)
-public class LocalizationInitalizationErrorTest extends NeodymiumTest
+public class LocalizationInitializationErrorTest extends NeodymiumTest
{
private static File tempConfigFile;
diff --git a/src/test/java/com/xceptance/neodymium/tests/NeodymiumContextTest.java b/src/test/java/com/xceptance/neodymium/tests/NeodymiumContextTest.java
index 19f155666..7d8fc49f1 100644
--- a/src/test/java/com/xceptance/neodymium/tests/NeodymiumContextTest.java
+++ b/src/test/java/com/xceptance/neodymium/tests/NeodymiumContextTest.java
@@ -41,7 +41,7 @@ public static void setUpNeodymiumConfiguration() throws IOException
Map properties2 = new HashMap<>();
properties2.put("neodymium.webDriver.phantomjs.pathToDriverServer", "/some/phantomjs/path/just/for/test/newPurpose");
writeMapToPropertiesFile(properties2, tempConfigFile2);
- ConfigFactory.setProperty(Neodymium.TEMPORARY_CONFIG_FILE_PROPTERY_NAME, "file:" + fileLocation);
+ ConfigFactory.setProperty(Neodymium.TEMPORARY_CONFIG_FILE_PROPERTY_NAME, "file:" + fileLocation);
}
@Test
diff --git a/src/test/java/com/xceptance/neodymium/tests/NeodymiumTest.java b/src/test/java/com/xceptance/neodymium/tests/NeodymiumTest.java
index 12a3df150..b4fa781db 100644
--- a/src/test/java/com/xceptance/neodymium/tests/NeodymiumTest.java
+++ b/src/test/java/com/xceptance/neodymium/tests/NeodymiumTest.java
@@ -35,7 +35,7 @@ public static void cleanUp()
/**
* delete a temporary test file
*/
- protected static void deleteTempFile(File tempFile)
+ public static void deleteTempFile(File tempFile)
{
if (tempFile.exists())
{
diff --git a/src/test/java/com/xceptance/neodymium/tests/NeodymiumWebDriverTest.java b/src/test/java/com/xceptance/neodymium/tests/NeodymiumWebDriverTest.java
new file mode 100644
index 000000000..49d349d66
--- /dev/null
+++ b/src/test/java/com/xceptance/neodymium/tests/NeodymiumWebDriverTest.java
@@ -0,0 +1,78 @@
+package com.xceptance.neodymium.tests;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Result;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.remote.RemoteWebDriver;
+import org.openqa.selenium.support.events.EventFiringWebDriver;
+
+import com.xceptance.neodymium.testclasses.webDriver.ValidateClearReuseWebDriverCache;
+import com.xceptance.neodymium.testclasses.webDriver.ValidateKeepWebDriverOpen;
+import com.xceptance.neodymium.testclasses.webDriver.ValidateKeepWebDriverOpenOnFailure;
+import com.xceptance.neodymium.testclasses.webDriver.ValidatePreventReuseWebDriver;
+import com.xceptance.neodymium.testclasses.webDriver.ValidateReuseWebDriver;
+import com.xceptance.neodymium.testclasses.webDriver.ValidateWebDriverClosed;
+
+public class NeodymiumWebDriverTest extends NeodymiumTest
+{
+ @Test
+ public void testValidateWebDriverClosed()
+ {
+ Result result = JUnitCore.runClasses(ValidateWebDriverClosed.class);
+ checkPass(result, 2, 0, 0);
+ }
+
+ @Test
+ public void testValidateReuseWebDriver()
+ {
+ // XVFB or a display needed
+ Result result = JUnitCore.runClasses(ValidateReuseWebDriver.class);
+ checkPass(result, 2, 0, 0);
+ }
+
+ @Test
+ public void testValidateClearReuseWebDriverCache()
+ {
+ // XVFB or a display needed
+ Result result = JUnitCore.runClasses(ValidateClearReuseWebDriverCache.class);
+ checkPass(result, 2, 0, 0);
+ }
+
+ @Test
+ public void testValidatePreventReuseWebDriver()
+ {
+ // XVFB or a display needed
+ Result result = JUnitCore.runClasses(ValidatePreventReuseWebDriver.class);
+ checkPass(result, 3, 0, 0);
+ }
+
+ @Test
+ public void testValidateKeepWebDriverOpen()
+ {
+ Result result = JUnitCore.runClasses(ValidateKeepWebDriverOpen.class);
+ checkPass(result, 2, 0, 0);
+ }
+
+ @Test
+ public void testValidateKeepWebDriverOpenOnFailure()
+ {
+ Result result = JUnitCore.runClasses(ValidateKeepWebDriverOpenOnFailure.class);
+ checkFail(result, 3, 0, 1, null);
+ }
+
+ public static void assertWebDriverClosed(WebDriver webDriver)
+ {
+ Assert.assertNotNull(webDriver);
+ RemoteWebDriver driver = (RemoteWebDriver) ((EventFiringWebDriver) webDriver).getWrappedDriver();
+ Assert.assertNull(driver.getSessionId());
+ }
+
+ public static void assertWebDriverAlive(WebDriver webDriver)
+ {
+ Assert.assertNotNull(webDriver);
+ RemoteWebDriver driver = (RemoteWebDriver) ((EventFiringWebDriver) webDriver).getWrappedDriver();
+ Assert.assertNotNull(driver.getSessionId());
+ }
+}
diff --git a/src/test/java/com/xceptance/neodymium/tests/ParameterStatementTest.java b/src/test/java/com/xceptance/neodymium/tests/ParameterStatementTest.java
index 8bce0fde8..3c0706f9a 100644
--- a/src/test/java/com/xceptance/neodymium/tests/ParameterStatementTest.java
+++ b/src/test/java/com/xceptance/neodymium/tests/ParameterStatementTest.java
@@ -82,7 +82,7 @@ public void testGeneratorTooMuchElements()
@Test
public void testGeneratorAutoTypeConversion()
{
- // test auto type conversion from string to various data types, aswell as arbitrary type injection
+ // test auto type conversion from string to various data types, as well as arbitrary type injection
Result result = JUnitCore.runClasses(GeneratorAutoTypeConversion.class);
checkPass(result, 1, 0, 0);
}
@@ -125,6 +125,6 @@ public void testGeneratorAutoTypeConversionFailsOnWrongInputData()
{
// test that auto type conversion from string fails if string content can not match
Result result = JUnitCore.runClasses(GeneratorAutoTypeConversionFailsOnWrongInputData.class);
- checkFail(result, 1, 0, 1, "An error occured during conversion of input string \"true\" to type double for field \"aDouble\"");
+ checkFail(result, 1, 0, 1, "An error occurred during conversion of input string \"true\" to type double for field \"aDouble\"");
}
}
diff --git a/src/test/java/com/xceptance/neodymium/tests/ProxyConfigurationTest.java b/src/test/java/com/xceptance/neodymium/tests/ProxyConfigurationTest.java
index 7542407ea..70a92177c 100644
--- a/src/test/java/com/xceptance/neodymium/tests/ProxyConfigurationTest.java
+++ b/src/test/java/com/xceptance/neodymium/tests/ProxyConfigurationTest.java
@@ -51,7 +51,7 @@ public static void beforeClass() throws IOException
writeMapToPropertiesFile(properties, tempConfigFile);
tempFiles.add(tempConfigFile);
- ConfigFactory.setProperty(Neodymium.TEMPORARY_CONFIG_FILE_PROPTERY_NAME, "file:" + fileLocation);
+ ConfigFactory.setProperty(Neodymium.TEMPORARY_CONFIG_FILE_PROPERTY_NAME, "file:" + fileLocation);
}
@Test
diff --git a/src/test/java/com/xceptance/neodymium/tests/TestDataStatementTest.java b/src/test/java/com/xceptance/neodymium/tests/TestDataStatementTest.java
index f547baf2c..363005bc5 100644
--- a/src/test/java/com/xceptance/neodymium/tests/TestDataStatementTest.java
+++ b/src/test/java/com/xceptance/neodymium/tests/TestDataStatementTest.java
@@ -5,6 +5,7 @@
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
+import com.xceptance.neodymium.testclasses.data.file.xml.CanNotReadDataSetXml;
import com.xceptance.neodymium.testclasses.data.inheritance.child.PackageTestDataInheritance;
import com.xceptance.neodymium.testclasses.data.inheritance.child.grandchild.GrandChildPackageTestDataInheritance;
import com.xceptance.neodymium.testclasses.data.inheritance.child.grandchild.set.DataSetOverridesPackageData;
@@ -104,7 +105,7 @@ public void testCanReadDataSetXML()
@Test
public void testPackageTestDataInheritance()
{
- // test inheritacne of package test data
+ // test inheritance of package test data
Result result = JUnitCore.runClasses(PackageTestDataInheritance.class);
checkPass(result, 1, 0, 0);
}
@@ -358,4 +359,19 @@ public void testOnlyImplicitOneDataSet() throws Throwable
checkDescription(OnlyImplicitOneDataSet.class, expected);
}
+ @Test
+ public void testDataFileAnnotation() throws Exception
+ {
+ // test package test data csv is read
+ Result result = JUnitCore.runClasses(com.xceptance.neodymium.testclasses.data.file.json.CanReadDataSetJson.class);
+ checkPass(result, 1, 0, 0);
+ }
+
+ @Test
+ public void testDataFileAnnotationException() throws Exception
+ {
+ Result result = JUnitCore.runClasses(CanNotReadDataSetXml.class);
+ checkFail(result, 1, 0, 1,
+ "java.lang.RuntimeException: The data file:\"can/not/read/data/set/xml/DoesNotExist.xml\" provided within the test class:\"CanNotReadDataSetXml\" can't be read.");
+ }
}
diff --git a/src/test/java/com/xceptance/neodymium/tests/visual/pixel/TestComparator.java b/src/test/java/com/xceptance/neodymium/tests/visual/pixel/TestComparator.java
index 86a609ec2..5fb428631 100644
--- a/src/test/java/com/xceptance/neodymium/tests/visual/pixel/TestComparator.java
+++ b/src/test/java/com/xceptance/neodymium/tests/visual/pixel/TestComparator.java
@@ -17,7 +17,7 @@ public class TestComparator extends ImageTest
private final ComparisonAlgorithm algorithm;
- private ImageComparison comperator;
+ private ImageComparison comparator;
private MaskImage masker;
@@ -64,20 +64,20 @@ public TestComparator to(final String comparisonImageFile)
public TestComparator to(final BufferedImage comparisonImage)
{
this.comparisonImage = comparisonImage;
- comperator = new ImageComparison(referenceImage);
+ comparator = new ImageComparison(referenceImage);
return this;
}
public TestComparator isEqual()
{
- Assert.assertTrue(comperator.isEqual(comparisonImage, masker, algorithm));
+ Assert.assertTrue(comparator.isEqual(comparisonImage, masker, algorithm));
return this;
}
public TestComparator isNotEqual()
{
- Assert.assertFalse(comperator.isEqual(comparisonImage, masker, algorithm));
+ Assert.assertFalse(comparator.isEqual(comparisonImage, masker, algorithm));
return this;
}
@@ -99,20 +99,20 @@ public TestComparator hasMarking(final String markingFile)
public TestComparator hasMarking(final BufferedImage marking)
{
- final BufferedImage comperatorDifference = comperator.getMarkedImageWithBoxes(markingSizeX, markingSizeY);
+ final BufferedImage comparatorDifference = comparator.getMarkedImageWithBoxes(markingSizeX, markingSizeY);
final long now = System.currentTimeMillis();
- writeToTmp(comperatorDifference, MessageFormat.format("actual.{0}.png", String.valueOf(now)));
+ writeToTmp(comparatorDifference, MessageFormat.format("actual.{0}.png", String.valueOf(now)));
writeToTmp(marking, MessageFormat.format("expected.{0}.png", String.valueOf(now)));
- Assert.assertTrue(imageEqual(comperatorDifference, marking));
+ Assert.assertTrue(imageEqual(comparatorDifference, marking));
return this;
}
public TestComparator hasNoMarking()
{
- final BufferedImage comperatorDifference = comperator.getMarkedImageWithBoxes(markingSizeX, markingSizeY);
- Assert.assertNull(comperatorDifference);
+ final BufferedImage comparatorDifference = comparator.getMarkedImageWithBoxes(markingSizeX, markingSizeY);
+ Assert.assertNull(comparatorDifference);
return this;
}
@@ -122,8 +122,8 @@ public MaskImage getMasker()
return masker;
}
- public ImageComparison getComperator()
+ public ImageComparison getComparator()
{
- return comperator;
+ return comparator;
}
}
diff --git a/src/test/java/com/xceptance/neodymium/util/DebugUtilsTest.java b/src/test/java/com/xceptance/neodymium/util/DebugUtilsTest.java
index 9e8a50e78..b52a9cb40 100644
--- a/src/test/java/com/xceptance/neodymium/util/DebugUtilsTest.java
+++ b/src/test/java/com/xceptance/neodymium/util/DebugUtilsTest.java
@@ -1,10 +1,5 @@
package com.xceptance.neodymium.util;
-import static com.codeborne.selenide.Condition.exist;
-import static com.codeborne.selenide.Condition.visible;
-import static com.codeborne.selenide.Selenide.$;
-import static com.codeborne.selenide.Selenide.$$;
-
import java.util.List;
import org.junit.Assert;
@@ -19,6 +14,12 @@
import com.xceptance.neodymium.NeodymiumRunner;
import com.xceptance.neodymium.module.statement.browser.multibrowser.Browser;
+import static com.codeborne.selenide.Condition.exist;
+import static com.codeborne.selenide.Condition.visible;
+
+import static com.codeborne.selenide.Selenide.$;
+import static com.codeborne.selenide.Selenide.$$;
+
@RunWith(NeodymiumRunner.class)
@Browser("Chrome_headless")
public class DebugUtilsTest
@@ -28,7 +29,7 @@ public void testHighlighting()
{
Selenide.open("https://blog.xceptance.com/");
DebugUtils.injectJavaScript();
- assertJsSucessfullyInjected();
+ assertJsSuccessfullyInjected();
final List list = $("body").findElements(By.cssSelector("#masthead"));
DebugUtils.highlightElements(list, Neodymium.getDriver());
@@ -50,7 +51,7 @@ public void testHighlightingWithoutImplicitWaitTime()
{
Selenide.open("https://blog.xceptance.com/");
DebugUtils.injectJavaScript();
- assertJsSucessfullyInjected();
+ assertJsSuccessfullyInjected();
final List list = $("body").findElements(By.cssSelector("#masthead"));
DebugUtils.highlightElements(list, Neodymium.getDriver());
@@ -70,32 +71,32 @@ public void testWaiting()
// one wait due to navigation
Selenide.open("https://blog.xceptance.com/");
- Assert.assertEquals(0, eventListener.impliciteWaitCount);
+ Assert.assertEquals(0, eventListener.implicitWaitCount);
// one wait due to find
$("body #masthead").should(exist);
- Assert.assertEquals(1, eventListener.impliciteWaitCount);
- assertJsSucessfullyInjected();
+ Assert.assertEquals(1, eventListener.implicitWaitCount);
+ assertJsSuccessfullyInjected();
// two waits due to chain finding
$("body").findElements(By.cssSelector("#content article"));
- Assert.assertEquals(3, eventListener.impliciteWaitCount);
+ Assert.assertEquals(3, eventListener.implicitWaitCount);
// two waits due to find and click
$("#text-3 h1").click();
- Assert.assertEquals(4, eventListener.impliciteWaitCount);
+ Assert.assertEquals(4, eventListener.implicitWaitCount);
// additional two waits due to find and click
$("#masthead .search-toggle").click();
- Assert.assertEquals(5, eventListener.impliciteWaitCount);
+ Assert.assertEquals(5, eventListener.implicitWaitCount);
// three waits due to find and change value (consumes 2 waits)
$("#search-container .search-form input.search-field").val("abc");
- Assert.assertEquals(6, eventListener.impliciteWaitCount);
+ Assert.assertEquals(6, eventListener.implicitWaitCount);
// two waits due to find and press enter
$("#search-container .search-form input.search-field").pressEnter();
- Assert.assertEquals(7, eventListener.impliciteWaitCount);
+ Assert.assertEquals(7, eventListener.implicitWaitCount);
}
@Test
@@ -108,7 +109,7 @@ public void testIFrames() throws Exception
SelenideElement body = $("body");
body.click();
- assertJsSucessfullyInjected();
+ assertJsSuccessfullyInjected();
final List list = $("body").findElements(By.cssSelector("select"));
@@ -120,7 +121,7 @@ public void testIFrames() throws Exception
$(".neodymium-highlight-box").shouldNot(exist);
}
- private void assertJsSucessfullyInjected()
+ private void assertJsSuccessfullyInjected()
{
Assert.assertTrue(Selenide.executeJavaScript("return !!window.NEODYMIUM"));
}
diff --git a/src/test/java/com/xceptance/neodymium/util/JavaScriptUtilsTest.java b/src/test/java/com/xceptance/neodymium/util/JavaScriptUtilsTest.java
index a89e5af00..61bdb59b6 100644
--- a/src/test/java/com/xceptance/neodymium/util/JavaScriptUtilsTest.java
+++ b/src/test/java/com/xceptance/neodymium/util/JavaScriptUtilsTest.java
@@ -56,7 +56,7 @@ public void testWaitingAnimationSelectorUnavailableOnPage()
}
@Test
- public void testWaitingJQueryIsRequiered()
+ public void testWaitingJQueryIsRequired()
{
Neodymium.configuration().setProperty("neodymium.javaScriptUtils.loading.jQueryIsRequired", "true");
Neodymium.configuration().setProperty("neodymium.javaScriptUtils.timeout", "10000");
@@ -71,7 +71,7 @@ public void testWaitingJQueryIsRequiered()
}
@Test
- public void testWaitingJQueryIsNotRequiered()
+ public void testWaitingJQueryIsNotRequired()
{
Neodymium.configuration().setProperty("neodymium.javaScriptUtils.loading.jQueryIsRequired", "false");
Neodymium.configuration().setProperty("neodymium.javaScriptUtils.timeout", "10000");
diff --git a/src/test/java/com/xceptance/neodymium/util/NeodymiumWebDriverTestListener.java b/src/test/java/com/xceptance/neodymium/util/NeodymiumWebDriverTestListener.java
index c50bf3c39..3a1f7ce10 100644
--- a/src/test/java/com/xceptance/neodymium/util/NeodymiumWebDriverTestListener.java
+++ b/src/test/java/com/xceptance/neodymium/util/NeodymiumWebDriverTestListener.java
@@ -11,7 +11,7 @@
public class NeodymiumWebDriverTestListener extends NeodymiumWebDriverListener
{
- public int impliciteWaitCount = 0;
+ public int implicitWaitCount = 0;
public NeodymiumWebDriverTestListener()
{
@@ -40,6 +40,6 @@ public NeodymiumWebDriverTestListener()
public void beforeFindBy(By by, WebElement element, WebDriver driver)
{
super.beforeFindBy(by, element, driver);
- impliciteWaitCount++;
+ implicitWaitCount++;
}
}
diff --git a/src/test/java/com/xceptance/neodymium/util/SelenideAddonsTest.java b/src/test/java/com/xceptance/neodymium/util/SelenideAddonsTest.java
index 41063ddde..7e00c3d6a 100644
--- a/src/test/java/com/xceptance/neodymium/util/SelenideAddonsTest.java
+++ b/src/test/java/com/xceptance/neodymium/util/SelenideAddonsTest.java
@@ -133,11 +133,75 @@ public void beforeEvent(LogEvent currentLog)
Selenide.open("https://blog.xceptance.com/");
Neodymium.softAssertions(true);
- SelenideAddons.wrapAssertionError(() -> {
- Assert.assertEquals(errMessage, "MyPageTitle", Selenide.title());
+ try
+ {
+
+ SelenideAddons.wrapAssertionError(() -> {
+ Assert.assertEquals(errMessage, "MyPageTitle", Selenide.title());
+ });
+ }
+ finally
+ {
+ Neodymium.softAssertions(false);
+ SelenideLogger.removeListener("testListener");
+ }
+ }
+
+ @Test
+ public void testWrapSoftAssertionErrorWithoutMessage()
+ {
+ final String errMessage = "No error message provided by the Assertion.";
+
+ SelenideLogger.addListener("testListener", new LogEventListener()
+ {
+ @Override
+ public void afterEvent(LogEvent currentLog)
+ {
+ SelenideLog log = (SelenideLog) currentLog;
+ if (log.getStatus().equals(EventStatus.FAIL))
+ {
+ Assert.assertEquals("Selenide log event not matching", "Assertion error", log.getElement());
+ Assert.assertEquals("Selenide log event not matching", log.getSubject(), errMessage);
+ }
+ }
+
+ @Override
+ public void beforeEvent(LogEvent currentLog)
+ {
+ // ignore
+ }
});
- Neodymium.softAssertions(false);
- SelenideLogger.removeListener("testListener");
+ Selenide.open("https://blog.xceptance.com/");
+ Neodymium.softAssertions(true);
+ try
+ {
+ SelenideAddons.wrapAssertionError(() -> {
+ Assert.assertTrue(Selenide.title().startsWith("MyPageTitle"));
+ });
+ }
+ finally
+ {
+ Neodymium.softAssertions(false);
+ SelenideLogger.removeListener("testListener");
+ }
+ }
+
+ @Test
+ public void testWrapAssertionErrorWithoutMessage()
+ {
+ final String errMessage = "AssertionError: No error message provided by the Assertion.";
+ try
+ {
+ Selenide.open("https://blog.xceptance.com/");
+ SelenideAddons.wrapAssertionError(() -> {
+ Assert.assertTrue(Selenide.title().startsWith("MyPageTitle"));
+ });
+ }
+ catch (Throwable e)
+ {
+ Assert.assertTrue(e instanceof AssertionError);
+ Assert.assertEquals(errMessage, e.getMessage());
+ }
}
}