As I understand, there is no success/failed indication after a OpenTap.TestPlan.Load()? For example in case of missing plugins or resources.
How are load errors supposed to be handled using the API? Do I have to read and parse the sessionlog file or is there a better way?
@GoranJohnsson, you can use this method to load the Test Plan:
public static TestPlan Load(Stream stream, string path, bool cacheXml, TapSerializer serializer = null)
You can check Errors
of the serializer for errors associated with deserialization. The errors only persists between calls to Serialize/Deserialize.
Example:
var serializer = new TapSerializer();
var myTestPlan = TestPlan.Load(
new FileStream("TEST_PLAN_PATH", FileMode.Open, FileAccess.Read),
"absoluteTestPlanPath",
false,
serializer);
if (serializer.Errors.Any())
{
foreach(string error in serializer.Errors)
Console.WriteLine("Error: " + error);
}
4 Likes