Tag Archives: gallio

NAnt sucks and Rake rocks

1 Feb

In these days I’m moving my build scripts from NAnt to Rake. The main reason for doing this is that I’m moving from external dsl to an internal dsl. Internal DSLs are often the most approachable form of DSLs to write. Unlike external DSLs you don’t need to learn about grammars and language parsing, unlike language workbenches you don’t need any special tools. With internal DSLs you work in your regular language environment.

This means that now I build my build scritps just with ruby. I believe this is a good way to learn this nice language. Rake in fact is nothing more that a Ruby library.

Getting started with Rake and .NET is very easy:

  • Download the Ruby for windows one click installer.
  • Install it
  • Create a file Rakefile.rb (type is text file)
  • Type:
    task :default => :build
    
    task :build => [:compile, :test, :deploy] 
    
    task :compile do
      params = '/t:Rebuild /nologo /v:m /p:Configuration=Release src\demo.sln'
      msbuid = 'C:\\WINDOWS\\Microsoft.NET\\Framework\\v3.5\\MSBuild.exe'
      sh "#{msbuid} #{params}" 
    end
    
    task :test do
     runner = 'tools\\Gallio\\Gallio.Echo.exe'
     assemblies = FileList["src/**/bin/Release/*.Fixture.exe"]
     extension = '' #'/e:TeamCityExtension,Gallio.TeamCityIntegration'
     sh "#{runner} #{assemblies} #{extension}"
    end
    
    task :deploy do
        sh "echo Task not yet implemented!"
    end
  • Open a command prompt (Start->Run->Cmd)

  • Type: cd c:\[my RakeFile.rb folder] (obviously put your own path in)

  • Type: rake
  • Done!

As you can see here above with rake there is no need to learn some crazy xml syntax. Whit this little script I compile my solution and run all unit tests. No need to write xml, only some ruby code.

Nothing more nothing less.

Technorati Tag: ,,,
Annunci

Use NAnt to run mbunit tests using gallio

1 Dic

Gallio has a great build-in support for NAnt!
Unfortunately at the moment this is not well document so if you need to create a target to execute all tests inside an assembly you can write this xml fragment inside your NAnt project file:

<target name=”test” depends=”build”>
  <gallio
    result-property=”exitCode”
    failonerror=”false” >
    <runner-extension value=”TeamCityExtension,Gallio.TeamCityIntegration” />
    <assemblies>
      <!– Specify the tests assemblies –>
      <include name=”${src.dir}Data.Fixturebin${project.config}Data.Fixture.dll”/>
    </assemblies>
  </gallio>
  <fail if=”${exitCode != ‘0’}” >One or more tests failed. Please check the log for more details</fail>   
</target>

don’t forget to load Gallio NAnt Tasks before start with this line of xml

<loadtasks assembly=”.toolsGallioGallio.NAntTasks.dll” />

If you need more information you can take a look at comment in the source code here

Technorati Tag: ,,