ItiN – Infopath testing in .Net

The project that I am currently working on uses infopath forms. This was causing us a few hassles on the testing front, especially now we are using WatiN extensively. So after a few failed attempts at using the new .Net 3.0 automaton API’s and not really wanting to learn MSAA, I decided to create a specalised port of WatiN to test infopath and ItiN was born.

ItiN uses a hybrid approach allowing manipulation of an InfoPath document directly using XPath and the XML dom, or the view using traditional WatiN automation.

The full set of HTML controls supported by WatiN is not required for ItiN, so only: buttons, check boxes, radio buttons, textboxes and select lists are supported.

The ItiN framework I is open source on Codeplex here http://www.codeplex.com/itin.

A sample script using the framework that works against the 2003 sample IssueTrackerSimple form saved in c:\ is as follows.

using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using ItiN; namespace Itin.Tests { [TestMethod()] public void IssueTrackingSample() { // Open test form string infopathFileName = @"c:\IssueTrackingSample.xml"; InfopathTester FormTester = new InfopathTester(infopathFileName); FormTester.SetInfopathNamespace("xmlns:iss='http://schemas.microsoft.com/office/infopath/2003/sample/IssueTracking'"); FormTester.SetFormValue(@"//iss:title", "Issue Title");

// Click the send email button which does nothing as I don’t have email configured for infopath FormTester.Button(ItiN.Find.ByValue("Send as E-mail")).ClickNoWait(); FormTester.SaveDocumentAs(@"c:\SavedForm.xml"); FormTester.CloseAndQuit();

// TODO: Implement code to verify target Assert.Inconclusive("TODO: Implement code to verify target"); } } }

One thought on “ItiN – Infopath testing in .Net

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>