This project demonstrates an example implementation of Cucumber integration tests using Kotlin and Maven. It utilizes multiple-cucumber-html-reporter to generate an HTML test report.
Ensure you have the following installed:
- Java 17+
- Maven
- Node.js & npm (for report generation)
- Git
-
Clone the repository:
git clone git@gitlab.com:deroosean/hellocucumber.git cd hellocucumber -
Run tests with Maven:
mvn clean test || true
The
|| trueensures that even if tests fail, the pipeline continues. -
Generate the HTML report:
node generateReport.js
-
View the report:
- Open the generated report in your browser:
open reports/index.html # MacOS xdg-open reports/index.html # Linux start reports\index.html # Windows
- Open the generated report in your browser:
This project includes a .gitlab-ci.yml file for automating the test execution and report generation.
-
Run Tests:
mvn clean test || true- Runs the Cucumber tests.
|| trueensures that failures do not stop the pipeline.
-
Generate HTML Report:
node generateReport.js- Converts test results into an HTML report inside the
/reportsfolder.
- Converts test results into an HTML report inside the
/
├── src/test/kotlin # Cucumber step definitions & feature files
├── reports # Generated HTML reports
├── generateReport.js # Script for generating the test report
├── pom.xml # Maven configuration
├── gitlab-ci.yml # CI/CD pipeline definition
└── README.md # This file
This project uses the following main dependencies:
- Cucumber for BDD testing (Maven Repository)
- JUnit 5 for running tests (Maven Repository)
- multiple-cucumber-html-reporter for generating reports (NPM package)
- Tests are failing, but I still want the report?
- The pipeline ensures the report is generated even if tests fail.
- Reports folder is empty?
- Ensure that
generateReport.jsis properly executed after running tests.
- Ensure that
- Node.js is not recognized?
- Ensure Node.js is installed and added to your system
PATH.
- Ensure Node.js is installed and added to your system
Feel free to submit issues and pull requests to improve this project.
Happy testing! 🚀