Developer Faqs

Table of Contents

  1. Where can I find the latest source code for NUnitLite?
  2. Why did you stop using Codeplex?
  3. Why not use (some other site)?
  4. Where can I get a copy of Bazaar?
  5. How do I get a copy of the latest source for use?
  6. How do I get a copy of the latest source for modification?
  7. How can I build NUnitLite from source? (NAnt)
  8. How can I build NUnitLite from source? (Visual Studio)
  9. How do I use NUnitLite in my own project?
  10. How can I execute my tests on a device?

  1. Where can I find the latest source code for NUnitLite?

    The NUnitLite source code is maintained on Launchpad at http://launchpad.net/nunitlite.

    Launchpad is an open source site with a special emphasis on making it easy for people to contribute to projects without the need for any special authorization. This idea really appeals to me.

    A big plus for Launchpad is its use of the Bazaar distributed version control system, which provides great opportunities for decentralized development.

    Several NUnit-related projects are now hosted on Launchpad as part of the NUnit Extended Testing Platform project group. The next major release (3.0) of NUnit itself will be on Launchpad as well.

    Table of Contents

  2. Why did you stop using Codeplex?

    Codeplex is a great site, but it's entirely Microsoft-oriented. NUnitLite - like NUnit itself - is intended to be crossplatform.

    It also didn't help that Codeplex kept changing my project status to "unpublished" and threatening to remove it. :-)

    Table of Contents

  3. Why not use (some other site)?

    There are lots of great sites for hosting open source projects and their capabilities are changing all the time. I picked Launchpad. See above for what I like about it.

    Table of Contents

  4. Where can I get a copy of Bazaar?

    Visit the Bazaar project (http://launchpad.net/bzr), which is also hosted on Lauchpad. For Windows, be sure to get a Windows installer. For Linux, you should be able to use your package management system to install Bazaar.

    Table of Contents

  5. How do I get a copy of the latest source for use?

    For this question, we assume you only need to export a copy of the source for use with your own test projects. See the next question if you plan to make changes to NUnitLite.

    Use the command line to change to the directory to which you want to export a copy of NUnitLite and enter the following command:

    bzr export DEST lp:nunitlite
    

    When the command completes, you will have a sub-directory called DEST containing the full NUnitLite source tree. Note that the DEST directory is created by the export command and must not exist beforehand.

    Table of Contents

  6. How do I get a copy of the latest source for modification?

    Unlike most centralized version control systems, Bazaar creates a complete, stand-alone repository on your machine by default. You will be able to make changes, commit to that repository, back out changes, etc. This is known as a "branch" in Bazaar. To create your own local branch of NUnitLite, use the command line to change to the directory in which you want to create it and enter the following command:

    bzr branch lp:nunitlite
    

    When the command completes, you will have an nunitlite sub-directory containing the full NUnitLite source tree as well as a local repository for your own use. You can make changes and commit to your local repository. You can even publish your branch on Launchpad for others to use - see the Launchpad and Bazaar docs for more info. If you wish, you can propose your changes for merging into the official NUnit release.

    Table of Contents

  7. How can I build NUnitLite from source? (NAnt)

    The simplest build is created by using the 'build' target by itself. Change into the 'src' directory and enter the command:

             nant build

    This will build a debug version of NUnitLite using the default runtime on your system, which depends on the particular runtimes you have installed. To see the defaults that will be used on your system, enter the 'nant' command without any arguments.

    To build a release version of NUnitLite, use the command

             nant release build

    To build a version that uses a particular runtime, use

             nant RUNTIME build
    where RUNTIME may be any of the following:
    • net, net-1.0, net-1.1, net-2.0
    • netcf, netcf-1.0, netcf-2.0
    • mono, mono-1.0, mono-2.0

    The specified runtime and sdk must be installed on your system in order for the build to succeed. The build output is placed in a subdirectory of the build directory, named according to the configuration and runtime, for example: build/net/2.0/release.

    Here are some additional examples of build commands...

    Do a clean release build using .NET 2.0.

             nant net-2.0 release clean build

    Build the default (debug) config for all supported runtimes

             nant build-all

    Clean, build and run tests using the default (debug) config and runtime.

             nant clean build test

    Use nant -projecthelp to see a full list of targets.

    Table of Contents

  8. How can I build NUnitLite from source? (Visual Studio)

    The NUnitLite source comes with two Visual Studio 2005 solutions, located under the solutions directory.

    The vs2005 subdirectory contains a solution for building NUnitLite under .NET 2.0 for use with desktop applications. It is also useful for initial testing of some device applications, prior to deployment.

    The vs2005CF subdirectory has a solution for building under the compact framework, version 2.0. Use this solution in order to launch tests on devices or device emulators.

    When building under VS, the output of the build is placed in subdirectories under the solution. For example, the vs2005 solution creates the NUnitLite assembly in the directory solutions\vs2005\NUnitLite\bin\Debug (or Release) directory.

    Table of Contents

  9. How do I use NUnitLite in my own project?

    Your test assembly should be built as a console application, with Main() executing your tests. Here is a simple Main() for use with a desktop app or with any device that provides a console:

    static void Main(string[] args)
    {
        new ConsoleUI().Execute(args);
    }

    For devices without console output, you could use this version, which writes the output to a file in the Documents folder:

    static void Main(string[] args)
    {
    #if NETCF_1_0
        string myDocs = @"\My Documents";
    #else
        string myDocs = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
    #endif
        string path = System.IO.Path.Combine(myDocs, "TestResult.txt");
        System.IO.TextWriter writer = new System.IO.StreamWriter(path);
        new TextUI(writer).Execute(args);
        writer.Close();
    }

    Another option is to use DebugUI, which writes test results to Debug. This has the advantage of working in either environment. Additional runner UIs are under development and may be found in the source in the file TextUI.cs

    Of course, to make use of any of these techniques, you must have NUnitLite available. You can do this by incorporating the source code for NUnitLite into your test assembly or by adding a reference to it. If you use a reference, you may choose to build the NUnitLite assembly as a part of your project or build it separately and simply copy the dll.

    Table of Contents

  10. How can I execute my tests on a device?

    Currently, this is only supported through use of Visual Studio. Simply build your project for the appropriate device. Then, after making sure that your test assembly and all dependencies are marked for deployment, execute the test in the normal way - with or without Debug. Visual Studio will deploy your assemblies to the device and run the test.

    A future release will support deployment and execution without use of Visual Studio.

    Table of Contents