I've sent a copy to your email account. Did you receive it, or is there another mechanism you'd like me to use to ship you the source?
Cheers, -A On Feb 11, 4:02 am, Jeff Brown <[EMAIL PROTECTED]> wrote: > This is so weird. > Any chance you could ship me a bundle of code with your extension? > > I'm sorry I haven't been too helpful thus far. > > Jeff. > > > > -----Original Message----- > From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of > Aaron Rehaag > Sent: Friday, February 08, 2008 8:16 AM > To: MbUnit.User > Subject: MbUnit Re: Assertions going unhandled by MbUnit when using > parameterized run invokers > > I've put breakpoints on the lines before and after, as well as on the > Assert.Fail() in the above code. The before breakpoint triggers, the > Assert.Fail() breakpoint line triggers, the after ones don't. I agree that > my code isn't particularly robust (I was planning a cleanup pass once I got > it working), but as far as I can tell the cppunit process is running > correctly, and terminating with the correct results. > > Here's the exeception output captured via the GUI's output: > > MbUnit.Core.Exceptions.AssertionException > ----- > > Message: > > CppUnit failure! > > In f:\interop\cppunit\suite1.cpp:8 > > assertion failed > - Expression: false > > Type: MbUnit.Core.Exceptions.AssertionException > Source: MbUnit.Framework > TargetSite: Void Fail(System.String) > HelpLink: null > Stack: at MbUnit.Framework.Assert.Fail(String message) > at MbUnit.AddIn.Interop.CppUnit.CppUnitRunInvoker.Execute(Object > o, IList args) in F:\Interop\mbUnit\CppUnit\CppUnitRunInvoker.cs:line > 81 > at MbUnit.Core.RunPipeStarter.Run(Object fixture, Boolean > IsExplicit) > > And here it is again from the dialog prompted by the AutoRunner... > > AssertionException was unhandled by user code > ----- > CppUnit failure! > > In f:\interop\cppunit\suite1.cpp:8 > > assertion failed > - Expression: false > > Here's the code for the CppUnitRun: > > public class CppUnitRun : IRun > { > #region IRun members > > public bool IsTest > { > get { return false; } > } > > public string Name > { > get { return "CppUnitRun"; } > } > > public void Reflect(RunInvokerTree tree, > RunInvokerVertex parent, > Type subjectType) > { > try > { > CppUnitFixtureAttribute fixture = > (CppUnitFixtureAttribute)(subjectType.GetCustomAttributes(true)[0]); > > foreach (TestDetails test in > GetTestList(fixture.Path)) > { > IRunInvoker testInvoker = new CppUnitRunInvoker(this, > fixture.Path, test.Suite, test.Test); > tree.AddChild(parent, testInvoker); > } > } > catch > { > } > } > > #endregion > > private IEnumerable GetTestList(string path) > { > IList testList = new ArrayList(); > > Process process = new Process(); > process.StartInfo.FileName = path; > process.StartInfo.Arguments = "-list"; > process.StartInfo.UseShellExecute = false; > process.StartInfo.RedirectStandardOutput = true; > process.Start(); > > string testListXml = process.StandardOutput.ReadToEnd(); > process.WaitForExit(); > > XmlDocument xmlDoc = new XmlDocument(); > xmlDoc.LoadXml(testListXml); > > foreach (XmlNode node in xmlDoc.FirstChild) > { > string testName = node.InnerText; > testName = testName.Replace("::", ":"); > string[] testDetails = testName.Split(':'); > > testList.Add(new TestDetails(testDetails[0], testDetails[1])); > } > > return testList; > } > > private struct TestDetails > { > public string Suite; > public string Test; > > public TestDetails(string suite, string test) > { > Suite = suite; > Test = test; > } > }; > } > > Unless you can spot something particularly weird in the code above, I think > I'm going to have to bite the bullet and download the MbUnit source and step > through it in a debugger. The results I'm seeing just aren't making sense to > me given the code in RunPipeStarter, and I'd kinda like to see why that > catch(Exception) block isn't detecting this case, given the > AssertionException seems to derive from Exception. > > Cheers, > -A > > On Feb 7, 10:48 pm, "Jeff Brown" <[EMAIL PROTECTED]> wrote: > > Thanks for the detailed description. > > > Have you verified that your CppUnitRunInvoker is really calling > > Assert.Fail when it runs inside AutoRunner or the GUI? You could do > > this by launching the tests and attaching a debugger. Or you could > > log some diagnostic output to check. > > > I say this because I notice you don't check the exit code of the > > CppUnit test runner process. As long as it emits some XML, the code > > assumes all went well unless a <FailedTest> element is found. It's > > possible that CppUnit failed to run the test for some other reason. > > > For example, I also notice you don't set the WorkingDirectory of the > > process. Alternately because the StandardError stream is not being > > redirected or consumed, it may interact with the calling command shell. > > Weird things could happen. > > > Alternately, it could be that you CppUnitRunInvoker is being decorated > > by some other run invoker that is eating the exception. I can't tell > > whether that's the case because I don't have the code for the > > CppUnitRun. I assumes it's unlikely. > > > The only other thing I can think of is a ThreadAbortedException > > wreaking havoc. But you would probably see that in the test output just > > the same. > > > What does MbUnit actually display in the test report? Does it just > > look like everything passed or are you observing some other kind of > > failure? Do the tests even appear in the report? So far you've only > > said that it doesn't look like the AssertionException gets caught. > > What actually happens? > > > Jeff. > > > -----Original Message----- > > From: [email protected] [mailto:[EMAIL PROTECTED] > > On > > > Behalf Of Aaron Rehaag > > Sent: Thursday, February 07, 2008 8:57 PM > > To: MbUnit.User > > Subject: MbUnit Re: Assertions going unhandled by MbUnit when using > > parameterized run invokers > > > Jeff, > > > Long term, I'd be happy to port my solution to Gallio and contribute > > it to the MbUnit project. I'd be happy to discuss it with you more > > offline. In the meantime, I do need to find a stop-gap solution so I > > can use the technology at my workplace. > > > Based off the code I see in RunPipeStarter, it sure seems that the > > AssertionFaliureException should be getting caught,but my tests > > definitely show otherwise. As requested, I'll provide more details. > > > The basic idea of my solution is fairly straightforward. There are 2 > > major > > steps: > > > 1) Mirror the cppunit test hierarchy in MbUnit using a custom IRun > > (CppUnitRun). Basically, we launch the cppunit test runner executable > > passing a "-list" command line option. When ran in this fashion, the > > test hierarchy is spit out in a custom XML format to cout, which > > CppUnitRun captures, and parses, adding tests to duplicate the > > hierarchy. This appears to be working correctly, so I'll spare you the > > details of this code. > > > 2) We execute the tests using a custom IRunInvoker > > (CppUnitRunInvoker). The invoker launches the test runner executable > > once per test, passing the test's name as a command line option. In > > response, the executable spits out the test results (using CppUnit's > > built-in XMLOutputter) to cout, which are captured by the invoker and > > parsed. If the results indicate the test has failed, an Assert.Fail() > > is raised, with a message indicating details indicating why the test > > failed. Here's the code: > > > public class CppUnitRunInvoker : IRunInvoker > > { > > public CppUnitRunInvoker(IRun generator, string path, string > > suite, string test) > > { > > _generator = generator; > > _suite = suite; > > _test = test; > > _path = path; > > } > > > public IRun Generator > > { > > get { return _generator; } > > } > > > public string Name > > { > > get { return (_suite + "." + _test); } > > } > > > public bool ContainsMemberInfo(MemberInfo memberInfo) > > { > > foreach (MemberInfo member in GetType().GetMembers()) > > { > > if (member.Equals(memberInfo)) > > return true; > > } > > > return false; > > } > > > public object Execute(object o, IList args) > > { > > Process process = new Process(); > > > process.StartInfo.FileName = _path; > > process.StartInfo.Arguments = "-run " + _suite + "::" + > > _test; > > process.StartInfo.UseShellExecute = false; > > process.StartInfo.RedirectStandardOutput = true; > > process.Start(); > > > string testRunXml = process.StandardOutput.ReadToEnd(); > > testRunXml = TrimStartingWhitespace(testRunXml); > > process.WaitForExit(); > > > XmlDocument xmlDoc = new XmlDocument(); > > xmlDoc.LoadXml(testRunXml); > > XmlNode failedTests = > > xmlDoc.FirstChild.NextSibling.FirstChild; > > if (failedTests.HasChildNodes) // If the test failed. > > { > > string file = ""; > > string line = ""; > > string message = ""; > > > foreach (XmlNode node in > > failedTests.FirstChild.ChildNodes) > > { > > if (node.Name == "Location") > > ... > > read more »- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "MbUnit.User" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/MbUnitUser?hl=en -~----------~----~----~----~------~----~------~--~---
