This project is read-only.


Getting problem to get Rows from datagridview object in UI


I am testing UI test using nunit. But it fails when it tries to get rows count in grid. It is getting zero rows and table header as null. How Can I test datagridview ? I am using dot net framework 2.0.
For Reference below is error I am getting:
Bricks.BricksException : Error invoking Table.get_Rows
----> System.NullReferenceException : Object reference not set to an instance of an object.
at Bricks.RuntimeFramework.ReflectedObject.Invoke(MethodInfo methodInfo, Object[] arguments) in D:\bricks\Bricks.RuntimeFramework\ReflectedObject.cs:line 69
at Bricks.DynamicProxy.DynamicProxyInterceptors.Process(IInvocation invocation, InterceptContext interceptedContext) in D:\bricks\Bricks\DynamicProxy\DynamicProxyInterceptors.cs:line 20
at Core.Interceptors.CoreInterceptor.Intercept(IInvocation invocation) in d:\white-os\Core\Interceptors\CoreInterceptor.cs:line 29
at Castle.DynamicProxy.AbstractInvocation.Proceed() in d:\OSS\Castle\Tools\Castle.DynamicProxy2\Castle.DynamicProxy\AbstractInvocation.cs:line 165
at TableProxy5d2a28594eee409c82f96891f76f278a.get_Rows()
at Connamara.PositionClient.UI.Test.PositionClientTest.VerifyEqual(Int32 rowindex, Position pos) in C:\projects\PositionClient\trunk\Client\PositionClientUITest\PositionClientTest.cs:line 175
at Connamara.PositionClient.UI.Test.PositionClientTest.TestPositionSnapShotSucess() in C:\projects\PositionClient\trunk\Client\PositionClientUITest\PositionClientTest.cs:line 162
at Core.UIItems.UIItem..ctor(AutomationElement automationElement, ActionListener actionListener) in d:\white-os\Core\UIItems\UIItem.cs:line 35
at Core.UIItems.TableItems.TableHeader..ctor(AutomationElement automationElement, ActionListener actionListener) in d:\white-os\Core\UIItems\TableItems\TableHeader.cs:line 13
at Core.Factory.TableHeaderFactory.Create(AutomationElement automationElement, ActionListener actionListener) in d:\white-os\Core\Factory\TableHeaderFactory.cs:line 12
at Core.UIItems.TableItems.Table.get_Header() in d:\white-os\Core\UIItems\TableItems\Table.cs:line 39
at Core.UIItems.TableItems.Table.get_Rows() in d:\white-os\Core\UIItems\TableItems\Table.cs:line 29
Closed Jul 28, 2013 at 12:25 PM by JakeGinnivan
Please report the issue on GitHub ( if it is still an issue. Issues raised on CodePlex will not be fixed.
Also include the version of TestStack.White you are using.



neerajkaushik_123 wrote Jan 15, 2009 at 6:47 AM

I got resolution of above problem. If we make unit test project to test ui and run nunit gui to run unit test, it fails for getting rows of datagrid. But if we run unit tests using nunit-console with /nothread args then it works fine.

lnoconnor wrote Jan 15, 2009 at 11:06 PM

Thanks for the tip, this worked for me. From the brief test that I made, this also allowed me to find children of my menubar, which I was previously unable to do.

viveksingh wrote Jan 26, 2009 at 3:11 PM

This is excellent if the /nothread option did the trick for you. This is new for me. I would add this to FAQ list.

Natook wrote Oct 14, 2009 at 12:12 PM

I'm confused. This work item is supposed to be about the /nothread option and the comments are about that but the work item itself doesn't seem to cover that topic?

Natook wrote Oct 14, 2009 at 12:14 PM

Nvm, it was a lack-of-coffee issue. /embarassed.

Natook wrote Oct 14, 2009 at 12:14 PM

Nvm, it was a lack-of-coffee issue. /embarassed.

wrote Feb 22, 2013 at 1:23 AM

wrote Jul 28, 2013 at 12:25 PM