Code changes required for Pex 0.6

Coordinator
Aug 16, 2008 at 1:20 PM
Edited Aug 16, 2008 at 1:22 PM
Pex 0.6 and the current (August 15, 2008) version of the extensions source code have some problems. A trivial one is that the reference "Specific Version" setting was set to True for Pex related references, so I have gone ahead and submitted a change with the setting corrected to False.

However, there are some other problems, including a large number reported when trying to build DySy. There appear to have been some breaking changes introduced with Pex 0.6, including "The non-generic type 'Microsoft.Pex.Engine.ComponentModel.IPexExplorationComponent' cannot be used with type arguments".

Please use this discussion thread for anything related to all code changes for Pex 0.6

For this discussion, it is fine to post code examples if the code is already public kowledge.
Developer
Aug 16, 2008 at 3:47 PM
Edited Aug 16, 2008 at 3:48 PM
From my inital investigation, changes required by xUnit in order to get it to compile for Pex 0.6.

XunitTestFrameworkAttribute.cs

Required to override a new method MakeInconclusive.  As xunit doesn't have an Iconclusive flag, set it to be ignore, which actually uses the Skip attribute.
public override void MakeInconclusive(MethodDefinitionBuilder method, string message)
{
MarkIgnored(method, message);
}

Multiple references to 'ca.Constructor.DeclaringType.SerializableName' become 'ca.Constructor.SerializableName'

The main change is to the constructor. The following code works.
public TestFramework(IPexComponent host) : base(host)
{
testAttributeCtor =
MetadataBuilderHelper.Attribute.ConstructorName(testAttribute.Definition, new TypeName[]{});

testAttributeSkipProperty =
new PropertyDefinitionName(frameworkAssembly, -1,testAttribute.Definition, "Skip",SystemTypes.String.SerializableName).SelfInstantiation;

 propertyAttributeCtor =

MetadataBuilderHelper.Attribute.ConstructorName(propertyAttribute.Definition,SystemTypes.String.SerializableName,SystemTypes.String.SerializableName);

 

assertExceptionCtor =

MethodDefinitionName.FromModuleMethod(frameworkAssembly,-1, false, assertException.Definition.ShortName,0, SystemTypes.Void.SerializableName,new ParameterDefinitionName(assertException,"this", 0, true, ParameterDirection.ByValueOrRef), new ParameterDefinitionName(SystemTypes.String.SerializableName,,"message", 1, false, ParameterDirection.ByValueOrRef)).SelfInstantiation;
}

XunitIntegrationTest.cs  (Tests)

Bitness Enum uses lower case x.
private readonly string pexConsole = PexInstallHelper.GetPexConsole(Bitness.x86);

Unless I've missed something, that should now compile.

 

 

 

Developer
Aug 16, 2008 at 3:51 PM
Changes required in order for NUnit to compile for Pex 0.6

NUnitIntegrationTests.cs
Change Bitness enum
private readonly string pexConsole = PexInstallHelper.GetPexConsole(Bitness.x86);

NUnitTests.cs
The two methods being overriden for SetUpTearDownRecorderAttribute have changed their siguatures.

They are now:
protected override object BeforeExploration(IPexExplorationComponent host)
protected override void AfterExploration(IPexExplorationComponent host, object data)
Developer
Aug 16, 2008 at 4:48 PM
Changed required for MbUnit are the same as required for NUnit.
Coordinator
Aug 27, 2008 at 4:48 PM
Changes for DySy have been checked in that allow clean compilation with the latest version of Pex.