Skip to content
This repository was archived by the owner on Jan 20, 2026. It is now read-only.

Update test cases for compulsory #2#30

Merged
juuwel merged 9 commits into
mainfrom
update-test-cases
Nov 2, 2025
Merged

Update test cases for compulsory #2#30
juuwel merged 9 commits into
mainfrom
update-test-cases

Conversation

@juuwel
Copy link
Copy Markdown
Member

@juuwel juuwel commented Nov 2, 2025

This pull request introduces several improvements and refactorings to the hotel booking system's BDD tests, booking logic, and Postman collections. The main focus is on making the BDD tests more robust and maintainable by introducing utility methods for test data setup, refining booking logic for date comparisons, and updating API test collections for accuracy and consistency.

Test Infrastructure and Logic Improvements

  • Introduced a new Utilities class (HotelBooking.BDDTests.Utils.Utilities) that provides reusable mock setup methods for repositories, improving the maintainability and clarity of BDD tests. The booking repository mock now includes bookings for both available and fully occupied periods, supporting more realistic test scenarios.
  • Refactored BookingStepDefinitions to use the new utility methods for setting up mocks, removing inline mock setup and simplifying the test class construction. [1] [2]

Booking Logic Fixes

  • Updated the room availability logic in BookingManager to use date-only comparisons (DateTime.Date) for booking overlaps, fixing potential issues with time components affecting booking results.

BDD Feature and Scenario Enhancements

  • Improved the Booking.feature file by introducing a Background section to define a fully booked period, converting scenarios to use outlines with parameterized date offsets, and updating test cases for both successful and failed bookings. This makes the feature file more descriptive and test coverage more comprehensive. [1] [2] [3]

API Testing and Postman Collection Updates

  • Updated the Postman collection (HotelBooking.postman_collection.json and related files) with new IDs, improved response metadata, and more realistic request/response payloads for bookings. Adjusted scripts to use deterministic values for key fields, ensuring consistent and predictable API tests. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21]

Build and Test Pipeline Adjustment

  • Modified the GitHub Actions workflow to start the API using a specific launch profile (Test) instead of setting environment variables directly, aligning the test environment setup with .NET best practices.

@postman
Copy link
Copy Markdown

postman Bot commented Nov 2, 2025

The file is linked to HotelBooking.WebApi collection in Postman.
View changes

@juuwel juuwel marked this pull request as ready for review November 2, 2025 14:57
@juuwel juuwel merged commit b923172 into main Nov 2, 2025
1 check passed
@juuwel juuwel deleted the update-test-cases branch November 2, 2025 14:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant