-
Notifications
You must be signed in to change notification settings - Fork 8
Developer Guide
amitmindstix edited this page Jan 15, 2018
·
10 revisions
- A module is a set of distinct features like cart, gallery etc.
- Features under cart module could be checkout, addtowishlist etc.
- Each feature can have scenarios. e.g. Checkout single product, Checkout multiple products
- Each module would have its own sub folder and subpackage.
- All feature files will reside under its module.
- All test classes (step definitions) reside under sub package for that module.
- All test classes will be named as
<Featurename>Test.java
- Each scenario can have one or more tags. Typically tags include module, feature, test-type, test-priority
- e.g.
@cart @checkout @singleproduct @smoke @medium
- Tags can also be given at feature file level (typically module and feature level tags)
Source tree of the project looks like below -
-
data
- Contains classes that represent test data -
page
- Contains POM classes (page object model). This can have sub packages based on modules -
utils
- Contains utility classes -
runner
- Contains Cucumber runner class - refer RunnerCourgette.java for more details -
stepdefinition
- Contains cucumber step definition classes (aka glue). This can have sub packages based on modules
-
feature
- Contains cucumber feature files (may have sub folders based on modules) -
testdata
- Contains test data files -
selectors.properties
- Selectors (externalized for ease of collaboration) -
log4j.properties
- Logging configuration (default log output is atLogs/testlogs.log
)
-
build.gradle
- Gradle build script -
gradle.properties
- Gradle configuration. Versions of dependencies and other variables -
docker-compose.yml
- Docker Compose definition of selenium-grid -
gradlew
- Shell script to run gradle (Linux/Mac) -
gradlew.bat
- Script to run gradle on Windows -
pom.xml
- Maven build script. Deprecated. Please use gradle instead of maven. Future version may drop maven support -
.travis.yml
- Travis CI configuration file. Ignore this if you are not using Travis. -
Jenkinsfile
- Jenkins Pipeline definition - supporting selenium grid, slack, email notifications -
Jenkinsfile-minimal
- Jenkins Pipeline definition with least complexity - used for local development
We use Courgette runner instead of plain JUnit runner. For reference documentation - see this Usage Snippet as below -
@RunWith(Courgette.class)
@CourgetteOptions(
runLevel = CourgetteRunLevel.FEATURE,
showTestOutput = true,
rerunFailedScenarios = false,
threads = 2,
cucumberOptions = @CucumberOptions(
features = {"src/test/resources/feature/ecom",
"src/test/resources/feature/setup",
"src/test/resources/feature/api"},
tags = "@cbt",
dryRun = false,
strict = true,
monochrome=true,
glue = {"com.mindstix.cb.stepdefinition.ecom",
"com.mindstix.cb.stepdefinition.api"},
plugin = {"pretty", "html:build/reports/cucumberreport/index",
"json:build/reports/cucumberreport/cucumber.json" }
))
-
runLevel
- feature level parallelization. Recommended to keep this to default -
threads
- no. of threads to be used to execute parallel tests -
rerunFailedScenarios
- turn to true if you want to execute failed scenarios once again -
dryRun
- turn to true to check if all cucumber steps are defined in java before actually running tests -
strict
- turn to false to allow tests to run even if some steps are not defined in java -
glue
- packages where your step definition classes exist -
plugin
- reporting configuration -
features
- folders where cucumber feature files reside