From 3045e79651e2e6f0679dedc94c20a7a18c759b13 Mon Sep 17 00:00:00 2001 From: Marcel Pfotenhauer Date: Mon, 23 Mar 2020 14:00:14 +0100 Subject: [PATCH] #114: Update Maven dependencies as far as possible (part1: Cucumber, Selenide) --- pom.xml | 9 ++- .../neodymium/NeodymiumCucumberRunner.java | 4 +- .../parameter/ParameterStatement.java | 11 ++- .../neodymium/util/WebDriverUtils.java | 2 +- .../junit/NeodymiumCucumberWrapper.java | 68 +++++++++++++++++++ .../CucumberContextGetsCleared.java | 2 +- .../CucumberContextSteps.java | 2 +- .../testclasses/cucumber/CucumberSupport.java | 2 +- 8 files changed, 89 insertions(+), 11 deletions(-) create mode 100644 src/main/java/io/cucumber/junit/NeodymiumCucumberWrapper.java diff --git a/pom.xml b/pom.xml index 1baddea41..e5221eec5 100644 --- a/pom.xml +++ b/pom.xml @@ -55,7 +55,7 @@ 1.8 2.22.2 2.13.1 - 4.8.0 + 5.5.0 2.13.0 @@ -209,6 +209,11 @@ cucumber-junit ${cucumber.version} + + io.cucumber + cucumber-java + ${cucumber.version} + io.cucumber cucumber-java8 @@ -252,7 +257,7 @@ com.codeborne selenide - 5.6.0 + 5.10.0 net.lightbody.bmp diff --git a/src/main/java/com/xceptance/neodymium/NeodymiumCucumberRunner.java b/src/main/java/com/xceptance/neodymium/NeodymiumCucumberRunner.java index 1e63c4c6a..5c57f1ff4 100644 --- a/src/main/java/com/xceptance/neodymium/NeodymiumCucumberRunner.java +++ b/src/main/java/com/xceptance/neodymium/NeodymiumCucumberRunner.java @@ -5,9 +5,9 @@ import org.junit.runner.notification.RunNotifier; import org.junit.runners.model.InitializationError; -import io.cucumber.junit.Cucumber; +import io.cucumber.junit.NeodymiumCucumberWrapper; -public class NeodymiumCucumberRunner extends Cucumber +public class NeodymiumCucumberRunner extends NeodymiumCucumberWrapper { public NeodymiumCucumberRunner(Class clazz) throws InitializationError, IOException { 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 bd81d2d82..4bd13b719 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 @@ -1,6 +1,7 @@ package com.xceptance.neodymium.module.statement.parameter; import java.lang.reflect.Field; +import java.lang.reflect.Modifier; import java.text.MessageFormat; import java.util.Arrays; import java.util.LinkedList; @@ -106,9 +107,9 @@ else if (parametersResult instanceof Object[]) else { p = new Object[] - { - para - }; + { + para + }; } iterations.add(new ParameterStatementData(parameterSetCounter, p, parameterFrameworkFields)); @@ -189,6 +190,10 @@ else if (fieldType == boolean.class || fieldType == Boolean.class) try { + if (Modifier.isFinal(field.getModifiers())) + { + throw new IllegalAccessException(); + } field.set(testClassInstance, value); } catch (IllegalArgumentException e) diff --git a/src/main/java/com/xceptance/neodymium/util/WebDriverUtils.java b/src/main/java/com/xceptance/neodymium/util/WebDriverUtils.java index 4fbe18662..aebc36457 100644 --- a/src/main/java/com/xceptance/neodymium/util/WebDriverUtils.java +++ b/src/main/java/com/xceptance/neodymium/util/WebDriverUtils.java @@ -9,7 +9,7 @@ import com.xceptance.neodymium.module.statement.browser.BrowserStatement; import com.xceptance.neodymium.module.statement.browser.multibrowser.WebDriverCache; -import io.cucumber.core.api.Scenario; +import io.cucumber.java.Scenario; public class WebDriverUtils { diff --git a/src/main/java/io/cucumber/junit/NeodymiumCucumberWrapper.java b/src/main/java/io/cucumber/junit/NeodymiumCucumberWrapper.java new file mode 100644 index 000000000..3191658d9 --- /dev/null +++ b/src/main/java/io/cucumber/junit/NeodymiumCucumberWrapper.java @@ -0,0 +1,68 @@ +package io.cucumber.junit; + +import java.io.IOException; +import java.util.List; + +import org.junit.runner.Description; +import org.junit.runner.manipulation.Filter; +import org.junit.runner.manipulation.NoTestsRemainException; +import org.junit.runner.notification.RunNotifier; +import org.junit.runners.ParentRunner; +import org.junit.runners.model.InitializationError; +import org.junit.runners.model.RunnerScheduler; +import org.junit.runners.model.Statement; + +public class NeodymiumCucumberWrapper extends ParentRunner> +{ + private Cucumber cucumber; + + public NeodymiumCucumberWrapper(Class clazz) throws InitializationError, IOException + { + super(clazz); + cucumber = new Cucumber(clazz); + } + + // from Cucumber + @Override + protected List> getChildren() + { + return cucumber.getChildren(); + } + + @Override + protected Description describeChild(ParentRunner child) + { + return cucumber.describeChild(child); + } + + @Override + protected void runChild(ParentRunner child, RunNotifier notifier) + { + cucumber.runChild(child, notifier); + } + + @Override + protected Statement childrenInvoker(RunNotifier notifier) + { + return cucumber.childrenInvoker(notifier); + } + + @Override + public void setScheduler(RunnerScheduler scheduler) + { + cucumber.setScheduler(scheduler); + } + + // from ParentsRunner + @Override + public void run(RunNotifier notifier) + { + cucumber.run(notifier); + } + + @Override + public void filter(Filter filter) throws NoTestsRemainException + { + cucumber.filter(filter); + } +} 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 18e249455..c0579adb3 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 @@ -10,4 +10,4 @@ @CucumberOptions(features = "src/test/resources/com/xceptance/neodymium/testclasses/context/cucumbercontextclear", glue = "com/xceptance/neodymium/testclasses/context/cucumbercontextclear") public class CucumberContextGetsCleared { -} +} \ No newline at end of file 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 7adb338fc..5cbcbb075 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,9 +6,9 @@ import com.xceptance.neodymium.util.NeodymiumConfiguration; import com.xceptance.neodymium.util.WebDriverUtils; -import io.cucumber.core.api.Scenario; import io.cucumber.java.After; import io.cucumber.java.Before; +import io.cucumber.java.Scenario; import io.cucumber.java.en.Given; public class CucumberContextSteps 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 775c3462a..ca8b2ea67 100644 --- a/src/test/java/com/xceptance/neodymium/testclasses/cucumber/CucumberSupport.java +++ b/src/test/java/com/xceptance/neodymium/testclasses/cucumber/CucumberSupport.java @@ -7,9 +7,9 @@ import com.xceptance.neodymium.util.Neodymium; import com.xceptance.neodymium.util.WebDriverUtils; -import io.cucumber.core.api.Scenario; import io.cucumber.java.After; import io.cucumber.java.Before; +import io.cucumber.java.Scenario; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then;