Tagged: CruiseControl.NET RSS

  • John 8:02 pm on January 1, 2010 Permalink | Reply
    Tags: , CruiseControl.NET, NAnt   

    NAnt.ToDo a NAnt Plugin 

    This simple plugin for NAnt parses your source code and creates a report of all the TODO and comment tags in your source code. The code is hosted over at google code.

    Comments

    The task automatically identify comments in the following style

    //TODO: First Test to do Item
    //FIXME: First Fix me Item
    //HACK: First Hack Item
    

    Additional matches can be made by adding in Token elements to the NAnt task.

    Sample

    <ToDo source="path/to/source" output="report.xml" searchpattern="*.cs;*.txt">
     <Tokens>
     <Tokens Value="BUGFIX" />
     </Tokens>
    </ToDo>
    

    Output

    <ToDo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
     <Items>
     <Item>
     <Message>First Test to do Item</Message>
     <File>NAnt.ToDo\ToDoTask.cs</File>
     <Line>0</Line>
     <Type>TODO</Type>
     </Item>
     <Item>
     <Message>First Hack Item</Message>
     <File>NAnt.ToDo\ToDoTask.cs</File>
     <Line>0</Line>
     <Type>HACK</Type>
     </Item>
     <Item>
     <Message>First Fix me Item</Message>
     <File>NAnt.ToDo\ToDoTask.cs</File>
     <Line>0</Line>
     <Type>FIXME</Type>
     </Item>
     </Items>
    </ToDo>
    

    Cruise Control Xsl

    Below is a basic xsl style sheet that can be used with CruiseControl.NET to display the output from NAnt.ToDo.

    <?xml version="1.0"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
     <xsl:output method="html"/>
     <xsl:param name="applicationPath"/>
     <xsl:template match="/">
     <div id="ToDo">
     <h1>ToDo List</h1>
     <div id="Summary">
     <h3>To Do</h3>
     <table>
     <tbody>
     <xsl:for-each select="//ToDo/Items/Item">
     <tr>
     <td>
     <xsl:value-of select="Type/text()"/>
     </td>
     <td>
     <xsl:value-of select="Message/text()"/>
     </td>
     <td>
     <xsl:value-of select="File/text()"/>
     </td>
     </tr>
     </xsl:for-each>
     </tbody>
     </table>
     </div>    
     </div>
     </xsl:template>
    </xsl:stylesheet>
    
     
  • John 10:06 pm on September 26, 2009 Permalink | Reply
    Tags: , CruiseControl.NET, , , ,   

    jqRunner Snapshot – Running Javascript Unit test with NUnit 

    One of the nice things about unit tests is that you can use continuous integration so that you don’t have to run them yourself. At work we use CruiseControl.NET to automate our builds and run our unit tests. Now as a number of our projects are web based we use a fair amount of javascript, mainly jQuery, though in-house plugins. In order to test these we use jqunit, this works great and allows us to use TDD when writing javascript. However as development goes on the unit tests get forgotten about as they are not automatically ran.

    In order so solve this I decided to experiment to find a method of getting cruise control to run our jqunit tests for me. To run the tests I looked at wrapping the jqunit tests with nunit tests.

    jqRunner

    jqRunner is designed so that you can us your existing jqunit tests in their existing location without changing them. jqRunner required that all the scripts that are needed to run are registered. The full path to the file is required. jqRunner then executes the tests and returns the results, which are then parsed by nunit as tests using the TestCaseSource attribute.

    var sampleTestCase = new jqUnit.TestCase('Sample Test Case', function() {
        /*setup*/
        // this.yep(1);
    }, function() {
        /*teardown*/
        // this.ok(1)
    });
    sampleTestCase.test('Sample Test 1', function() {
        this.ok(1);
    });
    sampleTestCase.test('Sample Test 2', function() {
        this.ok(0);
    });
    
    using System;
    using System.Collections.Generic;
    using NUnit.Framework;
    using jqRunner;
    using System.IO;
    using System.Reflection;
    
    namespace jqRunner.Tests
    {
        [TestFixture,RequiresSTA]
        public class TestCaseSourceTests
        {
            [Test, TestCaseSource("GetTestResults"), RequiresSTA]
            public void CheckTest(ITestResult result)
            {
                Assert.IsTrue(result.Pass, result.Name);
            }
    
            private static ITestResult[] GetTestResults()
            {
                string jsFile = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase) + @"\jqUnitTests\SampleUnitTest.js";
                TestBed target = new TestBed();
                target.RegisterScript(jsFile);
                return target.Execute().ToArray();
            }
        }
    }
    

    This is an initial development snapshot and is bound to have plenty of problems.

    Download
    http://static.yeticode.co.uk/blog/downloads/jqRunner-snapshot.zip

     
  • John 8:56 pm on July 13, 2009 Permalink | Reply
    Tags: , CruiseControl.NET,   

    Python and CCTray Again 

    So after creating a python script that would use my tux droid to notify me when a build failed I decided to extend the script a little further. I decoupled it from the tux droid code and added in a status menu. It still requires that CruiseControl.NET has the webdashboard installed. This is my first venture into using GTK with python, as well as threads.

    One of the problems that I encountered when trying to use thread was that they were not behaving correctly. The Thread would appear to start however it would not run. This was easy to fix but adding the following line to initialize the threading.

    gtk.gdk.threads_init()
    

    In addition to this the class that was running the thread not only had to inherit from the threading.Thread object but had to explicitly call the init on the threads base class

    class ccnetworker(threading.Thread):
    
    	# init
    	def __init__(self,xmlPath,pycctray):
    		threading.Thread.__init__(self)
    		self.xmlPath = xmlPath
    		self.pycctray = pycctray
    

    Below is a screen shot of the system tray menu, listing the projects that are available to be force built.

    pycctray screenshot

    # example usage
    python pycctray.py http://localhost/ccnet/XmlServerReport.aspx
    

    You can get the latest source from the bazaar repository

    bzr branch http://bzr.yeticode.co.uk/pycctray
    

    Alternatively you can download the source files on their own: pycctray.tar.gz

     
  • John 9:25 am on July 10, 2009 Permalink | Reply
    Tags: CruiseControl.NET, , tux droid   

    Tux Droid with Cruise Control .NET 

    Tux Droid

    So after having my tux droid for a while I decided to put it to good use, opposed to making it swear at my housemates, which no matter how entertaining it was did not seem very productive.
    I decided to write a small script that would notify me when a build from Cruise Control.NET failed, or when a broken build has successfully been built. At the moment the tux droid speaks a simple message and flaps it wings a little.

    The script uses the tux droid python API to make the noises and pulls down an Xml file, via CruiseControl.NET, using urllib and xml.dom, fairly simple stuff.

    You can get a copy of the source, which might be more up-to-date, frm the bzr repository.

    # bzr branch http://bzr.yeticode.co.uk/ccnet-tuxbot
    


    Usage:
    # python ccnet.py http://localhost/ccnet/XmlServerReport.aspx
    

    download ccnet.py
    Update 11-07-2009 12:00AM: update notifcations in ccnet.py script.

    #!/usr/bin/python
    import sys
    import urllib
    import time
    from xml.dom import minidom
    from tuxisalive.api import *
    
    def main(xmlPath):
    	# load the inital settings that we will use to compare against
    	projects = []
    
    	dom = minidom.parse(urllib.urlopen(xmlPath))
    	for node in dom.getElementsByTagName('Project'):
    		projects.append({
    			'name': node.getAttribute('name'),
    			'lastBuildStatus': node.getAttribute('lastBuildStatus'),
    			'lastBuildTime': node.getAttribute('lastBuildTime')
    		})
    
    	# start a loop that will check for a build event every 10 seconds
    	while True:
    		try:
    			dom = minidom.parse(urllib.urlopen(xmlPath))
    			new_projects = []
    			for node in dom.getElementsByTagName('Project'):
    				new_projects.append({
    					'name': node.getAttribute('name'),
    					'lastBuildStatus': node.getAttribute('lastBuildStatus'),
    					'lastBuildTime': node.getAttribute('lastBuildTime')
    				})
    				for project in new_projects:
    					# check to see if the project is in the current list
    					projectFound = False
    					for p in projects:
    						if p['name'] == project['name']:
    							projectFound = True
    							# check the status of the project against the old status
    							# ignore if the old status is failed
    							if (p['lastBuildStatus'] != 'Failure') and (project['lastBuildStatus'] == 'Failure'):
    								display_message_fail(project)
    							if (p['lastBuildStatus'] == 'Failure') and (project['lastBuildStatus'] == 'Success'):
    								display_message_success(project)
    							if (project['lastBuildStatus'] == 'Success') and (project['lastBuildTime']  != p['lastBuildTime'] ):
    								display_message_success_build_again(project)
    
    							# reset the project status
    							p['lastBuildStatus'] = project['lastBuildStatus']
    							p['lastBuildTime'] = project['lastBuildTime']
    					if not projectFound:
    						projects.append(project)
    						display_message_newproject(project)
    			time.sleep(10)
    		except KeyboardInterrupt:
    			# exit time
    			break
    
    def display_message_fail(project):
    	msg = 'Someone has broken the %s build' % (project['name'])
    	speakPhrase(msg)
    
    def display_message_success(project):
    	msg = '%s is now fixed' % (project['name'])
    	speakPhrase(msg)
    
    def display_message_new(project):
    	msg = '%s has been added to cruise control' % (project['name'])
    	speakPhrase(msg)
    
    def display_message_success_build_again(project):
    	msg = '%s has successfuly been built' % (project['name'])
    	speakPhrase(msg)
    
    def speakPhrase(msg):
    	tux.mouth.open()
    
    	tux.tts.setLocutor("Lucy")
    	tux.tts.speak(msg.encode('utf-8'));
    	print msg
    	tux.flippers.on(4)
    
    	tux.mouth.close()
    
    def tuxConnect():
        """ Wait connected """
        tux.server.autoConnect(CLIENT_LEVEL_RESTRICTED, 'TuxPidgin', 'NONE')
        if tux.server.waitConnected(10.0):
            if tux.dongle.waitConnected(10.0):
                if tux.radio.waitConnected(10.0):
                    return True
                else:
                    print "radio not connected"
                    return False
            else:
                print "radio not connected"
                return False
        else:
            print "server not connected"
            return False
    
    def printUsage():
    	print "ccnet.py [url]"
    	print "\turl - Url of CruiseControl.NET"
    	print "\t\t eg. http://localhost/ccnet/XmlServerReport.aspx"
    
    if __name__ == "__main__":
    	if len(sys.argv) == 2:
    
    		tgp_ip = "127.0.0.1"
    		tgp_port = 270
    		tux = TuxAPI(tgp_ip, tgp_port)
    		if not tuxConnect():
    		    sys.exit(1)
    		tux.tts.setEncoding("utf-8")
    
    		speakPhrase("Starting Build Bot")
    		main(sys.argv[1])
    		speakPhrase("Stopping Build Bot")
    		tux.server.disconnect()
    		tux.destroy()
    		sys.exit(0)
    	else:
    		printUsage()
    

     
  • John 4:01 am on March 24, 2009 Permalink | Reply
    Tags: , , CruiseControl.NET, ,   

    Cruise Control Tray For Linux Update 

    Basic functionality has been implemented with the ability to add project to monitor and receive notifications of the build as and when they occur. At the moment there is not the ability to delete a project that is being monitor this will be implemented next. There is also the ability to force a build of a project, however there is not the ability to abort the build, this will also been implemented in the next couple of days hopefully. Here are some more screen shots of what it currently looks like. The build notification have also been attached to the tray icon.



     
  • John 3:47 am on March 19, 2009 Permalink | Reply
    Tags: , , CruiseControl.NET, , LaunchPad, ,   

    Cruise Control.NET Tray Tool on linux 

    I started looking at creating a port of the cctray tool for CruiseControl.NET but after looking at how it was implemented i decided that it might be easier, and more fun, to implement one myself using mono and GTK#. At the moment the application has the ability to display notification when a build event occurs and to display the list of projects that are being watched. The source code will be available on Launch Pad when I figure out how to use bzr.

    https://code.launchpad.net/~john-yeticode/cctray-gtk/trunk

    here are some screen shots of how it currently looks.



    Cruise Control.NET home page

     
    • Daniel Hommel 7:59 pm on April 10, 2009 Permalink | Reply

      I tried to make CCTray work on mono once and i had to comment out a lot of stuff to get it kind of working (all the windows-isms had to go)… After i got it running there were still a bunch of problems, like a ghost window with no content behind the CCTray window, all the projects showing up 2 times and the tray icon also didn’t work as it should. After all i think writing a Gtk# client is a good idea. I hope you will publish the code soon so i can try it out in my GNOME environment. BTW, do you use CCTrayLib for that project?

      regards,

      Daniel

    • Daniel Hommel 8:03 pm on April 10, 2009 Permalink | Reply

      Just found out that you did publish the code already and that also answered my question about CCTrayLib. I’ll try it out and let you know how it work.

      regards,

      Daniel

c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
esc
cancel