Click here to Skip to main content
15,892,965 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Accessing GitHub Pin
_Damian S_1-Jan-15 18:31
professional_Damian S_1-Jan-15 18:31 
GeneralRe: Accessing GitHub Pin
Sandeep Singh Shekhawat1-Jan-15 18:38
professionalSandeep Singh Shekhawat1-Jan-15 18:38 
GeneralRe: Accessing GitHub Pin
Super Lloyd1-Jan-15 18:31
Super Lloyd1-Jan-15 18:31 
GeneralRe: Accessing GitHub....released Pin
MT_1-Jan-15 19:35
professionalMT_1-Jan-15 19:35 
GeneralRe: Accessing GitHub....released Pin
Sandeep Singh Shekhawat1-Jan-15 19:40
professionalSandeep Singh Shekhawat1-Jan-15 19:40 
GeneralRe: Accessing GitHub Pin
Ron Anders2-Jan-15 3:51
Ron Anders2-Jan-15 3:51 
GeneralRe: Accessing GitHub Pin
Slacker0072-Jan-15 7:15
professionalSlacker0072-Jan-15 7:15 
GeneralMy initial impressions with "Smart Unit Tests" aka a test suite auto-generated by VS 2015 (long) Pin
Dan Neely1-Jan-15 15:34
Dan Neely1-Jan-15 15:34 
This is a fairly long post, so for the lazy I'll offer a summary up front:

TLDR: There's a lot of potential here; but some major limitations in what they try to test, how they present results, and the need to manually setup any non dependency injected state severely limit the easy button promises MSDN has made. Hopefully a future version will be better.

(If it wasn't for the negative results, and inability to take screenshots of work owned code; this probably would be a better fit as an article than as a long post here.)

This is a semi-followup to my travails with the elephants in corporate IT[^] and "hey that looks cool" replies to insider posts I can' be bothered to find now.

Because I ended up with a laptop only running Win7 (not 8.1 or 10 like I wanted); the only item on my list that I was able to give a whirl to was "Smart Unit Tests"[^]

The basic idea behind them is that by combining various code analysis and generation tools MS Research has been fiddling with over the last few years they're able to look at a codebase, analyze all the paths through it, and generate a set of unit tests to execute every possible path. For developers who have to work with large legacy code bases that weren't written with a unit test suite and whose maintenance budgets are too small to retrofit heavy coverage now, (*waves hand mournfully*), the potential gain here would be that an auto-generated test suite would flag any time changes made in one place propagated elsewhere in the code/altered edge cases/etc; allowing regression bugs to be spotted and fixed early instead of piling up until a pound the keyboard test was ran (or worse when the application went to production).

Unfortunately, my initial impressions are that while they've got a lot of useful bits and pieces; poor integration/developer experience and apparent functional limitations mean that the product is still in the watch and hope for future versions to make it usable stage.

Usability problems I've encountered:

0) The coarsest granularity that it appears to be possible to request test generation at is the class level. Meaning that if your application has several hundred classes you need open each individual source file, right click on the class name (in my case after scrolling past a boilerplate copyright comment header), and select the generate option from the context menu, wait several seconds to several minutes while the tools process that class....

1) After you've generated test cases for a class, there's no way to save the entire set in a single shot. Instead you have to view them by method, do a select all, and then save the selection.

2) While the results UI shows how many "blocks" of code it was able to generate coverage for in an X out of Y form I couldn't find a way to map the covered/not covered blocks back to the code so I could see what it was missing.


3) Issues 0) and 1) make creating a test suite for a non-trivial legacy app a major pain even if it is able to do everything MSDN marketing promises it can. (Without doing so I can't alleviate 2) by using an external code coverage tool.) However...

Functional limitations I've encountered:

A) My codebase uses factories to create objects indirectly; and the tools weren't smart enough to find the places where I coded Foo MyFoo = BarLibraryFactoryCreateFoo(/*...*/); and reported that it couldn't guess how to create Foo objects. In throwing up its hands, Smart Unit Tests, also failed to guess that it could use the internal static Foo Create(/*...*/) methods called by the factory methods or the non public constructors that the Create(/*...*/) methods called. It was at least easy to click fix and edit the auto-generated test factory manually to do object creation.

B) It appears to ignore anything that touches a winform UI control entirely. Since large portions of my legacy code are contained within event handlers, or methods called from the event handlers that read/write values from the UI controls directly; this means that a very large portion of my code remains untestable.

C) It's unable to generate any useful test results in methods where file IO is involved. It's only able to drill down as far as generating file not found errors. Guess what the other large chunk of legacy business logic I was hoping to use an easy button to bring under test is tangled with.

