0

I am using Pex from the command line to find input values for test case generation. I use PexObserve to record certain values during execution. One of the values that I want to record is an XML-String.

However, when parsing the XML I receive "malformed XML" exceptions, since Pex only writes the first 255 characters into the log.

Is there a way to record the full XML string? or does PexObserve have a different type that will let me record longer texts?

4

1 回答 1

0

Leaving this here, in case somebody at any point has the same issue. I've found a solution that helped me.

Unfortunately the 255 character limit is set internally in static readonly fields. Therefore I needed to use reflection. My solution works by including the following line in the PUT:

typeof(Microsoft.Pex.Framework.PexObserve.ValueWriterManager).GetField("MaxWrittenElements").SetValue(null, 1000);

Replace the 1000 with any value you like.

BUT: remember that this is a quick-fix solution, that might not work for you. It may have unwanted side-effects. You're also changing the number of List elements that are written, and perhaps other things.

于 2016-09-13T22:23:25.567 回答