SparkFlow - EV Charging Platform
Microservices-based electric vehicle charging management system with comprehensive testing coverage and quality assurance practices.
SparkFlow - EV Charging Platform
A microservices-based platform for managing electric vehicle charging stations, demonstrating software quality testing practices and comprehensive test coverage. Developed for the Software Quality and Testing course at University of Aveiro.
Overview
SparkFlow provides a complete solution for EV charging station management, featuring separate microservices for station management, user management, and a React-based frontend, all orchestrated through Docker containers.
Architecture
Microservices Design
-
Station Service: Manages charging stations, availability, and pricing
- Spring Boot backend
- MySQL database
- RESTful API
-
User Service: Handles user accounts, reservations, and payment
- Spring Boot backend
- MongoDB database
- Authentication & authorization
-
Frontend: User interface for station discovery and management
- React application
- Responsive design
- Real-time updates
-
Orchestrator: Service coordination and API gateway
- Request routing
- Load balancing
- Service discovery
Key Features
For EV Drivers
- Station Discovery: Find nearby charging stations
- Real-time Availability: Check station status in real-time
- Reservation System: Reserve charging slots
- Payment Integration: Secure payment processing
- Charging History: Track charging sessions and costs
For Station Operators
- Station Management: Add and configure charging stations
- Pricing Control: Set dynamic pricing based on demand
- Analytics Dashboard: Monitor usage and revenue
- Maintenance Scheduling: Track station maintenance
- Performance Metrics: Station utilization reports
Testing Strategy
The project emphasizes comprehensive testing at all levels:
Unit Testing (JUnit 5)
// Service layer tests
- Business logic validation
- Edge case handling
- Exception scenarios
- Mock dependencies with Mockito
Integration Testing
// Spring Boot Test
- Controller tests with MockMvc
- Repository tests with TestContainers
- Service integration tests
- Database transaction tests
API Testing
- REST Assured for endpoint testing
- Contract testing between services
- Request/response validation
- Error handling verification
UI Testing (Selenium)
// End-to-end tests
- User journey testing
- Form submissions
- Navigation flows
- Cross-browser compatibility
Performance Testing
- Load testing with JMeter
- Response time benchmarks
- Concurrent user simulation
- Resource utilization monitoring
Code Quality Practices
Static Analysis (SonarQube)
- Code smell detection
- Bug identification
- Security vulnerability scanning
- Code coverage reporting
- Technical debt tracking
- Maintainability index
Test Coverage
- Target: 80%+ code coverage
- Line coverage metrics
- Branch coverage analysis
- Mutation testing with PIT
Code Standards
- Google Java Style Guide
- Automated formatting with google-java-format
- Checkstyle integration
- PMD analysis
- SpotBugs for bug detection
Technical Implementation
Backend Technologies
// Spring Boot Stack
- Spring Boot 3.x
- Spring Data JPA (MySQL)
- Spring Data MongoDB
- Spring Security
- Spring Cloud (service discovery)
- Hibernate ORM
Database Design
- MySQL: Relational data for stations and reservations
- MongoDB: User profiles and flexible document storage
- Data consistency patterns
- Transaction management
Frontend
// React Application
- React 18
- React Router for navigation
- Axios for API calls
- Material-UI components
- State management
- Responsive design
Containerization
# Docker Compose orchestration
- Multi-container application
- Service networking
- Volume persistence
- Environment configuration
- Health checks
CI/CD Pipeline
Automated Testing
- Unit tests run on every commit
- Integration tests on pull requests
- E2E tests before deployment
- Coverage reports to SonarCloud
Build Process
# Maven build lifecycle
mvn clean test # Run tests
mvn verify # Integration tests
mvn sonar:sonar # Code analysis
mvn package # Build JAR
API Documentation
Station Service Endpoints
GET /api/stations # List all stations
GET /api/stations/{id} # Get station details
POST /api/stations # Create station
PUT /api/stations/{id} # Update station
DELETE /api/stations/{id} # Delete station
GET /api/stations/nearby # Find nearby stations
User Service Endpoints
POST /api/users/register # User registration
POST /api/users/login # User authentication
GET /api/users/profile # Get user profile
POST /api/reservations # Create reservation
GET /api/reservations # User reservations
Testing Examples
Unit Test Example
@Test
void testStationAvailability() {
// Given
Station station = new Station();
station.setCapacity(10);
station.setActiveConnections(5);
// When
boolean available = stationService.isAvailable(station);
// Then
assertTrue(available);
}
Integration Test Example
@SpringBootTest
@AutoConfigureMockMvc
class StationControllerTest {
@Autowired
MockMvc mockMvc;
@Test
void testGetStationById() throws Exception {
mockMvc.perform(get("/api/stations/1"))
.andExpect(status().isOk())
.andExpect(jsonPath("$.id").value(1));
}
}
Quality Metrics Achieved
- Code Coverage: 85%+ overall
- SonarQube Rating: A (Maintainability)
- Bug Density: < 0.5 bugs per 100 lines
- Technical Debt: < 5 days
- Security Vulnerabilities: Zero critical/high
- Test Success Rate: 100%
Project Structure
TQS-SparkFlow/
├── orchestrator/
│ ├── station-service/
│ │ ├── src/
│ │ ├── pom.xml
│ │ └── Dockerfile
│ ├── user-service/
│ │ ├── src/
│ │ ├── pom.xml
│ │ └── Dockerfile
│ └── frontend/
│ ├── ui/
│ ├── package.json
│ └── Dockerfile
├── docker-compose.yml
└── README.md
Development Workflow
Local Development
# Start all services
docker-compose up
# Run tests
mvn test
# Check code quality
mvn sonar:sonar
# Generate coverage report
mvn jacoco:report
Test-Driven Development
- Write failing test
- Implement feature
- Run tests
- Refactor code
- Verify coverage
Learning Outcomes
This project demonstrates expertise in:
- Software Testing: Comprehensive testing strategies at all levels
- Quality Assurance: Code quality metrics and static analysis
- Test Automation: Automated testing in CI/CD pipelines
- Microservices: Service-oriented architecture patterns
- Spring Boot: Enterprise Java development
- Docker: Container orchestration
- Code Quality Tools: SonarQube, JaCoCo, Checkstyle
- Testing Frameworks: JUnit 5, Mockito, Selenium, REST Assured
Technical Highlights
- Test Pyramid: Balanced unit, integration, and E2E tests
- Test Coverage: > 80% code coverage maintained
- Code Quality: A-rated maintainability on SonarQube
- Automated QA: CI/CD integration for quality gates
- Performance Testing: Load testing for scalability validation
- Security Testing: Automated vulnerability scanning
- Documentation: Comprehensive test documentation
Project Context
Developed for the Software Quality and Testing (TQS) course at University of Aveiro, emphasizing:
- Testing methodologies (unit, integration, E2E)
- Code quality metrics and static analysis
- Test automation and CI/CD integration
- Quality assurance best practices
- Microservices testing strategies
- Performance and security testing
Results
Successfully delivered a production-ready system with:
- 85%+ test coverage across all services
- Zero critical bugs identified in production
- A-rated code quality on all metrics
- Sub-second response times under normal load
- 100+ automated tests running in CI/CD
- Comprehensive documentation for all test scenarios