Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Supplement the Solution Explorer
John Nilsson
#1 Posted : Saturday, March 9, 2013 11:47:04 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 3/9/2013(UTC)
Posts: 5
Location: Sweden

First of all, thanks for NCrunch, love it!

I find my self reaching for the NCrunch Tests window as if it was the Solution Explorer, trying to navigate to, or create, classes.

Maybe a stange feature for a test runner, but what do you think of adding a few simple project maintenance features to the tests window?

In the spirit of TDD this would be used for, and encourage, a test first approach to everything.

Example

"New class" (or "module" if that is a better name)
Would ask for a name
Create a class with that name in the appropriate namespace
Create a matching test class using a template from a configured test framework
Open the test class and leave you with the cursor in a position to start calling a method on a freshly create instance of the class.
Remco
#2 Posted : Saturday, March 9, 2013 10:34:16 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,135

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi John,

Thanks for posting! I'm glad you're enjoying NCrunch!

This is an interesting request and I'm wondering if I could drill a bit deeper into your use cases to find out what you are trying to achieve.

My first thought is that if you find the need to use the Tests Window to create test classes/files, then would the main use case here would be for when you are wanting to add a new test or fixture to an existing codebase?

The Tests Window view is constructed around Project/Fixture/Test - it doesn't really know anything about classes or methods, so I guess the logical approach would be to have an option such as 'Add fixture' or 'Add test', which then uses some kind of template to translate this action into a new file or code block in the codebase. Do you think this would fit your needs?

I can see a few challenges around implementing something like this (i.e. how to fit a new method fit in the existing fixture?), but I can see the benefit, and dreams are certainly free :)


Cheers,

Remco
John Nilsson
#3 Posted : Sunday, March 10, 2013 1:45:14 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 3/9/2013(UTC)
Posts: 5
Location: Sweden

It's not really that much of a use case. Rather a combination a common mistake on my part, and a long term vision of an entierely different product.

The mistake is simply that because the test window is organized around projects it kind of looks like an explorer. Combined with the fact that I tend to have the test window open all the time I have a tendency to want to interact with the project thourgh this window.

The long term thing is an idea I have of en IDE/language where tests define module interfaces. A language and environment where there simply is no distinction between tests and types (as in type theory, not as in classes). In such an environment the project explorer and test widndow would probably be the same thing (allthougha I envision a search based navigation for this system)
Dreams are free as you say ;-)


Now the use case I have in mind for NCrunch was not to create tests for existing code, but to create tests for code yet to be written, but both needs could probably be served by the same design.

A template based "new fixture" would do some of what I had in mind the important detail to achieve the effect I'm after is to create the class to be tested from the test though. Visual Studio can do a "Generate class for '...'" fix for unkonwn symbols. If I could activate that fix from the test code and have the class end up in the correct project and namespace I would be happy. But tests are usually not in the same project as the tested code, and I guess it's not uncommon to have different namespaces too. So by default the effect of the generate class fix does not work that well.


On the imprtance scale this is really a "nice to have" so I'm sure you have quite a few more important things on your TODO-list than this. Just wanted the idea out there to see if you, or others, agree that it would be a nice feature.
Remco
#4 Posted : Sunday, March 10, 2013 9:43:19 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,135

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
I find this idea particularly interesting because behind it there is a perspective of what automated tests should be, rather than what they actually are.

By programming in any language, we're always bound by the constraints of this language. Learning to write automated tests in classes in separate files is a result of implementing the tests in C#. Other languages have different approaches, but I find it refreshing to get back to the core of what we're actually doing - writing requirements precise enough that they can test our code.

The tricky part of this for any tools developer is catering for the huge range of different ways that these requirements can be expressed. In your suggested approach, this complexity would need to exist within the templates used to create the tests and fixtures.

So I think that this would be a tough one, and I'm not sure if I can scope it at the moment ... but I much appreciate the idea, and maybe one day we'll see something similar to this :)


Cheers,

Remco
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.046 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download