A comprehensive test management system built with Java and Cucumber for BDD (Behavior-Driven Development).
Test Recorder is a test management application that allows you to:
- Create and manage test cases
- Execute tests and record results
- Track test history with timestamps
- Filter and organize tests by status
- Store test data in memory or database (HSQLDB)
- View test results in a Swing-based UI
test-recorder/
├── src/
│ ├── main/
│ │ └── java/
│ │ └── com/testrecorder/
│ │ ├── domain/ # Domain model and business entities
│ │ │ ├── Test.java
│ │ │ ├── TestRun.java
│ │ │ ├── Configuration.java
│ │ │ ├── TestResult.java (enum)
│ │ │ ├── TestStatus.java (enum)
│ │ │ ├── TestDate.java
│ │ │ ├── IssueId.java
│ │ │ ├── SubIssueId.java
│ │ │ ├── Name.java
│ │ │ └── MyString.java
│ │ ├── repository/ # Data access layer
│ │ │ ├── TestRepository.java (interface)
│ │ │ ├── InMemoryTestRepository.java
│ │ │ └── DatabaseTestRepository.java
│ │ ├── service/ # Business logic layer
│ │ │ ├── TestService.java
│ │ │ ├── DateTimeProvider.java (interface)
│ │ │ ├── RunnerProvider.java (interface)
│ │ │ ├── SystemDateTimeProvider.java
│ │ │ ├── SystemRunnerProvider.java
│ │ │ ├── TestDoubleDateTimeProvider.java
│ │ │ └── TestDoubleRunnerProvider.java
│ │ ├── ui/ # User interface components
│ │ │ └── TestTablePanel.java
│ │ ├── util/ # Utility classes
│ │ │ └── EnvironmentUtil.java
│ │ └── TestRecorderApplication.java # Main entry point
│ └── test/
│ ├── java/
│ │ └── com/testrecorder/
│ │ ├── CucumberTestRunner.java
│ │ └── steps/ # Cucumber step definitions
│ │ ├── TestContext.java
│ │ ├── CommonStepDefinitions.java
│ │ ├── TestRecorderStepDefinitions.java
│ │ ├── BusinessRulesStepDefinitions.java
│ │ ├── DomainTermsStepDefinitions.java
│ │ ├── EntitiesStepDefinitions.java
│ │ ├── EnvironmentStepDefinitions.java
│ │ ├── FilterStepDefinitions.java
│ │ └── UIStepDefinitions.java
│ └── resources/
│ └── features/ # Cucumber feature files
│ ├── TestRecorder.feature
│ ├── Entities.feature
│ ├── UI.feature
│ ├── BusinessRules.feature
│ ├── DomainTerms.feature
│ ├── Flow.feature
│ ├── OS.feature
│ └── SortAndFilter.feature
└── pom.xml # Maven configuration
- Test: Represents a test case with attributes like Issue ID, Sub Issue ID, Name, Runner, Last Result, etc.
- TestRun: Represents an execution of a test with result, comments, runner, and timestamp
- Configuration: Manages application settings including database connection and test doubles
- IssueId: Must be exactly 5 alphanumeric characters without spaces
- SubIssueId: Must be exactly 3 alphanumeric characters without spaces
- Name: Alphanumeric characters and spaces only (invalid characters removed)
- MyString: Removes invalid characters like parentheses, dollar signs, question marks
- TestDate: Supports date format "MMM d, yyyy, h:mm:ss a" and special "Never" value
- Active: Test is currently in use
- Inactive: Test is temporarily disabled
- Retired: Test is permanently retired
- Success: Test passed
- Failure: Test failed
- When a test is run, it updates the test's last result, date last run, and moves the previous date last run to date previous result
- Tests can only be updated if the new test run's date is after the current date last run
- Adding a test that already exists (same Issue ID and Sub Issue ID) does not modify the existing test
- Java 11 or higher
- Maven 3.6 or higher
# Compile the project
mvn clean compile
# Run tests
mvn test
# Package as JAR
mvn package# Run the main application
mvn exec:java -Dexec.mainClass="com.testrecorder.TestRecorderApplication"
# Or run the compiled JAR
java -jar target/test-recorder-1.0.0.jarThe tests are organized into several feature files:
- TestRecorder.feature: Core test recording functionality
- Entities.feature: Configuration and database operations
- UI.feature: User interface tests (mostly manual)
- BusinessRules.feature: Business logic validation
- DomainTerms.feature: Domain model validation rules
- Flow.feature: End-to-end test flows
- OS.feature: Environment variable management
- SortAndFilter.feature: Filtering and sorting functionality
To run all tests:
mvn testTo run specific feature:
mvn test -Dcucumber.filter.tags="@tag-name"To exclude manual tests:
mvn test -Dcucumber.filter.tags="not @manual"The application can be configured using a properties file. Create a config.properties file with the following settings:
rootFilePath=target/
useTestDoubleForDateTime=false
useTestDoubleForRunner=false
valueTestDoubleForDateTime=
valueTestDoubleForRunner=
formNotCloseOnExit=false
databaseURL=jdbc:hsqldb:hsql://localhost
databaseJDBCDriver=org.hsqldb.jdbcDriver
databasePassword=
databaseUserID=SALoad the configuration:
java -Dconfig.file=config.properties -jar target/test-recorder-1.0.0.jarThe application supports HSQLDB for persistent storage. To use the database:
- Start HSQLDB server:
java -cp hsqldb.jar org.hsqldb.server.Server --database.0 file:testrecorder --dbname.0 testrecorder- Configure the application to use the database in your configuration file:
databaseURL=jdbc:hsqldb:hsql://localhost/testrecorderThe application supports test doubles for DateTime and Runner providers, which is useful for testing:
- DateTimeProvider: Can be set to return a fixed date/time for testing
- RunnerProvider: Can be set to return a fixed runner name for testing
Enable test doubles in configuration:
useTestDoubleForDateTime=true
valueTestDoubleForDateTime=Oct 1, 2022, 12:30:01 AM
useTestDoubleForRunner=true
valueTestDoubleForRunner=TestRunnerTestService testService = new TestService(repository, dateTimeProvider, runnerProvider);
testService.addTest("12345", "678", "My Test", "test.feature");testService.runTest("12345", "678", TestResult.SUCCESS, "Test passed");List<Test> activeTests = testService.filterTests(true, false, false);The project uses Cucumber for BDD testing. Step definitions are organized by feature area:
- CommonStepDefinitions: Shared steps for configuration and setup
- TestRecorderStepDefinitions: Test recording operations
- BusinessRulesStepDefinitions: Business rule validation
- DomainTermsStepDefinitions: Domain validation
- EntitiesStepDefinitions: Configuration and database operations
- EnvironmentStepDefinitions: Environment variable management
- FilterStepDefinitions: Filtering and sorting
- UIStepDefinitions: User interface operations
After running tests, reports are generated in:
- HTML Report:
target/cucumber-reports.html - JSON Report:
target/cucumber.json
This is a sample project for demonstration purposes.
Generated for Test Recorder project