Pex - Automated Whitebox Testing for .NET : Packaging Extensions

Packaging Extensions

Extensions can be packaged in assemblies. Extension assemblies are loaded using a derived attribute of PexPackageAssemblyAttribute.

  • Create a custom attribute in the extension project that derives from PexPackageAssemblyAttribute,
// extension project
public sealed class MyExtensionsPackageAttribute 
  : PexPackageAssemblyAttribute
  • If the extension contains services that should be loaded by default, add them as assembly level attribute,
[assembly: PexInstrumentAssembly("Foo")]
[assembly: PexFocusOnAssembly("Foo")]
  • In order to improve Pex startup time, most services can also be declared on a supporting type (instead of the assembly level) using the PexPackageTypeAttribute attribute:
[assembly: PexPackageType(typeof(MyLibrary))]
static class MyLibrary {
  • Reference the extension package attribute in the target project,
// test project
[assembly: MyExtensionsPackage]
(c) Microsoft Corporation. All rights reserved. pex Wiki Documentation 0.93.50813.0