Test Driven Development (TDD) with Windows PowerShell
1. Test Driven Development (TDD)
with Windows PowerShell
For Windows Developers, Windows System
Administrators and Windows DevOps
Lecturer: Rolf Hemmerling, hemmerling@gmx.net
Date: 2015-06-13
Slides: http://slideshare.com/hemmerling
License: Creative Commons - Attribution-ShareAlike 4.0
Generic http://www.creativecommons.org/licenses/by-sa/4.0/
2. 2
Test Driven Development (TDD)
with Windows PowerShell
1.The Basics of TDD
2.FizzBuzz: Hands-on TDD for Developers
3.Testing Frameworks
4.??: Hands-on TDD for DevOps
5.Coding Rules Checking
6.Web Application Testing
7.Practical Tips
8.Resumee
9.Resources
3. 3
1 The Basics of TDD
1 Write a Test
4 Test successfull
3 Write the Code
2 Test fails
5. 5
3 Testing Frameworks
# Type Tool name Comments
1 TDD Pester Module
2 TDD Jester Module,
Similar to Pester, but different syntax :-(
3 TDD PSTest Module,
makes use of the Nunit DLL
4 TDD PSUnit by Klaus
Graefensteiner
No module,
Test runner “PSUnit.Run.ps1”
5 TDD PSUnit by lidingshan Module
6 Lint ScriptCop Module
7 Web
Automation
Test_Run by James
McCaffrey
Demo on Win8.1 with IIS, MSIE, PS
6. 6
4 ??: Hands-on TDD for DevOps
and System Administrators :-)
Demo
7. 7
5 Coding Rules Checking
With ScriptCop by Start-Automating
Lint alike
Get-Module -Name FizzBuzz | Test-Module
Get-Command -Name Get-FizzBuzz | Test-Command
Test-Command -ScriptBlock { function MyFunction{} }
.. but you can't check external .PS1 files ?!
Demo
8. 8
6 Web Application Testing
by Microsoft Internet Explorer (MSIE) only
with Test_Run by James McCaffrey
as alternative to Selenium
Demo on Win8.1 with IIS, MSIE, PS
9. 9
7 Practical Tips
● Use community events for free TDD training
● Global Day of CodeRetreat
● Softwerkskammer, Meetup groups, Java User
Groups, .NET Developer Groups, IT conferences
like Froscon, PyCamp....
● Be open to change your programming language on
such events ( Java, JS, Python, C#,.. )
● Start at home
● Continue at office by a pilot project
● Teach and train yourself with collegues, at own
events
11. 11
9 Resources
● Links to all TDD and testing tools for PS:
http://hemmerling.com/doku.php/en/wscripting03.html
● Links to all sorts of TDD exercises ( Coding Dojo, CodeRetreat,..)
http://hemmerling.com/doku.php/en/codingdojo.html
● GitHub resource with many TDD code examples
http://github.com/hemmerling/codingdojo, also for PS
https://github.com/hemmerling/codingdojo/tree/master/src/fizzbuzz
● TDD Hands-on community-events
● http://softwerkskammer.org
● http://globalday.coderetreat.org/
● http://meetup.com/javascript-coderetreat/
● http://test-driven-development.meetup.com/