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 at http://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
>>>> semantics
>>>> in MbUnit. I realize, that it may not be supported out of the box,
>>>> but I
>>>> have an impression, that even if MbUnit misses some functionality,
>>>> the v3
>>>> architecture provides numerous extension points, which can be
>>>> utilized to
>>>> add the missing logic.
>>>>
>>>> Thanks.
>>>>
>>>>
>>>>
>>>
>>> ======================================================================
>>> ====
>>> 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.
>>>
>>>
>>>
>>>
>>> >>>
>>
>> ========================================================================
>> ==
>> 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.
>>
>>
>>
>
>
> --
> Be well and prosper.
> ==============================
> "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 drink for our guns always be loaded.
>


-- 
Be well and prosper.
==============================
"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 drink 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to