Randoop.NET is an API fuzzing unit test generator for .NET libraries. It creates test cases by sequence of API method calls and it improves on random and static test generation by incorporating feedback during test generation.

Randoop is extremely easy to use:
  • point it at your asssembly
> randoop  /timelimit:10 System.Xml.dll
  • here is a typical generated test case:

//LAST ACTION: System.Xml.XmlConvert.Char ToChar(System.String)
//EXCEPTION: System.FormatException
using System.Xml;
using System;
public class RandoopTest1262
  public static int Main()
      //BEGIN TEST
      System.DateTime v2 =
         (System.DateTime)(System.Array.CreateInstance(typeof(System.DateTime), 1))
      System.Xml.XmlDateTimeSerializationMode v3 = 
      System.String v4 = System.Xml.XmlConvert.ToString(v2, v3) ;
      System.Char v5 = System.Xml.XmlConvert.ToChar((System.String)v4) ;
      //END TEST
      System.Console.WriteLine("This was unexpected behavior
                                (expected an exception). Will exit with code 99.");
      return 99;
    catch (System.FormatException e)
      System.Console.WriteLine("//EXCEPTION:" + e.GetType().FullName);
      System.Console.WriteLine("This was expected behavior.
                                Will exit with code 100.");
      return 100;
    catch (System.Exception e)
      System.Console.WriteLine("//EXCEPTION:" + e.GetType().FullName);
      System.Console.WriteLine("//STACK TRACE:");
      System.Console.WriteLine("This was unexpected behavior.
                                Will exit with code 99.");
      return 99;
//REFASSEMBLY: C:\windows\assembly\GAC_MSIL\System.Xml\\System.Xml.dll
//REFASSEMBLY: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll

More information

The project is sponsored by the Research in Software Engineering (RiSE) team at Microsoft Research, Redmond.

Last edited Sep 9, 2010 at 12:53 AM by shuvendu, version 41