Skip to content

Commit 2a986e0

Browse files
Merge branch 'DscTestsPresentRule' of github.com:KarolKaczmarek/PSScriptAnalyzer into DscTestsPresentRule
2 parents 8a6e394 + 8730151 commit 2a986e0

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

RuleDocumentation/DscTestsPresent.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#DscTestsPresent
2+
**Severity Level: Information**
3+
4+
5+
##Description
6+
7+
Checks that DSC tests for given resource are present.
8+
9+
##How to Fix
10+
11+
To fix a violation of this rule, please make sure Tests directory is present:
12+
* For non-class based resources it should exist at the same folder level as DSCResources folder.
13+
* For class based resources it should be present at the same folder level as resource psm1 file.
14+
15+
Tests folder should contain test script for given resource - file name should contain resource's name.
16+
17+
##Example
18+
19+
### Non-class based resource
20+
21+
Let's assume we have non-class based resource with a following file structure:
22+
23+
* xAzure
24+
* DSCResources
25+
* MSFT_xAzureSubscription
26+
* MSFT_xAzureSubscription.psm1
27+
* MSFT_xAzureSubscription.schema.mof
28+
29+
In this case, to fix this warning, we should add tests in a following way:
30+
31+
* xAzure
32+
* DSCResources
33+
* MSFT_xAzureSubscription
34+
* MSFT_xAzureSubscription.psm1
35+
* MSFT_xAzureSubscription.schema.mof
36+
* Tests
37+
* MSFT_xAzureSubscription_Tests.ps1
38+
39+
### Class based resource
40+
41+
Let's assume we have class based resource with a following file structure:
42+
43+
* MyDscResource
44+
* MyDscResource.psm1
45+
* MyDscresource.psd1
46+
47+
In this case, to fix this warning, we should add tests in a following way:
48+
49+
* MyDscResource
50+
* MyDscResource.psm1
51+
* MyDscresource.psd1
52+
* Tests
53+
* MyDscResource_Tests.ps1
54+

0 commit comments

Comments
 (0)