My blog has moved!!

Tuesday, September 04, 2007

Make that version 1.0.0.3!

I did not quite get this feature into the previous version and just posted the updates in case I got busy.

The big (and very useful) change for build 3 is that you can "paste" unit test code into the tool and the phrases will be extracted - if they use underscores and the code is C# (sorry, minor bug, I'll fix that shortly!) In practice I have found the underscore styke far more readable.

For example, if you have the following unit test code, copy it to the clipboard...

namespace Tests
{
    [TestFixture]
    public class PersonEntityTests
    {
        [SetUp]
        public void TestSetUp()
        {
            // ...
        }
        
        [Test]
        public void A_method_will_be_extracted_from_the_clipboard()
        {
            // asserts etc
        }
    }
}

...and use the new "Paste beaviours from clipboard" menu option (or ALT+F5) and you get the method name extracted.

The full round trip. Whe you want to continue working on a unit test class you can use this feature to get the current context of the testing... have fun! PK :-)

  http://www.pksoftware.net/BehaviourToUnitTest/


Quick note - now at v1.0.0.2 - the main changes are:
  • The use of the ICSharp.TextEditor for better editing
  • The defaults are C# with the underscore style
  • A few more word substitutions by default

Enjoy!

Tuesday, September 04, 2007 10:49:31 AM (GMT Standard Time, UTC+00:00) |  |  |  |  | #
Monday, August 27, 2007

I have uploaded a small development tool that I put together recently, its called "Behaviour to Unit Test". Basically it converts code functionality from plain sentences (or stories) into unit test stub code. You could also think of it as a cure for TDD writers block!

For an example of the usage, use the Generation -> Fill out example menu option and hit Convert. Basically it takes a set of plain language behaviours for an object such as "person":

  • Check that the default values of all string properties are empty
  • The ToString method renders the first and last names
  • If the date of birth is null, calculate age will return -1
  • If the date of birth is not null, calculate age will return a value

...and converts them into something like:

using System;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;

namespace Tests
{
    [TestFixture]
    public class PersonEntityTests
    {
        private PersonEntity person;
        
        [SetUp]
        public void TestSetUp()
        {
            person = new PersonEntity();
        }
        
        [Test]
        [Ignore("Currently only a unit test stub")]
        public void CheckThatTheDefaultValuesOfAllStringPropertiesAreEmpty()
        {
        }
        
        [Test]
        [Ignore("Currently only a unit test stub")]
        public void TheToStringMethodRendersTheFirstAndLastNames()
        {
        }
        
        [Test]
        [Ignore("Currently only a unit test stub")]
        public void IfTheDateOfBirthIsNullCalculateAgeWillReturnMinus1()
        {
        }
        
        [Test]
        [Ignore("Currently only a unit test stub")]
        public void IfTheDateOfBirthIsNotNullCalculateAgeWillReturnAValue()
        {
        }
    }
}

There are C# and VB.NET templates for now. Check it out:

  http://www.pksoftware.net/BehaviourToUnitTest/

My intention is to keep the tool small and simple. The main thing I want to add at the moment is some load/save functionality and drop in the ICSharp.TextEditor for more friendly editing...

kick it on DotNetKicks.com

Monday, August 27, 2007 9:43:04 AM (GMT Standard Time, UTC+00:00) |  |  |  |  |  | #
Search
Links
Products
Mini SQL Query
Mini SQL Query is a minimalist SQL query tool for multiple providers (MSSQL, Oracle, OLEDB, MS Access files etc.)

Verse Popper
The "Verse Popper" displays bible verses periodically in the lower right hand corner of your screen.

Categories
Blogroll
 PK Software DevBlog
My new blog!