While it would be nice to refactor the code base to separate the business logic out from the UI and IO layers, unless the money fairy drops a check with enough money to keep me paid for a year, it's not going to happen. Even if it did; the act of decoupling the logic from everything else would almost require that I write a unit test suite as I went.

D) It's unable to figure out that it needs/how to effectively create any dependencies that are accessed via global/static class/etc means instead of being provided via dependency injection. (Yes, this is crappy design. Again, see: legacy code; and money fairy, non-existence of.) This meant that when I pointed it at a calculation library I was only able to get minimal coverage before it hit the limits of what it was able to do.

E) This is more of a meta issue; but the tests it generates that trigger an exception all fail. In a lot of cases, this probably is technically correct as it shows the code puking on unexpected nulls (vs an intentional null should throw decision); but it means that even if the other 4 functional problems are all overcome creating a regression detecting test suite would require a lot of manual editing to make the exception thrown tests pass when the exception was thrown.

Things I will(might) try when(if) I find more ambition to mess with this:

0) Poke at menus and throw questions as google to find out if there are options I didn't see to make usability problems 0) - 2) or functional limitation E) go away.

1) Modify the auto-generated test startup code to initialize enough state to work around D) and possibly C) so that the tools have the opportunity to generate a deeper set of tests. (Hopefully via shared testsuite wide code, not on a per class constructor basis.) D)'d be the easier starting place here, since it's the one component of the app I currently do have a good unit test suite for; but extending coverage to the file IO heavy code in C) would be more likely to get my PM onboard with spending a bit of money to go from my screwing with it on my own time to getting paid to push beyond an initial can it do anything useful prototype.
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius

Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt

GeneralRe: My initial impressions with "Smart Unit Tests" aka a test suite auto-generated by VS 2015 (long) Pin
Snesh Prajapati1-Jan-15 16:58
professionalSnesh Prajapati1-Jan-15 16:58 
GeneralRe: My initial impressions with "Smart Unit Tests" aka a test suite auto-generated by VS 2015 (long) Pin
Gary R. Wheeler2-Jan-15 0:59
Gary R. Wheeler2-Jan-15 0:59 
GeneralRe: My initial impressions with "Smart Unit Tests" aka a test suite auto-generated by VS 2015 (long) Pin
Dan Neely2-Jan-15 4:39
Dan Neely2-Jan-15 4:39 
GeneralRe: My initial impressions with "Smart Unit Tests" aka a test suite auto-generated by VS 2015 (long) Pin
Marc Clifton2-Jan-15 2:39
mvaMarc Clifton2-Jan-15 2:39 
GeneralRe: My initial impressions with "Smart Unit Tests" aka a test suite auto-generated by VS 2015 (long) Pin
Dan Neely2-Jan-15 4:30
Dan Neely2-Jan-15 4:30 
GeneralRe: My initial impressions with "Smart Unit Tests" aka a test suite auto-generated by VS 2015 (long) Pin
Marc Clifton2-Jan-15 4:39
mvaMarc Clifton2-Jan-15 4:39 
GeneralAll the best for 2015 Pin
Cornelius Henning1-Jan-15 12:37
professionalCornelius Henning1-Jan-15 12:37 
GeneralRe: All the best for 2015 Pin
Marc Clifton1-Jan-15 14:32
mvaMarc Clifton1-Jan-15 14:32 
GeneralRe: All the best for 2015 Pin
Sandeep Singh Shekhawat1-Jan-15 14:33
professionalSandeep Singh Shekhawat1-Jan-15 14:33 
Generalinternet security removal Pin
Southmountain1-Jan-15 12:19
Southmountain1-Jan-15 12:19 
GeneralRe: internet security removal Pin
Nelek1-Jan-15 12:26
protectorNelek1-Jan-15 12:26 
GeneralRe: internet security removal Pin
JMK-NI1-Jan-15 13:07
professionalJMK-NI1-Jan-15 13:07 
GeneralRe: internet security removal Pin
Southmountain1-Jan-15 14:49
Southmountain1-Jan-15 14:49 
GeneralRe: internet security removal Pin
Marc Clifton1-Jan-15 14:35
mvaMarc Clifton1-Jan-15 14:35 
GeneralRe: internet security removal Pin
Nicholas Marty1-Jan-15 14:54
professionalNicholas Marty1-Jan-15 14:54 
GeneralRe: internet security removal Pin
Ron Anders1-Jan-15 15:59
Ron Anders1-Jan-15 15:59 
GeneralRe: internet security removal Pin
Mark_Wallace2-Jan-15 0:20
Mark_Wallace2-Jan-15 0:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.