Returning a collection of objects from a PowerShell function

If you’re writing a function that returns a collection then don’t forget to include the comma operator in the return statement. If you forget it your function will work correctly when the collection contains multiple objects, but fails when it contains 1 object. Take the following buggy example: If you execute this code when $myarray […]

Read more
Understanding the LINQ nested grouping example

Here’s an explanation of how the default example for LINQ nested grouping actually works. The usual example for nested grouping looks like this: The objective of this statement is to first group-by students into faculties and then in each faculty create subgroupings of students by their DebtCategory. So how does this actually work and whats […]

Read more
Running unittests as part of a loadtest in Visual Studio

Did you know that the loadtest framework isn’t limited to only running webtests or calling web-services? You can also include your unittests! This is very convenient for loadtesting MVC controllers, WebApi controllers or SharePoint’s CSOM interface. Your unittests should work without any changes. If you need one of the following then your unittest needs some […]

Read more
a loadtest plugin to generate a GUID per request

Visual Studio has an out-of-the box plugin that generates GUIDs for you. However its a WebTest plugin, so it will only generate them once per webtest. You can’t include that plugin into a loop. Fortunately we can write a simple WebTestRequest plugin that does what we want:

Read more
A loadtest plugin to clear context parameters (and why we need it)

If a webtest stores temporary data in a context parameter, then you need to make sure that its reset to some initial state when the webtest starts. Otherwise it will fail if that webtest is included multiple times within the same testrun. Visual Studio’s “Set Context Parameter Value” plug-in won’t help here as it cannot […]

Read more
SharePoint people-pickers in loadtests

A significant number of the webtests in out loadtest need to simulate a human tying into a people-picker control. This control waits until the first few letters have been entered and after that calls SharePoint’s client.svc web-service every time the user enters data into the control. I simulate this with the following logic in webtests: […]

Read more