Posts

Showing posts with the label testing

SharpDevelop 4 and unittest2

Two weeks ago I reported on the latest news from SharpDevelop, the integration of unittest into SharpDevelop 4 for testing with IronPython. In my report I suggested that supporting unittest2 would be even better and Matt Ward has risen to the challenge. Matt's latest blog entry shows how to use unittest2 to run IronPython unit tests in the forthcoming SharpDevelop 4 IDE: SharpDevelop and unittest2 for Python SharpDevelop 4 has been updated to support running IronPython unit tests that use the unittest2 library. Make sure unittest2 is on the Python path before running the unit tests. Out of the box SharpDevelop will actually use the unittest library's test runner. This seems to work however if you actually need to use the unittest2 test runner then you can modify the following two files in the folder:  AddIns\AddIns\BackendBindings\PythonBinding\TestRunner . sdtest.py  sdtestrunner.py

A Good Mix 36: Jim Hugunin, Selenium Two, Embedding IronPython & IronPython with Expression Blend

Another collection of IronPython and DLR related articles from recent weeks. Jim Hugunin: Modelling the World Jim Hugunin is a bit of a Python veteran. As well as being the creator of two implementations of Python (Jython and IronPython), he also started the Numpy project (back when it was called Numeric). Not long ago he was swallowed by Microsoft, who also took on the development of IronPython and turning it into the Dynamic Language Runtime. In this video interview Jim explains not only how he got involved in Python, but also what he has been up to recently. IronPython Tools for Visual Studio with Expression Blend One of the ways that .NET helps you separate your visual design from your application logic is through XAML; an XML based declarative language that can be used with both Windows Presentation Foundation (WPF) and Silverlight. Naturally there are design tools that will generate XAML. Visual Studio is one of them, but the best one is Expression Blend. XAML has features...

Acceptance Testing .NET Applications using IronPython

This article, written by Jonathan Hartley, was originally published in the Python Magazine. Acceptance Testing .NET Applications using IronPython Unit tests demonstrate to developers that individual functions and classes work as expected. Acceptance tests are an orthogonal complement to this. They verify to everybody, including managers and clients, that features they understand and care about are completed and working correctly. They also prove that the system as a whole is correctly integrated and that no regressions have occurred. Resolver Systems is developing a .NET desktop spreadsheet application, Resolver One, for which we have accumulated an acceptance testing framework. This framework uses Python’s standard unittest module, and is executed using IronPython. While Resolver One is written in IronPython, this technique allows IronPython tests to interact with product code written in any .NET language. This article describes the principles of this IronPython acceptance test...

A Good Mix 28: NTornado, WPF, Testing in Italian, More Benchmarking, and adodbapi

Yet another collection of IronPython and DLR related articles, projects and blog entries from the past few weeks. NTornado NTornado is an IronPython version of the Tornando web server. The Tornado Web Server is the open source version of the non-blocking web server that power FriendFeed and now part of the Facebook's open source initiative. This server is coded in Python and with strong emphasis on operating systems with epoll support. NTornado is a port of Tornado to IronPython using asynchronous high-performance sockets in .NET. To run the demos (requires IronPython 2.6): > ipy -X:Frames "demo file name".py Getting WPF Control Template in IronPython I always find myself needing a control template so I can customize one of the WPF controls. I used to fire up Expression Blend to get it, and then realized I could write a little IronPython code to do it. Paste this code into the IronPython 2.0 or 2.6 console to see it work! Modulo .NET test con IronPython  A tr...

A Good Mix 27: A Dynamic T-Shirt, Testoob, Mathematica and Blaze

Yet another collection of IronPython and DLR related articles, projects and blog entries from the past few weeks. You had me at dynamic  An IronPython T-Shirt created by Harry Pierson . The text is C# + IPy = <3. You had me at "dynamic" . Testoob 1.15 Released Testoob Project Homepage  The latest release of the Testoob project (yet-another-Python-testing-framework) announces IronPython support. I haven't used Testoob, but it is nice to see more projects supporting IronPython: Testoob is an advanced testing framework and test runner for Python. As a test runner, it can run your unittest test suites and make your test-running easy with tons of useful options. As a framework, you can use it to make your test-writing easy with even more useful options. Version 1.15 (Oct. 2009) adds better Python 2.6, IronPython, and Jython support, as well as test coverage improvements, better color support, and some new options and bugfixes. BoxHeadRoom: IronPython and Mathematic...

