Re: VB Code casts differently in nunit than VS 2005
"Charlie Poole" <[email protected]> Fri, 21 Nov 2008 10:35:38 -0800
| Newsgroups | gmane.comp.windows.dotnet.nunit.user |
|---|---|
| Message-ID | <007b01c94c07$f5873250$6401a8c0@ferrari> |
This is a multi-part message in MIME format. --===============1753167392409953488== Content-Type: multipart/alternative; boundary="----=_NextPart_000_007C_01C94BC4.E763F250" This is a multi-part message in MIME format. ------=_NextPart_000_007C_01C94BC4.E763F250 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi Jon, NUnit executes your code - no more, no less. If sojmething works differently when run under NUnit, it usually means that some bit of your code is not being executed. Typically, standalone apps perform a fair bit of initialization, which may not be included in your test. Sometimes, initialization is done for you, without any effort on your part, when your process is initialized. The best way to debug this is to add more asserts to your code. FOr example, is ie.documents returning Nothing? If not, what is the type of the object it returns? etc. Charlie _____ From: Jon Swan [mailto:[email protected]] Sent: Friday, November 21, 2008 10:08 AM To: [email protected] Subject: [Nunit-users] VB Code casts differently in nunit than VS 2005 System specs of interest: Win XP, IE 7, nunit 2.4.8 (.net 2.0), VS 2005 I am using VB .net to access a frame collection in a browser object. When I run the program as a stand-alone VB app, I can view the frame collection and all of the objects within it. When, I attach a test that uses the same code to nunit, I get a casting exception when trying to access the same frames collection. The objects are SHDocVw.InternetExplorer (ie) and mshtml.HTMLDocument (doc) doc = ie.document accessing doc.frames throws a casting exception, but only when running the test through nunit. Is it possible that the run-time for nunit is using a different rule set than VS does? ------=_NextPart_000_007C_01C94BC4.E763F250 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3Dus-ascii"> <META content=3D"MSHTML 6.00.6000.16705" name=3DGENERATOR></HEAD> <BODY> <DIV><SPAN class=3D906383018-21112008><FONT face=3DArial color=3D#0000ff = size=3D2>Hi=20 Jon,</FONT></SPAN></DIV> <DIV><SPAN class=3D906383018-21112008><FONT face=3DArial color=3D#0000ff = size=3D2></FONT></SPAN> </DIV> <DIV><SPAN class=3D906383018-21112008><FONT face=3DArial color=3D#0000ff = size=3D2>NUnit=20 executes your code - no more, no less. If sojmething works differently=20 when</FONT></SPAN></DIV> <DIV><SPAN class=3D906383018-21112008><FONT face=3DArial color=3D#0000ff = size=3D2>run=20 under NUnit, it usually means that some bit of your code is not being=20 executed.</FONT></SPAN></DIV> <DIV><SPAN class=3D906383018-21112008><FONT face=3DArial color=3D#0000ff = size=3D2>Typically, standalone apps perform a fair bit of = initialization, which=20 may not be</FONT></SPAN></DIV> <DIV><SPAN class=3D906383018-21112008><FONT face=3DArial color=3D#0000ff = size=3D2>included in your test. Sometimes, initialization is done for = you, without=20 any effort</FONT></SPAN></DIV> <DIV><SPAN class=3D906383018-21112008><FONT face=3DArial color=3D#0000ff = size=3D2>on=20 your part, when your process is initialized.</FONT></SPAN></DIV> <DIV><SPAN class=3D906383018-21112008><FONT face=3DArial color=3D#0000ff = size=3D2></FONT></SPAN> </DIV> <DIV><SPAN class=3D906383018-21112008><FONT face=3DArial color=3D#0000ff = size=3D2>The=20 best way to debug this is to add more asserts to your code. FOr=20 example,</FONT></SPAN></DIV> <DIV><SPAN class=3D906383018-21112008><FONT face=3DArial color=3D#0000ff = size=3D2>is=20 ie.documents returning Nothing? If not, what is the type of the object=20 it</FONT></SPAN></DIV> <DIV><SPAN class=3D906383018-21112008><FONT face=3DArial color=3D#0000ff = size=3D2>returns? etc.</FONT></SPAN></DIV> <DIV><SPAN class=3D906383018-21112008><FONT face=3DArial color=3D#0000ff = size=3D2></FONT></SPAN> </DIV> <DIV><SPAN class=3D906383018-21112008><FONT face=3DArial color=3D#0000ff = size=3D2>Charlie</FONT></SPAN></DIV><BR> <BLOCKQUOTE dir=3Dltr=20 style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px = solid; MARGIN-RIGHT: 0px"> <DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr align=3Dleft> <HR tabIndex=3D-1> <FONT face=3DTahoma size=3D2><B>From:</B> Jon Swan = [mailto:[email protected]]=20 <BR><B>Sent:</B> Friday, November 21, 2008 10:08 AM<BR><B>To:</B>=20 [email protected]<BR><B>Subject:</B> [Nunit-users] VB = Code=20 casts differently in nunit than VS 2005<BR></FONT><BR></DIV> <DIV></DIV> <DIV>System specs of interest: Win XP, IE 7, nunit 2.4.8 (.net 2.0), = VS=20 2005</DIV> <DIV> </DIV> <DIV>I am using VB .net to access a frame collection in a browser=20 object. When I run the program as a stand-alone VB app, I can = view the=20 frame collection and all of the objects within it. When, I = attach a test=20 that uses the same code to nunit, I get a casting exception when = trying to=20 access the same frames collection. </DIV> <DIV> </DIV> <DIV>The objects are SHDocVw.InternetExplorer=20 (ie) and mshtml.HTMLDocument (doc)</DIV> <DIV> </DIV> <DIV>doc =3D ie.document</DIV> <DIV> </DIV> <DIV>accessing doc.frames throws a casting exception, but only when = running=20 the test through nunit. </DIV> <DIV> </DIV> <DIV>Is it possible that the run-time for nunit is using a different = rule set=20 than VS does? </DIV></BLOCKQUOTE></BODY></HTML> ------=_NextPart_000_007C_01C94BC4.E763F250-- --===============1753167392409953488== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ --===============1753167392409953488== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Nunit-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nunit-users --===============1753167392409953488==--