Debugging PowerShell Modules with Pester Unit Tests in Visual Studio Code

Pubblicato il: 06 febbraio 2020
sul canale di: 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


In questa pagina del sito puoi guardare il video online Debugging PowerShell Modules with Pester Unit Tests in Visual Studio Code della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Trevor Sullivan 06 febbraio 2020, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 5,478 volte e gli è piaciuto 198 spettatori. Buona visione!