Skip to content

Commit c25dac2

Browse files
Removing common patterns
1 parent d1b83e0 commit c25dac2

File tree

1 file changed

+5
-59
lines changed

1 file changed

+5
-59
lines changed

docs/RepositoryGuide.md

Lines changed: 5 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,14 @@ It is intended to help developers and testers understand the structure, usage, a
1515
- [Naming Conventions](#naming-conventions)
1616
- [Classes](#classes)
1717
- [Useful Classes](#useful-classes)
18+
- [When to Use](#when-to-use)
19+
- [Why Use](#why-use)
20+
- [How to Use](#how-to-use)
21+
- [Why Use Repositories?](#why-use-repositories)
22+
- [Example: Using a Repository in a Test](#example-using-a-repository-in-a-test)
1823
- [Class Descriptions](#class-descriptions)
1924
- [Relationships/Dependencies](#relationshipsdependencies)
2025
- [Utility Classes](#utility-classes)
21-
- [Common Patterns](#common-patterns)
2226
- [Utilities](#utilities)
2327
- [Available Utilities](#available-utilities)
2428
- [UI Applications](#ui-applications)
@@ -491,64 +495,6 @@ You can also use repositories to fetch or update domain objects, set up test dat
491495

492496
---
493497

494-
### Common Patterns
495-
496-
- **Repository Pattern**
497-
Used for DB access and data management (e.g., `SubjectRepository`, `PersonRepository`).
498-
499-
**Example:**
500-
501-
```python
502-
from classes.repositories.subject_repository import SubjectRepository
503-
504-
repo = SubjectRepository()
505-
subject = repo.find_by_nhs_number("1234567890")
506-
```
507-
508-
**Benefits:**
509-
510-
- Centralizes data access logic
511-
- Makes tests and business logic independent of database details
512-
- Improves maintainability and testability
513-
514-
- **Factory Pattern**
515-
Used in data creation utilities for generating test data.
516-
517-
**Example:**
518-
519-
```python
520-
from classes.data.data_creation import DataFactory
521-
522-
test_subject = DataFactory.create_subject(age=45, status="Active")
523-
```
524-
525-
**Benefits:**
526-
527-
- Simplifies creation of complex objects
528-
- Promotes reuse and consistency in test data setup
529-
- Makes it easy to vary object attributes for different test scenarios
530-
531-
- **Singleton Pattern**
532-
533-
Used for configuration or shared resources (where applicable).
534-
535-
**Example:**
536-
537-
```python
538-
from utils.load_properties import PropertiesLoader
539-
540-
config = PropertiesLoader.get_instance()
541-
value = config.get("some_property")
542-
```
543-
544-
**Benefits:**
545-
546-
- Ensures a single, shared instance for configuration or resources
547-
- Reduces memory usage and avoids conflicting state
548-
- Makes global settings easy to access and update
549-
550-
---
551-
552498
## Utilities
553499

554500
Utility modules provide reusable functions and helpers for common tasks in test automation, such as database interaction, data generation, accessibility scanning, and more.<br>

0 commit comments

Comments
 (0)