dsccommunity / dsccommunity/SqlServerDsc
SqlSetup: The main unit test for this resource is starting to grow out of proportion
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 385
- Forks
- 224
- PR merge metrics
- No merged PRs in 30d
Description
Details of the scenario you tried and the problem that is occurring:
I think we need to look at this unit test. Is starting to be so large and complex it is very hard to do make changes to it, and also it becomes hard to review the changes. Currently the test is around 4500 rows and still increasing.
I think we need to look at creating more helper functions for the logic in the resource, so those helper function can be tested individually making the necessary mocks in the main xSQLServerSetup.Tests more easy to handle, hopefully overall shrink the code needed.
The DSC configuration that is using the resource (as detailed as possible):
n/a
Version of the Operating System, SQL Server and PowerShell the DSC Target Node is running:
n/a
What module (SqlServer or SQLPS) and which version of the module the DSC Target Node is running:
n/a
Version of the DSC module you're using, or 'dev' if you're using current dev branch:
Dev
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the main SqlSetup unit test in xSQLServerSetup.Tests and read how its mocks and resource logic are organized. Refactor the test around separately testable helper functions, then verify that the helper logic has individual coverage and the main test is smaller and easier to review.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- testing-qa
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100