How to use stepsFactory method of net.serenitybdd.jbehave.SerenityStories class

Best Serenity jBehave code snippet using net.serenitybdd.jbehave.SerenityStories.stepsFactory

Run Serenity jBehave automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

copy
1import net.serenitybdd.jbehave.SerenityStepFactory;
2import net.serenitybdd.jbehave.SerenityStories;
3import org.jbehave.core.steps.InjectableStepsFactory;
4
5public class WebTest extends SerenityStories {
6
7    @Override
8    public InjectableStepsFactory stepsFactory() {
9        return SerenityStepFactory.withStepsFromPackage("steps", configuration()).andClassLoader(getClassLoader());
10    }
11}
Full Screen
copy
1/*
2 * Copyright 2018 Alfresco, Inc. and/or its affiliates.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *       http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.activiti.cloud.acc.shared.serenity;
18
19import net.serenitybdd.jbehave.SerenityStories;
20import org.jbehave.core.steps.InjectableStepsFactory;
21
22/**
23 * Custom SerenityStories
24 */
25public class ExtendedSerenityStories extends SerenityStories {
26
27    @Override
28    public InjectableStepsFactory stepsFactory() {
29        return new ExtendedSerenityStepsFactory(configuration(),
30                                                getRootPackage(),
31                                                getClassLoader());
32    }
33
34    @Override
35    protected String getRootPackage() {
36        return "org.activiti.cloud.acc";
37    }
38}
39
Full Screen
copy
1package milvik.bima.runner;
2import org.jbehave.core.configuration.Configuration;
3import org.jbehave.core.configuration.MostUsefulConfiguration;
4import org.jbehave.core.io.LoadFromClasspath;
5import org.jbehave.core.reporters.Format;
6import org.jbehave.core.reporters.StoryReporterBuilder;
7import org.jbehave.core.steps.InjectableStepsFactory;
8
9import net.serenitybdd.jbehave.SerenityStepFactory;
10import net.serenitybdd.jbehave.SerenityStories;
11
12public class TestRunner extends SerenityStories{
13	
14	protected String storiesToRun = "greytHRLogin.story";
15	protected String storiesFoldersToRun = "";
16
17	public TestRunner(){
18		findStoriesCalled(storiesToRun);
19		//findStoriesIn(storiesFoldersToRun);
20	}
21
22	@Override
23	public Configuration configuration(){
24		return new MostUsefulConfiguration().useStoryLoader(new LoadFromClasspath(this.getClass().getClassLoader()))
25				.useStoryReporterBuilder(new StoryReporterBuilder().withDefaultFormats().withFormats(Format.CONSOLE,Format.HTML));
26	}
27	
28	@Override
29	public InjectableStepsFactory stepsFactory(){
30		return SerenityStepFactory.withStepsFromPackage(getstepsPackage(), configuration()).andClassLoader(getClassLoader());
31	}
32
33	public String getstepsPackage(){
34		return "milvik.bima.mapper";
35	}
36
37}
38
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Trigger stepsFactory code on LambdaTest Cloud Grid

Execute automation tests with stepsFactory on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)