-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.cursorrules
More file actions
134 lines (118 loc) · 5.56 KB
/
.cursorrules
File metadata and controls
134 lines (118 loc) · 5.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# WebDev.Tool.Tests Folder Structure Rules
When creating new test files for WebDev.Tool.Tests, follow this folder structure:
## Test File Organization:
- Base classes → `WebDev.Tool.Tests/Base/`
- Helper classes → `WebDev.Tool.Tests/Helpers/`
- Test data → `WebDev.Tool.Tests/Helpers/TestData/`
- Configuration files → `WebDev.Tool.Tests/Configuration/`
- Resources → `WebDev.Tool.Tests/Resources/`
## Test Categories (place in `WebDev.Tool.Tests/Tests/`):
- Basic functionality tests → `Tests/Basic/` (version, help, availability)
- Command-specific tests → `Tests/Commands/` (PHP, Node, Database commands)
- Workspace/environment tests → `Tests/Workspace/` (configuration, setup)
- Integration tests → `Tests/Integration/` (end-to-end, performance)
## Naming Conventions:
- Test classes: `{Category}{Feature}Tests.cs` (e.g., `PhpCommandTests.cs`)
- Base classes: `{Feature}TestBase.cs` (e.g., `DevContainerTestBase.cs`)
- Helper classes: `{Feature}{Type}.cs` (e.g., `DevContainerCommandExecutor.cs`)
## Complete Folder Structure:
```
WebDev.Tool.Tests/
├── Base/ # Base classes and test infrastructure
│ ├── DevContainerTestBase.cs # Base class for devcontainer tests
│ └── TestBase.cs # Generic base class for other test types
│
├── Helpers/ # Helper classes and utilities
│ ├── DevContainerCommandExecutor.cs
│ ├── TestUtilities.cs
│ └── TestData/ # Test data and fixtures
│ ├── SampleProjects/
│ └── ConfigurationFiles/
│
├── Tests/ # All test classes organized by category
│ ├── Basic/ # Basic functionality tests
│ │ ├── WebDevBasicTests.cs # Version, help, availability tests
│ │ └── DevContainerBasicTests.cs
│ │
│ ├── Commands/ # Command-specific tests
│ │ ├── WebDevCommandTests.cs # Core webdev command tests
│ │ ├── PhpCommandTests.cs # PHP-related command tests
│ │ ├── NodeCommandTests.cs # Node.js-related command tests
│ │ └── DatabaseCommandTests.cs # Database-related command tests
│ │
│ ├── Workspace/ # Workspace and environment tests
│ │ ├── WorkspaceConfigurationTests.cs
│ │ ├── EnvironmentSetupTests.cs
│ │ └── IntegrationTests.cs
│ │
│ └── Integration/ # End-to-end and integration tests
│ ├── EndToEndTests.cs
│ └── PerformanceTests.cs
│
├── Configuration/ # Test configuration files
│ ├── appsettings.json
│ ├── appsettings.Development.json
│ └── xunit.runner.json
│
├── Resources/ # Test resources and assets
│ ├── TestProjects/
│ ├── ExpectedOutputs/
│ └── TestScripts/
│
├── WebDev.Tool.Tests.csproj
└── README.md
```
## Test Organization Rules:
1. **Basic Tests** (`Tests/Basic/`) - Fundamental functionality like version, help, availability
2. **Command Tests** (`Tests/Commands/`) - Specific command functionality (PHP, Node, Database, etc.)
3. **Workspace Tests** (`Tests/Workspace/`) - Environment setup, configuration, workspace management
4. **Integration Tests** (`Tests/Integration/`) - End-to-end workflows and performance tests
## Test Categories and Execution Order:
### Category Mapping:
- **Basic Tests** (`Tests/Basic/`) → `[Trait("Category", "Basic")]`
- **Command Tests** (`Tests/Commands/`) → `[Trait("Category", "Commands")]`
- **Workspace Tests** (`Tests/Workspace/`) → `[Trait("Category", "Workspace")]`
- **Integration Tests** (`Tests/Integration/`) → `[Trait("Category", "Integration")]`
### Execution Order:
1. **Basic Tests** (version, help, availability) - Execute first
2. **Workspace Tests** (environment setup) - Execute second
3. **Command Tests** (PHP, Node, Database commands) - Execute third
4. **Integration Tests** (end-to-end workflows) - Execute last
### Test Order Within Categories:
- Use `[TestOrder(n)]` attribute to control execution order within each category
- Lower numbers execute first (e.g., `[TestOrder(1)]`, `[TestOrder(2)]`)
- Use sequential numbering for dependent tests
## Guidelines:
- Always place new test files in the appropriate category folder
- Add the correct trait attribute based on the folder location
- Use `[TestOrder(n)]` attribute for tests that need specific execution order
- Follow the established naming conventions
- Use the existing base classes and helper utilities
- Maintain consistency with existing test patterns
- Group related tests in the same file when they test the same feature
- Use descriptive test method names that explain what is being tested
- Import required namespaces: `using WebDev.Tool.Tests.Helpers;` for TestOrderAttribute
## Example Test Structure:
```csharp
using FluentAssertions;
using WebDev.Tool.Tests.Base;
using WebDev.Tool.Tests.Helpers;
namespace WebDev.Tool.Tests.Tests.Commands;
[Trait("Category", "Commands")]
public class NodeCommandTests : DevContainerTestBase
{
[Fact]
[TestOrder(1)]
public async Task Setup_Node_Environment()
{
// Setup test environment
}
[Fact]
[TestOrder(2)]
public async Task WebDev_Should_Change_Node_Version_Successfully()
{
// Main test that depends on setup
}
}
```
Always place new test files in the appropriate category folder, add the correct trait attribute, and follow the established patterns.