Skip to content

A Clean Architecture based CRUD application developed using BDD and TDD principles. It leverages SpecFlow with Gherkin syntax for behavior driven development, along with NUnit and xUnit for testing. The solution is Dockerized, exposes RESTful APIs, and features UI built with Blazor WebAssembly. focused on e2e and bdd.

Notifications You must be signed in to change notification settings

ArmanShirzad/SpecflowBDDTDDCleanArchCRUDApplicationusingDotnet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CRUD Test Application with BDD & TDD using Specflow

Demo

Demo

Table of Contents

Overview

The CRUD Test Application is a full-stack web application designed to manage customer data. It allows users to perform Create, Read, Update, and Delete (CRUD) operations on customer records. The application adheres to best practices in software development, ensuring consistency, scalability, and maintainability.

Features

  • Add Customer: Create new customer records with validated input.
  • View Customers: Display a list of all customers with search and filter capabilities.
  • Edit Customer: Update existing customer information.
  • Delete Customer: Remove customer records securely.
  • Responsive UI: Built with Blazor WebAssembly for a seamless user experience across devices.
  • API Documentation: Integrated Swagger UI for easy API exploration and testing.
  • Automated Testing: Comprehensive acceptance tests to ensure application reliability.

Technologies Used

Frontend:

  • Blazor WebAssembly - For building interactive web UIs using C#.

Backend:

  • ASP.NET Core - For building robust and scalable APIs.
  • Entity Framework Core - For ORM and database interactions.
  • MediatR - For implementing the mediator pattern.
  • FluentValidation - For model validation.

Testing:

  • SpecFlow - For Behavior-Driven Development (BDD) style acceptance tests.
  • xUnit - For unit and integration testing.

Other Tools:

  • AutoMapper - For object-object mapping.
  • Swagger - For API documentation and testing.

Setup and Installation

Prerequisites

  • .NET 7 SDK

  • Visual Studio 2022 or Visual Studio Code with necessary extensions.

Steps

  1. Clone the Repository:

    git clone https://github.com/your-repo/crud-test-dotnet.git
    cd crud-test-dotnet
  2. Navigate to the Server Project and Restore Dependencies:

    cd src/Presentation.Api
    dotnet restore
  3. Apply Database Migrations:

    dotnet ef database update
  4. Navigate to the Client Project and Restore Dependencies:

    cd ../Presentation.Client
    dotnet restore
  5. Navigate to the Shared Project and Restore Dependencies:

    cd ../Presentation.Shared
    dotnet restore
  6. Navigate to the Acceptance Tests Project and Restore Dependencies:

    cd ../../tests/AcceptanceTests
    dotnet restore

Running the Application

Running Locally

  1. Start the Server:

    cd src/Presentation.Api
    dotnet run

    The API will be available at https://localhost:5091/. Swagger UI can be accessed at https://localhost:5091/swagger.

  2. Start the Client:

    cd ../Presentation.Client
    dotnet run

    The Blazor WebAssembly client will be available at https://localhost:7046/.

  3. Access the Application: Open your browser and navigate to https://localhost:7046/ to use the application.

Running Tests

Acceptance Tests

  1. Navigate to the Acceptance Tests Project:

    cd tests/AcceptanceTests
  2. Run Tests:

    dotnet test

Unit and Integration Tests

  • Similar steps apply for running unit and integration tests within their respective test projects.
  1. Navigate to the Project Root:

    cd crud-test-dotnet
  2. Build and Run Containers:

    docker-compose up --build
  3. Access the Application:

Project Structure

crud-test-dotnet/
├── src/
│   ├── Core/
│   │   ├── Application/            # Application layer - CQRS, Business Logic, MediatR Commands
│   │   └── Domain/                 # Domain entities and business rules
│   ├── Infrastructure/
│   │   └── Persistence/            # Data access, database configurations, repositories
│   ├── Presentation/
│   │   ├── Api/                    # ASP.NET Core API Project
│   │   ├── Client/                 # Blazor WebAssembly Project
│   │   └── Shared/                 # Shared DTOs and contracts between client and API
├── tests/
│   ├── AcceptanceTests/            # SpecFlow-based acceptance testing project
│   └── UnitTests/                  # xUnit-based unit testing
├
└── README.md
  • Core.Application: Business logic, application services, commands, and queries.
  • Core.Domain: Domain models, including entities and value objects.
  • Infrastructure.Persistence: Persistence layer for data access, including database context and repository implementations.
  • Presentation.Api: ASP.NET Core Web API for backend services.
  • Presentation.Client: Blazor WebAssembly for the frontend UI.
  • Presentation.Shared: Shared DTOs and validation logic for consistency.
  • AcceptanceTests: BDD acceptance tests using SpecFlow.
  • UnitTests: Unit tests for core components using xUnit.

About

A Clean Architecture based CRUD application developed using BDD and TDD principles. It leverages SpecFlow with Gherkin syntax for behavior driven development, along with NUnit and xUnit for testing. The solution is Dockerized, exposes RESTful APIs, and features UI built with Blazor WebAssembly. focused on e2e and bdd.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •