Skip to content

Commit

Permalink
#114: Update Maven dependencies as far as possible (part1: Cucumber, …
Browse files Browse the repository at this point in the history
…Selenide)
  • Loading branch information
Marcel Pfotenhauer committed Mar 23, 2020
1 parent ae76255 commit 3045e79
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 11 deletions.
9 changes: 7 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<maven.compiler.target.version>1.8</maven.compiler.target.version>
<surefire.version>2.22.2</surefire.version>
<allure.version>2.13.1</allure.version>
<cucumber.version>4.8.0</cucumber.version>
<cucumber.version>5.5.0</cucumber.version>
<log4j.version>2.13.0</log4j.version>
</properties>

Expand Down Expand Up @@ -209,6 +209,11 @@
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java8</artifactId>
Expand Down Expand Up @@ -252,7 +257,7 @@
<dependency>
<groupId>com.codeborne</groupId>
<artifactId>selenide</artifactId>
<version>5.6.0</version>
<version>5.10.0</version>
<exclusions>
<exclusion>
<groupId>net.lightbody.bmp</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -106,9 +107,9 @@ else if (parametersResult instanceof Object[])
else
{
p = new Object[]
{
para
};
{
para
};
}

iterations.add(new ParameterStatementData(parameterSetCounter, p, parameterFrameworkFields));
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
68 changes: 68 additions & 0 deletions src/main/java/io/cucumber/junit/NeodymiumCucumberWrapper.java
Original file line number Diff line number Diff line change
@@ -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<ParentRunner<?>>
{
private Cucumber cucumber;

public NeodymiumCucumberWrapper(Class<?> clazz) throws InitializationError, IOException
{
super(clazz);
cucumber = new Cucumber(clazz);
}

// from Cucumber
@Override
protected List<ParentRunner<?>> 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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 3045e79

Please sign in to comment.