Working with .NET Code Remotely with execnet

Testing is a big topic in Python, with major libraries like py.test and nose pushing forward the state of the art. Even the standard library module unittest has had a lot of improvements that will appear in Python 2.7 and 3.2. Part of py.test is a library for distributed testing and deployment with remote Python interpreters. This library is called execnet : The execnet package allows you to: instantiate local/remote Python Interpreters send code for execution to one or many Interpreters send and receive data through channels execnet performs zero-install bootstrapping into other interpreters; package installation is only required at the initiating side. execnet enables interoperation between CPython 2.4-3.1, Jython 2.5.1, PyPy 1.1 and IronPython and works well on Windows, Linux and OSX systems. Support of Jython and IronPython are experimental at this point. Feedback and help with testing welcome. The IronPython support allows you to remotely work with .NET objects / libr...

IronWatin: mind the gap

WatiN is a .NET automated web testing tool inspired by the Ruby tool Watir . R. Tyler Ballance has been working on IronPython integration for WatiN, based on the Python unittest testing library (of which I am particularly a fan) and designed to be as 'pythonic' as possible. IronWatin: mind the gap   IronWatin Project Home on GitHub   Last week @admc , despite being a big proponent of Windmill , needed to use WatiN for a change. WatiN has the distinct capability of being able to work with Internet Explorer's HTTPS support as well as frames, a requirement for the task at hand. As adorable as it was to watch @admc, a child of the dynamic language revolution, struggle with writing in C# with Visual Studio and the daunting "Windows development stack," the prospect of a language shift at Slide towards C# on Windows is almost laughable. Since Slide is a Python shop, IronPython became the obvious choice. Out of an hour or so of "extreme programming" which...

Releasing IronPython

Dave Fugate, IronPython tester and the man in charge of releases, gives us an intriguing look into what is involved in releasing a new version of IronPython. Releasing software is always a pain, for any company or project, but even more so for Microsoft. A few interesting tidbits about IronPython CodePlex releases While it's still fresh on my mind, I'll share a bit of interesting info about IronPython releases. What will blow most peoples' minds is that on average it takes us about five full working days to produce and signoff on a release for CodePlex. For example, we started the release process for IronPython 2.6 Beta 2 on Friday morning and released it today. "Dave, when all you have to do is build the 'release' configuration of the sources already on CodePlex how can it possibly take this long?" you ask. Three words: testing and Microsoft bureaucracy…err I mean "Microsoft processes". What do you want to know about IronPython? Dave Fugate is a...

Acceptance Testing .NET Applications with IronPython

Image
The July 2009 issue of Python Magazine is out, and the headline feature is an article on testing .NET applications with IronPython by the honourable Mr. Hartley . Brandon Craig-Rhodes (editor in chief) describes the article in his blog post on the July issue: The July 2009 issue of Python Magazine First, IronPython, the .NET version of Python for Windows, is the topic of Jonathan Hartley's article about acceptance testing. He illustrates that, regardless of the language in which you write your .NET application, you can deploy simple strategies to make your application testable through a Python test harness, and thereby bring Python's strong flexibility as a testing language to bear on a product that you might be writing in another .NET language. The article goes over some of the techniques we use for acceptance testing at Resolver Systems , but applies them to applications written in C# rather than IronPython.

A Good Mix 16: Metaprogramming, Talks, PyDev, Excel and Testing

Another selection of articles, audio recordings and blog entries on IronPython collected from around the web. How I Learned to Love Metaprogramming Slides and code from a talk by Kevin Hazzard on metaprogramming on the .NET framework using C# 4.0 and IronPython. The title of my presentation was "How I Learned to Love Metaprogramming" and it concerns Dynamic Language Runtime architecture, performance of dynamic typing and Python to C# integration. The slides and source code are linked below. I will be giving this talk again in September at the Charlottesville .NET User Group meeting. Both of the demos require C# 4.0 which is available in Visual Studio 2010. Demo One - shows how to do XML parsing using a fluent interface based on a DynamicObject derivation in C# 4.0 Demo Two - shows how the Level 0, 1 and 2 CallSite and ActionBinder caches perform. UPDATED: I added a demo on 30 June 2009 that shows how the DLR 0.9 compares by invoking dynamic code through the DLR hosting APIs,...

