Agile/Scrum blog

Onderwerp: unit testing

The 4 most successful ways to let test automation FAIL

Marco Kroonwijk Door: Marco Kroonwijk,  08-09-2015
Onderwerp: Definition of Done  Automation  Continous Delivery  development  Extreme Programming  Technical Debt  Testing  unit testing  

So … your organization has just decided to embark on a test automation journey. You are going to automate all your manual regression testing efforts with this magnificent automation tool that drives your application. It tests just like any manual tester would do, but without the lag of the actual human normally associated with the task. The tool vendor demoed a way to record the test activities and replay them automagically to the management team, and they are all excited about the ease of use (and potential cost reduction).

A few months later, reality has kicked-in. Your test automation project has come to a grinding halt. What happened? 

Clean up the kitchen!

Martijn Dehing Door: Martijn Dehing,  11-02-2015
Onderwerp: refactoring  Craftsmanship  improvement  Testing  unit testing  zelfsturende teams  

Upon entering the room of team ‘Someone Else Broke It’ the negative energy was immediately noticeable. The tension was present from the utter silence within the room. It was like walking onto a cemetery. Glancing at the team happiness metric on the wall showed an obvious decline in motivation and drive. Both the customer happiness and the team velocity followed this negative trend. The only line that seemed to go up was the defect trend line…. This team seemed in serious trouble. What was going on here?

Creating a unit testing framework for PowerShell - Part 6

Prajeesh Prathap Door: Prajeesh Prathap,  21-01-2015
Onderwerp: PowerShell  unit testing  TDD  

The authorization manager helps control the execution of commands for the runspace. When you try to execute a PowerShell script from C#, and haven’t changed PowerShell’s default execution policy, the scripts that are executed under the execution policy set on the machine. If you want the tests executed from C# to bypass the default security policy, then you need to either use a null AuthorizationManager implementation for the runspace or create a custom implementation of the AuthorizationManager and override the policy based on any condition you have. Deriving from the AuthorizationManager class allows you to override the ShouldRun method and add the logic specific to your needs like set up a reason parameter with a custom execption with proper explanation and  details on why this command was blocked etc. Read more..

Creating a unit testing framework for PowerShell - Part 5

Prajeesh Prathap Door: Prajeesh Prathap,  21-01-2015
Onderwerp: PowerShell  unit testing  TDD  

PowerShell cmdlets and modules can report two kinds or errors (Terminating and non-terminating). Terminating errors are errors that cause the pipeline to be terminated immediately, or errors that occur when there is no reason to continue processing. Nonterminating errors are those errors that report a current error condition, but the cmdlet can continue to process input objects. With nonterminating errors, the user is  typically notified of the problem, but the cmdlet continues to process the next input object. Terminating errors are reported by throwing  exceptions or by calling the ThrowTerminatingError method, while non-terminating errors are reported by calling the Write-Error method that in turn sends an error record to the error stream. Read more..

Creating a unit testing framework for PowerShell - Part 4

Prajeesh Prathap Door: Prajeesh Prathap,  18-01-2015
Onderwerp: PowerShell  unit testing  TDD  

Before we proceed into how we can stub out commands in our test framework, we’ll see how the AddScript method works and how to use it to execute a script block in powershell. The AddScript method adds a script to the end of the pipeline of the PowerShell object and can be invoked by the Invoke method. We’ll use this method to add our dummy function as a script object to the pipeline so that when this command is called later from a function, it’s going to call the dummy function that was added using the AddScript method. Read mode..

Creating a unit testing framework for PowerShell - Part 3

Prajeesh Prathap Door: Prajeesh Prathap,  17-01-2015
Onderwerp: PowerShell  unit testing  TDD  

The windows PowerShell engine can be hosted in the System.Management.Automation.PowerShell class. Using this class you can create, execute and manage commands in a Runspace. We’ll use these features of the PowerShell class to load and execute our Modules and interact with the PowerShell engine whenever needed in our unit test framework. While creating the PowerShell host for our test framework, it’s good to define the Runspace that is responsible for the operating environment for command pipelines. In our framework I preferred to use the constrained runspace which will allow us to restrict the programming elements that can be applied by the user. Read more..

Creating a unit testing framework for PowerShell - Part 2

Prajeesh Prathap Door: Prajeesh Prathap,  17-01-2015
Onderwerp: PowerShell  unit testing  TDD  

Before we dig into the testing process, one of the main activities to be done as part of the Arrange phase is to populate or ModuleObject properties with the CommandInfo object that is used at the Acting phase of our test framework. For iterating through all the properties and reading the attributes using reflection and setting the values of the ModuleObject implementation, we’ll make use of the Visitor pattern. Read more..

Creating a unit testing framework for PowerShell - Part 1

Prajeesh Prathap Door: Prajeesh Prathap,  17-01-2015
Onderwerp: PowerShell  unit testing  TDD  

Recently I started working on a light weight unit testing framework for my PowerShell modules. There are a lot of testing frameworks for  PowerShell that can be executed as script files from a PS host, but not many allows you to integrate with VSTests and write test methods and classes in C#.
The following posts in this series is about how you can create a unit testing framework for Windows PowerShell and use it.
 
Being a big fan of the Page objects pattern and have seen the benefits of how easily you can model a page and reduce the amount of duplicate code when creating UI tests for websites, I wanted to do something similar modules for PowerShell also. So when I started writing the framework, one of the main considerations was to simplify my testing process by modelling a PowerShell module in code. Read more..