Calvin Hsia's WebLog
thoughts from a professional developer
Translate This Page
Translate this page
Browse by Tags
Calvin Hsia's WebLog
Tagged Content List
Scan the Windows Event Log for your application crashes and hangs
When you write software that runs on someone’s machine, it might crash or hang. If this occurs, there are ways to see if this occurred from your program. For example, I wrote a simple application in C++ called CppTest that crashes by dereferencing a null: char *ptr = 0; *ptr = 0; Lo and behold: my custom...
31 Jul 2013
Use Custom Attributes to initialize test environments
Some tests can be quite complex, perhaps having prerequisites that consist of various steps, querying initial conditions, loading test data, etc. You can use Attributes to specify various test configurations. The sample below shows how to create your own attribute class and how to retrieve and use it...
28 Jun 2013
Create a logger for watching your test progress as it runs.
I was creating a project that’s a Windows Service, which has components running in multiple processes, using multiple threads and named pipes for communication. To understand the behavior of the code, I wanted to have accurate logging that: · The timing was very critical, so I wanted the log to...
29 Dec 2012
Turn your tests into stress tests easily
It’s great to be able to write tests and execute them while developing a project. While I’m developing, I can hit a button and run the dozens of tests to see if I’ve broken anything. As code gets written lots of things get refactored, moved around, etc. Hitting a button to see if I broke anything is...
30 Nov 2012
Increase the memory available to your tests
I love having test projects included in my solutions. Software is alive. I’m constantly making improvements/changes/fixes. When I have customers asking for various features in my code, or for code improvements, being agile and able to publish a changed build with utmost confidence relies...
27 Jun 2012
Automatic tests protect your code
Last month in Dynamically create huge tooltips in WPF TreeView and ListView I showed some code that creates large tooltips to present lots of data. Today, we’ll talk about creating automatic tests for this feature. Testing User Interface features has been difficult...
31 Aug 2011
Dynamically create huge tooltips in WPF TreeView and ListView
Tooltips are useful. When the mouse hovers over a button a tip can indicate what happens when it’s clicked. The mouse move does not actually invoke the button, but can give information in a passive way. Sometimes I want to make huge tooltips. This essentially gives more screen real estate...
29 Jul 2011
Persist user form size and location settings per session
My prior post ( Create your own Test Host using XAML to run your unit tests ) shows how to create a form and present it to the user. The user can resize and reposition the form, even on a 2 nd monitor. When the user exits the form, we can persist or remember the form size and location, so the next...
2 Apr 2008
Create your own Test Host using XAML to run your unit tests
A few days ago, somebody came into my office and plopped down a box. It seemed very light. He said that it was a new PC. I thought hmmm…. The box seems empty…Why am I getting a new PC?. Apparently an inventory was made and my current hardware was at the lower end of the list. So I started up...
27 Mar 2008
Find the Executing function's name
Often I want to write the SAME code that will display the name of the currently executing method or function. That way I can just copy/paste the same code into multiple methods. For example, in sub Form1_Load I could put this line: System.Diagnostics.Debug.WriteLine( "in Form1_Load" ) ...
27 Feb 2008
Use Visual Studio Test framework to create tests for your code
While writing software over a period of weeks or months, various components of the software get completed at various times. You’ve tested and you’re satisfied they work, and you move on to develop another feature. Or you might check in the source code and somebody else on your team might break your code...
25 Feb 2008
Page 1 of 1 (11 items)
© 2013 Microsoft Corporation.
Privacy & Cookies