Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a unit testing framework for testing PowerShell with PowerShell scripts? [closed]

I am lookin for a unit testing framework of type xUnit that lets me test PowerShell functions with PowerShell scripts.

like image 681
tellingmachine Avatar asked Jun 16 '09 23:06

tellingmachine


People also ask

What is pester testing with PowerShell?

Pester is a test framework meant for PowerShell and is a module you can install. It has several features: Assertions. Pester comes with diverse ways of asserting conditions that will determine if your tests should fail or not.

What frameworks have you used for unit testing?

Jest. Jest was the most popular JavaScript unit testing framework in 2020. For web apps that are based on React, Jest is the preferred framework. Apart from React, Jest supports unit testing of Angular, VueJS, NodeJS, and others.

How do you create a pester test?

To build a Pester test, you need, at a minimum, two files: a PS1 script which contains code to test and a test script file. Create a folder called Pester101 somewhere, a PS1 script called Pester101. ps1 and an associated test script file called Pester101. Tests.

Which languages does the Microsoft unit test framework cover?

Unit tests give developers and testers a quick way to look for logic errors in the methods of classes in C#, Visual Basic, and C++ projects.


2 Answers

Well, just for completeness: There is actually PSUnit. Doesn't seem to be very mature, though as I see only two spikes of activity since its beginning as well as no documentation to speak of.

But as I learnt from cuTest, unit testing is something that fits into a very small space (at least for C in that case), so having something that works might not require too much effort.

like image 120
Joey Avatar answered Sep 24 '22 00:09

Joey


While not an actual framework a la xUnit, Lee Holmes did write an article about how to unit test PowerShell using PowerShell scripts.

like image 36
Lee Avatar answered Sep 21 '22 00:09

Lee