Debugging PowerShell Modules with Pester Unit Tests in Visual Studio Code

Veröffentlicht am: 06 Februar 2020
auf dem Kanal: Trevor Sullivan
5,478
198

If you are the author of a PowerShell module, you can use the built-in debugging tools in Microsoft Visual Studio Code to debug your script modules. In this video, we'll build a simple PowerShell script module, and then use the Pester unit testing module to write some failing tests. Then, we'll set a breakpoint in our module and break into the debugger when we execute the Pester unit tests. Once execution is paused, we'll step through the module code line by line, to discover where things are going wrong. We'll then fix the module code, and ensure that our Pester unit tests are passing.

Relevant Links

https://github.com/powershell/vscode-...
https://github.com/PowerShell/PowerSh...
https://code.visualstudio.com/docs/ed...
  / pspester  
https://github.com/pester/Pester

Why should you use PowerShell classes?    • PowerShell v5 0 Classes :: Why Use Them?  
PowerShell v5 Classes :: Property Validation Attributes:    • PowerShell v5 Classes :: Property Val...  
PowerShell 5.0 Classes :: All About Object Constructors:    • PowerShell 5.0 Classes :: All About O...  
PowerShell 5.0 Classes :: Inheritance and Base Class Methods:    • PowerShell 5.0 Classes :: Inheritance...  
PowerShell 5.0 Classes :: What are .NET Enumerations?    • PowerShell 5.0 Classes :: What are .N...  
Introduction to PowerShell 5.0 Classes:    • Introduction to PowerShell 5.0 Classes  

Producer: Trevor Sullivan
Website: https://trevorsullivan.net
Patreon:   / trevorsullivan  
Twitter:   / pcgeek86  
Gab: https://gab.ai/trevors

Intro music "Amen Tune" used, with permission, from Aaron Static. Check out his music here:   / aaronstatic  

#Microsoft #PowerShell #VSCode

0:00 Intro to Debugging PowerShell Modules
2:30 Create Sample PowerShell Module
3:53 Add Function to Return Class Instance
10:10 Create Pester Test File
12:15 Add Describe Block
15:22 Debug PowerShell Module Function
19:05 Fix Bug in PowerShell Function
23:20 Run Final Successful Test


Auf dieser Seite können Sie das Online-Video Debugging PowerShell Modules with Pester Unit Tests in Visual Studio Code mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Trevor Sullivan 06 Februar 2020 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 5,478 Mal angesehen und es wurde von 198 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!