How to use onTheFileSystem method of net.serenitybdd.cucumber.model.StoredFeatureFile class

Best Serenity Cucumber code snippet using net.serenitybdd.cucumber.model.StoredFeatureFile.onTheFileSystem Github


Full Screen

...57        StoredFeatureFile theStoredFeatureFile = StoredFeatureFile.withName(featureFileName);58        if (theStoredFeatureFile.existsOnTheClasspath()) {59            return StoredFeatureFile.withName(featureFileName).onTheClasspath();60        } else if (theStoredFeatureFile.existsOnTheFileSystem()) {61            return theStoredFeatureFile.onTheFileSystem();62        } else {63            return theStoredFeatureFile.fromTheConfiguredPaths();64        }65    }66    public class RowSelectorBuilder {67        private final boolean trim;68        public RowSelectorBuilder(boolean trim) {69            this.trim = trim;70        }71        public RowSelector betweenLine(int startRow) {72            return new RowSelector(startRow, trim);73        }74    }75}...

Full Screen

Full Screen Github


Full Screen

...28    }29    public boolean existsOnTheFileSystem() {30        return Files.exists(Paths.get(featureFileName));31    }32    public File onTheFileSystem() {33        return Paths.get(featureFileName).toFile();34    }35    36    public File fromTheConfiguredPaths() throws IOException {37        for(URI uri : CucumberWithSerenity.currentRuntimeOptions().getFeaturePaths()) {38            if (Files.exists(candidatePath(uri, featureFileName))) {39                return candidatePath(uri, featureFileName).toFile();40            }41        }42        throw new IOException("No such feature file found for " + featureFileName);43    }44    private Path candidatePath(URI uri, String featureFileName) {45        return Paths.get(Stream.of(uri.getPath(), featureFileName).collect(Collectors.joining(File.separator)));46    }...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:


You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Serenity Cucumber automation tests on LambdaTest cloud grid

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

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?