Just open your project in Visual Studio and set some breakpoints. Then click the Debug button in Icarus. Beware that if you have multiple instances of Visual Studio open, Icarus might not be able to determine which one contains the test projects you are working on. If it attaches to the wrong debugger then your breakpoints will not be hit. Jeff.
_____ From: [email protected] [mailto:[email protected]] On Behalf Of Mark Kharitonov Sent: Tuesday, August 11, 2009 11:25 PM To: [email protected] Subject: MbUnit Re: Generic test method for dynamically generated types. Thanks, Jeff. Can you tell me how to utilize the Debug feature of Icarus and Echo? Seems like I miss something, because I do not succeed to debug the tests from within either. On 12/08/2009, at 00:03, Jeff Brown wrote: The TDNet problem is because the first type defined in the file is not a test fixture. The actual test fixture is the second type in the file. When you right-click on the file, TDNet seems to ask Gallio to run that type but not the other top-level types in the file. Two workarounds: 1. Move OrderedCollectionImplementationFactory to the end of the file so that OrderedCollectionTest comes first. 2. Instead of using "Run Test" on the file in the Solution Explorer, right-click on or within the OrderedCollectionTest class in the code editor and use the "Run Test" context action there. Jamie: This is where it would be really handy if TDNet could pass Gallio a list of multiple assemblies, namespaces or types/members to run all at once. In the case where a file contains multiple types it would just pass the list of these types to the test runner instead of (apparently) choosing the first one only. Jeff. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Mark Kharitonov Sent: Tuesday, August 11, 2009 6:47 AM To: MbUnit.User Subject: MbUnit Re: Generic test method for dynamically generated types. The solution is here - http://groups.google.com/group/MbUnitUser/web/MbUnitEval.zip On Aug 11, 4:42 pm, Mark Kharitonov <[email protected]> wrote: I have isolated the test in a separate assembly. It works now. What I did before is took my original mstest unit test project, commented some stuff, removed some references and so it did not work. There are still a few things I fail to do: 1. When I click "Run Test(s)" on the unit test file in the solution explorer I get this: ==================== ------ Test started: Assembly: LibraryTest.dll ------ Gallio TestDriven.Net Runner - Version 3.0.6 build 787 Test Assemblies: C:\Home\work\MbUnitEval\LibraryTest\bin\Debug\LibraryTest.dll Start time: 4:26 PM Verifying assembly names. Initializing the test runner. Running the tests. Disposing the test runner. Stop time: 4:26 PM (Total execution time: 1.470 seconds) Test Report: file:///C:/Documents%20and%20Settings/mark.kharitonov/Local%20Settings /Temp/Gallio.TDNetRunner/LibraryTest.dll.html ** NO TESTS WERE RUN (No tests found) ** The target type doesn't contain tests from a known test framework or a 'Main' method. ==================== But, if I open this file in the editor, right click and select "Run Test(s)" there I get a clean run: ==================== ------ Test started: Assembly: LibraryTest.dll ------ Gallio TestDriven.Net Runner - Version 3.0.6 build 787 Test Assemblies: C:\Home\work\MbUnitEval\LibraryTest\bin\Debug\LibraryTest.dll Start time: 4:30 PM Verifying assembly names. Initializing the test runner. Running the tests. TestCase 'MbUnit v3.0.6.787/LibraryTest/OrderedCollectionTest`1/ OrderedCollectionTest`1<Library.OrderedCollection<int>>/AddItemUnique' passed. ......................................... ..(Deleted 26 lines here).. ......................................... TestCase 'MbUnit v3.0.6.787/LibraryTest/OrderedCollectionTest`1/ OrderedCollectionTest`1<Library.OrderedObservableCollection<int>>/ TrySetItemDuplicate' passed. Disposing the test runner. Stop time: 4:30 PM (Total execution time: 1.912 seconds) Test Report: file:///C:/Documents%20and%20Settings/mark.kharitonov/Local%20Settings /Temp/Gallio.TDNetRunner/LibraryTest.dll.html 28 passed, 0 failed, 0 skipped, took 2.39 seconds (Gallio_MbUnit). ==================== 2. The Debug button in the Icarus GUI just does not work. The first time I clicked it, VS2008 drove me crazy by constantly presenting me with source server dialogs, OKaying all the dialogs did not help - no debug. After that, clicking the Debug button does nothing. Well, it runs the test (I can see it in the status line), but no debugging. 3. Running gallio.echo /debug does not debug as well. I guess I am doing something wrong, but what? I will attach the solution momentarily. On Aug 11, 1:35 pm, "Jeff Brown" <[email protected]> wrote: The TDNet error at the bottom is a red herring. It's trying to use its Ad-Hoc test runner because Gallio told it that it ran no tests. (The Ad-Hoc test runner is a kind of fallback that TDNet provides but it only works for limited cases.) The most likely explanation is that no data has been provided to the test so it will not run. If you send me your test code I may be able to help you further. Jeff. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of mark Kharitonov Sent: Tuesday, August 11, 2009 2:50 AM To: [email protected] Subject: MbUnit Re: Generic test method for dynamically generated types. More Info. I am trying to debug from gallio.icarus with the debug button - nothing happens. No errors either. It just tells - 14 tests - 0 passed - 0 failed - 0 inconclusive - 0 skipped - 0.0s Trying Gallio.Echo /debug just prints out this screen: C:\Dev\windows\bin\Debug>gallio.echo /debug Test.dll Gallio Echo - Version 3.0.6 build 787 Get the latest version athttp://www.gallio.org/ Start time: 12:35 PM Verifying assembly names. Initializing the runtime and loading plugins. Initializing the test runner. Running the tests. Attaching the debugger to the host. Detaching the debugger from the host. Disposing the test runner. Stop time: 12:35 PM (Total execution time: 3.524 seconds) 0 run, 0 passed, 0 failed, 0 inconclusive, 0 skipped When I run from TDD.NET, the error message contains this: ** NO TESTS WERE RUN (No tests found) ** TestCase 'M:Shunra.Common.Test.OrderedCollectionTest`1.AddItemUnique' failed: Cannot create an instance of Shunra.Common.Test.OrderedCollectionTest`1[T] because Type.ContainsGenericParameters is true. System.MemberAccessException: Cannot create an instance of Shunra.Common.Test.OrderedCollectionTest`1[T] because Type.ContainsGenericParameters is true. at System.Reflection.RuntimeConstructorInfo.CheckCanCreateInstance(Type declaringType, Boolean isVarArg) at System.Reflection.RuntimeConstructorInfo.ThrowNoInvokeException() at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.ConstructorInfo.Invoke(Object[] parameters) at TestDriven.AdHoc.TestRunner.AdHocTestRunner.runAdHoc(ITestListener testListener, ITraceListener traceListener, String assemblyPath, String cref) Any ideas? Thanks. On 8/11/09, mark Kharitonov <[email protected]> wrote: Hi Jeff. I am trying to apply what you have shown me, so I have written a simple generic unit test type. Unfortunately, TD.NET refuses to run it with the following error message: Cannot create an instance of OrderedCollectionTest`1[T] because Type.ContainsGenericParameters is true Is there a way to make TD.NET run generic fixtures? Or may be you can advice me on how to debug a unit test without TD.NET. Thanks. On 8/11/09, Mark Kharitonov <[email protected]> wrote: Thanks a lot for the prompt replies. On 11/08/2009, at 00:04, Jeff Brown wrote: Both generic test methods and generic fixture types are supported. I gave an example of the former below. You can use any data source or factory you like as long as it yields the required Types to bind to the type parameters. Jeff. From: [email protected] [mailto:[email protected]] On Behalf Of Mark Kharitonov Sent: Monday, August 10, 2009 6:42 AM To: [email protected] Subject: MbUnit Re: Generic test method for dynamically generated types. Thanks, Jeff. Sounds promising. I did not get from your response whether generic test methods are possible. If so, can the generic type parameters be yielded at run-time by some factory method, just as with the generic fixture parameters? Thanks. On 10/08/2009, at 13:18, Jeff Brown wrote: Wow that's a pretty complicated case! There are a few things in MbUnit v3 that might help you: 1. You can specify data sources for generic fixture type parameters and generic test method type parameters. eg. Using Column but any other data source will do, including a [Factory] if you like. (Just make sure the factory method yields Type objects.) [Test] public void MyTest<[Column(typeof(Abc), typeof(Def))] T>() { ... } 2. Given just how dynamic this case is, you might consider using a [DynamicTestFactory]. (http://www.gallio.org/api/html/ T_MbUnit_Framework_DynamicTestFactoryAttribu te.htm) The API documentation includes an example of a dynamic test factory that is also data driven. So what you could do is to use a data driven dynamic test factory to produce a list of test cases for each combination of inputs. Since you can run arbitrary code within the factory it should be pretty easy to handle the dynamically generated entity tag types used by the test cases. Jeff. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Mark Kharitonov Sent: Sunday, August 09, 2009 11:08 PM To: MbUnit.User Subject: MbUnit Generic test method for dynamically generated types. Hello. I have a somewhat advanced question. Our unit tests are currently written in mstest, however, one has to go extra mile to simulate combinatorial tests there. So, I am examining the option of migrating to MbUnit. In our tests, I simulate combinatorial tests using in-memory data provider, custom attributes on the methods and populate the data provider from the ClassInitialize method. All of these are easily done in MbUnit. There is, however, an additional twist to our setup - dynamically generated types. The thing is that a test method input determines the features of the tested dummy entity and a new dummy entity type may have to be produced to support these features. The new type is produced by generating a unique tag type corresponding to the feature spec. This tag type is then used as the generic type parameter of the DummyEntity<T> type. So, each cartesian multiplication product corresponds to some combination of features to be tested, which correspond to some dummy entity type, which may have to be dynamically generated, which instances are tested by the particular test method. I would like to get an advice on the best way to express these ... read more > ========================================================================== There are two kinds of people. Those whose guns are loaded and those who dig. (The good, the bad and the ugly). So let us raise our cups for our guns always be loaded. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
