Test what you can.  Automate tests for code that aren't affected by
styles.  Use UIAutomation tests to provide some coverage for visuals if
you can, but always include human testing over visuals in your release
cycles and look for regression.

 

Carl.

 

From: [email protected] [mailto:[email protected]]
On Behalf Of Stephen Price <[email protected]>
Sent: Friday, 18 June 2010 11:46 AM
To: ozWPF <[email protected]>
Subject: Re: missing resource

 

Short answer, because we can? 

 

Someone else wrote the unit test in this particular case, I broke it by
adding a style to the shell. I've not looked at what the unit test is
testing. I'd rather have a poorly tested UI/View than no test at all. 

 

It looks like I've found a way to get the test to pass, after much
searching I found a StackOverflow answer that pointed me in the right
direction. 

 

                var brush = new SolidColorBrush();

                application.Resources.Add("NormalGradientBrush", brush);

 

I've put that in my FixtureSetup so that the resource exists (I don't
care what it actually is, just that it exists enough to create the
instance of the shell). 

 

Read Carl's response, and know the pain you speak of.  :)

I spent a day writing a Silverlight unit test on a view (which would
become the basis for future unit tests) and then discovered that the
Loaded event is never raised if the browser is minimised (which on the
build server apparently it is). So the unit test became something that
needed to be manually ran and was quarantined into its own startup page.
(thus not being automated and so never gets run as far as I can tell?)
fail. 

Also I REALLY miss not having the ability to run all my unit tests in my
test runner of my choice. (currently Resharper's test runner). Spend all
my time wondering if I've run all the unit tests or not. I end up not
bothering and hope that the build server (which it usually does) will
catch the broken tests. 

 

I'll stop now or my reply will become a rant. :)

 

cheers for the help guys, 

Stephen

 

On Fri, Jun 18, 2010 at 11:26 AM, Steven Nagy <[email protected]>
wrote:

I have no specific answer to your exact problem, however I do have to
ask, why are you unit testing the shell?

We have patterns like MVVM for just these reasons; you don't want to
test the UI but the logic behind it.

 

That said you could always add the style to the Shell.Resources instead.

Steven Nagy
Readify | Senior Developer

M: +61 404 044 513 | E: [email protected] | B: azure.snagy.name
<http://azure.snagy.name/> 

 

From: [email protected] [mailto:[email protected]]
On Behalf Of Stephen Price
Sent: Friday, 18 June 2010 12:47 PM
To: ozWPF
Subject: missing resource

 

Hey all,

 

Working on some WPF and have hit something I'm sure is easy but can't
seem to find an answer on.

 

I've added a style to the main page and put the new style into a
MergedDictionary, it works no problems. Where i've come unstuck is
there's a unit test in another project that creates an instance of the
shell. It now fails as it can't find the resource. I'm puzzled at how I
add it. I tried copying the App.xaml file but it gives errors pointing
to the fact the project doesn't like there being an
ApplicationDefinition. 

 

Just wondering how other people get around this? 

 

cheers,

Stephen


_______________________________________________
ozwpf mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf

 


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
_______________________________________________ 
ozwpf mailing list 
[email protected] 
http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf 

________________________________________________________________________
_______ 

This email has been scanned by the Bankwest Email Security System. 
________________________________________________________________________
_______ 

_______________________________________________________________________________
Unencrypted electronic mail is not secure and may not be authentic.
If you have any doubts as to the contents please telephone to confirm.

This electronic transmission including any attachments is intended only
for those to whom it is addressed. It may contain copyright material or
information that is confidential, privileged or exempt from disclosure by law.
Any claim to privilege is not waived or lost by reason of mistaken transmission
of this information. If you are not the intended recipient you must not
distribute or copy this transmission and should please notify the sender.
Your costs for doing this will be reimbursed by the sender.

We do not accept liability in connection with computer virus, data corruption,
delay, interruption, unauthorised access or unauthorised amendment.
_______________________________________________________________________________


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
_______________________________________________
ozwpf mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf

Reply via email to