Simple Python Testing in Silverlight with unittest

Jimmy Schementi is the program manager for the Silverlight dynamic languages integration. He has an unhealthy interest in IronRuby, and created a very impressive IronRuby tutorial that is part of the latest release. It's always nice when he does something with a Python focus, and a recent blog entry of his is particularly good - testing in Silverlight with IronPython and the unittest module . Simple Python Testing in Silverlight with unittest Since doing a post about Ruby testing of Silverlight applications , I’ve felt a bit guilty about leaving Python fans in the dark. However, like Ruby, it takes very little work to run Python unit test frameworks in Silverlight , since IronPython is a very compatible implementation of Python. Though my results aren’t as exhaustive as the IronRuby examples, here’s one simple example: http://github.com/jschementi/europycon2009

.NET Module Testing with IronPython

One of the areas where dynamic languages particularly shine is testing. There is a whole chapter of IronPython in Action on the subject (chapter 7 which is free to download and is a great introduction to unittest and testing topics for both Python and IronPython). The .NET world is starting to realise this, and a new MSDN article by Dr. James McCaffrey explores both 'ad-hoc' testing with the interactive interpreter and writing your own test harness in IronPython for automated testing of .NET classes and libraries. (Personally I think he would have found it much easier to use unittest , but as you can see from the article even writing a custom test harness can be done in very little code with Python.) .NET Module Testing with IronPython The Python scripting language has features that make it an excellent choice for performing several types of software testing. There are several implementations of Python available including CPython, the most common implementation on machines ru...

Getting started with IronPython - Part 3: unit testing

This is the third part of Dror Helper's series on getting started with IronPython. Part 1 was on first steps , including useful references. Part 2 focused on the Python programming language , introducing an example game project that Dror is using to learn IronPython. As promised part 3 is on testing the game with the Python unittest module. Getting started with IronPython - Part 3: unit testing Being a TDD’er (Test Driven Developer) one of the first things I’ve searched for when I started learning IronPython is a unit testing framework, luckily for me I didn’t need to search too long. IronPython has a good unit testing framework inherited from Python called PyUnit. Writing unit tests using PyUnit is simple: import unittest class Create a class that inherits unittest.TestCase (test fixture) Write test methods using assertions methods

Nose 0.11 - Python test framework with IronPython support

Python is blessed with many popular and powerful test frameworks. One of the most popular is nose , which has just released version 0.11. Back in March I reported the partial success that Darrell Hawley had running nose with IronPython . Well, there's more news. Release Notes for Nose 0.11 Nifty New Features (summary) Better support for IronPython. (Note that Nose has supported Jython for several versions now.) Thanks to Kevin Mitchell, nose is now more compatible with IronPython. IronPython is still not fully supported, but it should work. If you’d like to improve nose’s support for IronPython further, please join the nose developer’s list and volunteer to become the IronPython maintainer for nose! Of course the Python standard library testing framework unittest works with IronPython and has had some interesting improvements recently. More details on that soon on my other blog .

A Good Mix 2: Newspapers, Testing and Samples

Another short selection of recent IronPython related articles. Mind your language I was recently at the QCon conference in London , speaking on IronPython in the "Emerging Languages" track organised by Ola Bini . After the conference the guardian newspaper published an article on the diverse languages that are becoming mainstream. At first I was surprised that a British paper could publish a sensible article on programming languages, but then I noticed it was by Tim Anderson - a noted and long time tech blogger and writer. A couple of extracts: The recent trend is towards dynamically typed languages, which use inference to reduce the amount of code to be written. Java, C# and C++ are "static typed" languages, whereas JavaScript, Ruby, Python and PHP (used by Facebook) use "dynamic typing". In static languages, the programmer must declare each variable's class (such as string, integer, or list) before the program runs; in dynamic typing, it is assessed...

Jimmy Schementi on IronRuby, the Silverlight SDK and Scripting C# with IronPython

