Skip to content

Commit

Permalink
updating selenium and jbehave versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafał Jamróz committed Sep 21, 2012
1 parent 5a21b5e commit 57c8a44
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 34 deletions.
47 changes: 32 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<spring.version>3.1.0.RC1</spring.version>
<spring.version>3.1.0.RELEASE</spring.version>
</properties>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
Expand Down Expand Up @@ -47,12 +48,12 @@
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.6.5.Final</version>
<version>4.1.7.Final</version>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.0.0</version>
<version>2.2.8</version>
<scope>runtime</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -119,24 +120,24 @@
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>2.2</version>
<version>2.2.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
<version>1.7.1</version>
</dependency>
<!-- commonly used utils libraries -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>r09</version>
<version>13.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.0.1</version>
<version>3.1</version>
</dependency>
<!-- test scope -->
<dependency>
Expand All @@ -147,16 +148,21 @@
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.9</version>
<artifactId>junit-dep</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.8.5</version>
<version>1.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
</dependency>
</dependencies>

<repositories>
Expand All @@ -176,9 +182,9 @@
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<selenium.version>2.13.0</selenium.version>
<jbehave.web.version>3.3.4</jbehave.web.version>
<jbehave.core.version>3.4.5</jbehave.core.version>
<selenium.version>2.25.0</selenium.version>
<jbehave.web.version>3.5.4</jbehave.web.version>
<jbehave.core.version>3.7</jbehave.core.version>

<warContextPath>cqrs-web</warContextPath>
<serverPort>8080</serverPort>
Expand Down Expand Up @@ -206,7 +212,7 @@
<!-- Execute acceptnace tests using multiple different browsers -->
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.6</version>
<version>2.12.3</version>
<executions>
<execution>
<id>Firefox acceptance tests</id>
Expand Down Expand Up @@ -400,6 +406,17 @@
<artifactId>jbehave-spring</artifactId>
<version>${jbehave.core.version}</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>jbehave-junit-runner</artifactId>
<version>1.0.1</version>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</profile>
</profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void beforeStories() throws Exception {

@AfterStories
public void afterStories() throws Exception {
get().quit();
end();
}

@BeforeScenario
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,75 @@
*/
package pl.com.bottega.acceptance.erp;

import org.jbehave.core.annotations.Configure;
import org.jbehave.core.annotations.UsingEmbedder;
import org.jbehave.core.annotations.UsingPaths;
import org.jbehave.core.annotations.spring.UsingSpring;
import org.jbehave.core.failures.FailingUponPendingStep;
import org.jbehave.core.junit.spring.SpringAnnotatedPathRunner;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.jbehave.core.Embeddable;
import org.jbehave.core.configuration.Configuration;
import org.jbehave.core.io.CodeLocations;
import org.jbehave.core.io.LoadFromClasspath;
import org.jbehave.core.io.StoryFinder;
import org.jbehave.core.junit.JUnitStories;
import org.jbehave.core.reporters.Format;
import org.jbehave.core.reporters.StoryReporterBuilder;
import org.jbehave.core.steps.InjectableStepsFactory;
import org.jbehave.core.steps.SilentStepMonitor;
import org.jbehave.core.steps.spring.SpringStepsFactory;
import org.jbehave.web.selenium.ContextView;
import org.jbehave.web.selenium.LocalFrameContextView;
import org.jbehave.web.selenium.PropertyWebDriverProvider;
import org.jbehave.web.selenium.SeleniumConfiguration;
import org.jbehave.web.selenium.SeleniumContext;
import org.jbehave.web.selenium.SeleniumStepMonitor;
import org.jbehave.web.selenium.WebDriverProvider;
import org.junit.runner.RunWith;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.GenericXmlApplicationContext;

import com.google.common.util.concurrent.MoreExecutors;

import de.codecentric.jbehave.junit.monitoring.JUnitReportingRunner;

@RunWith(JUnitReportingRunner.class)
public class SpringEnabledScenarioRunnerIT extends JUnitStories {

private Configuration configuration;

public SpringEnabledScenarioRunnerIT() {
configuredEmbedder().useExecutorService(MoreExecutors.sameThreadExecutor());
configuredEmbedder().useMetaFilters(Arrays.asList("-skip"));

WebDriverProvider driverProvider = new PropertyWebDriverProvider();
SeleniumContext context = new SeleniumContext();
ContextView contextView = new LocalFrameContextView().sized(500, 100);

Class<? extends Embeddable> embeddableClass = this.getClass();
configuration = new SeleniumConfiguration()
.useSeleniumContext(context)
.useWebDriverProvider(driverProvider)
.useStepMonitor(new SeleniumStepMonitor(contextView, context, new SilentStepMonitor()))
.useStoryLoader(new LoadFromClasspath(embeddableClass))
.useStoryReporterBuilder(
new StoryReporterBuilder()
.withCodeLocation(CodeLocations.codeLocationFromClass(embeddableClass))
.withDefaultFormats().withFormats(Format.CONSOLE, Format.TXT, Format.HTML, Format.XML));
}

import pl.com.bottega.acceptance.erp.SpringEnabledScenarioRunnerIT.MyReportBuilder;
@Override
protected List<String> storyPaths() {
return new StoryFinder().findPaths("src/test/resources", Arrays.asList("**/*.story"), new ArrayList<String>());
}

@RunWith(SpringAnnotatedPathRunner.class)
@UsingPaths(searchIn = "src/test/resources")
@Configure(storyReporterBuilder = MyReportBuilder.class, pendingStepStrategy = FailingUponPendingStep.class)
@UsingEmbedder
@UsingSpring(resources = { "classpath:/stepsConfiguration.xml", "classpath:/rmiClientContext.xml" })
public class SpringEnabledScenarioRunnerIT {
@Override
public Configuration configuration() {
return configuration;
}

public static class MyReportBuilder extends StoryReporterBuilder {
public MyReportBuilder() {
withFailureTrace(true).withFormats(org.jbehave.core.reporters.Format.CONSOLE);
}
}
@Override
public InjectableStepsFactory stepsFactory() {
ApplicationContext applicationContext = new GenericXmlApplicationContext("classpath:/stepsConfiguration.xml",
"classpath:/rmiClientContext.xml");
return new SpringStepsFactory(configuration, applicationContext);
}
}

0 comments on commit 57c8a44

Please sign in to comment.