I'm late with the news, but there is a new release of IronRuby. There has also been a fresh release of the Silverlight dynamic languages to work with the beta version of Silverlight 3. Jimmy has an unhealthy preference for IronRuby over IronPython, but he's posted a few blog entries on both subjects. IronRuby 0.3 Released Staying true to our “Conference-driven development schedule,” this release is in conjunction with MIX ‘09, where Silverlight 3 Beta and ASP.NET MVC 1.0 were announced, to name a few. John Lam spoke at MIX today at 12:30pm in Las Vegas about using dynamic languages in Silverlight for testing, scripting, and application building. And some ASP.NET MVC with IronRuby is thrown in there too. IronRuby passes approximately 80% of RubySpec, the best test suite Ruby has today. IronRuby is best at language compatibility, passing 95% of those tests, but worse on the standard libraries with a pass-rate of 77%. Overall the pass-rate as gone up approximately 10% since the la...

Using Nose with IronPython

nose is a testing library for Python. nose is a popular alternative to unittest , which is part of the standard library, and boasts features like: Test autodiscovery Output capture Not restricted to class based tests Class and module level setUp and tearDown Assert introspection Test generators Plugin mechanism Personally I don't find the object oriented way of organising tests a problem; test methods grouped in classes seems very logical to me. I also like assert methods and the richer error messages they provide. I usually end up defining all sorts of convenience assert methods myself that do the heavy lifting of my testing anyway. I'm sceptical of the magic that libraries like nose and py.test do to provide some of the same information with bare asserts - and that magic doesn't work with IronPython anyway. The test discovery stuff is invaluable though. Whenever I create a new project I inevitably end up recreating some variation that does test discovery for the project...

Another Awesome Collection - IronPython Links

Another tab closing session - a lot of links to IronPython (etc) content here. There are a couple of interesting reports of Python libraries working with IronPython, but we start with an IronRuby article: .NET Interop: Getting Started with IronRuby and RSpec, Part 1 An excellent article by Ben Hall on testing .NET code (C#) with IronRuby and RSpec. In this article, I will introduce you to Ruby and IronRuby and demonstrate some basics of Ruby interoperating with Microsoft .NET Framework-based code. I also explain how frameworks such as RSpec can be used to generate examples of how objects are intended to behave, providing both documentation and verification that the system is built correctly. This will set the stage for a future article in which I will explain acceptance testing in detail and demonstrate creating acceptance tests with IronRuby. IronPythonの特徴 A Japanese article on IronPython. No idea what it says! Dynamic Language Runtime on Azure A demo of an Azure (Microsoft cloud pl...

IronPython at PyCon 2009

The talk schedule has gone up for for PyCon 2009 in Chicago. There are three talks on IronPython, plus a tutorial on the Wednesday before the conference. PyCon is the international Python conference, and the highlight of the Python year. The conference dates are: March 25-26th Tutorial Days March 27-29th Conference March 30th - April 2nd Development Sprints Jim Hugunin is one of the invited speakers, so his talk doesn't yet appear on the schedule - but his usual talk is " IronPython the Road Ahead ". The other two IronPython talks are: IronPython Implementation, by Dino Veihland (core IronPython developer) IronPython is an implementation of Python running on .NET. This talk will provide an overview of the IronPython internals. The talk will start with a high-level walk through of the IronPython architecture and source layout. From there we’ll drill into details such as method dispatch, how the .NET and Python type systems interrelate, multi-runtime support, and how I...

Dynamic Language Testing in Silverlight

Jimmy Schementi maintains the Silverlight and DLR (agDLR) integration, which is now hosted on github and open to community contributions. Unfortunately being a browser plugin, Silverlight is hard to test - or at least was: Dynamic Language Testing in Silverlight getting the infrastructure to run tests has taken some time, but I just committed a Silverlight spec runner for bacon (a little Ruby spec framework) and a bunch of specs for Microsoft.Scripting.Silverlight ! So, the tests are written in Ruby, but they test the C# code in Microsoft.Scripting.Silverlight ... pretty cool. This is a deviation from my common belief of "test in the language you write the code in", but so what ... I never cared for that way of thinking =) This test system is reusable by Silverlight apps. Jimmy has a video of it in action on his blog entry and explains the problems with the old system. To get tests out to the world, the only sane thing would be to head back to the drawing board, which is...