Velodoc is developed in ASP.NET C# 2.0 with Visual Studio .NET 2005.
VSTS comes with unit testing, web testing and load testing, considering load testing is actually an execution environment for unit tests and web tests.
Unfortunately Visual Studio web tests work at the protocol level, recording HTTP traffic in order to replay it. The same applies to Redgate’s ANTSLoad and many other load testing tools. Velodoc is an Ajax application and this does not work.
We have started our search for a solution from the following lists of testing tools:
Obviously there are tools like Mercury Winrunner/Loadrunner and the IBM Rational equivalents which certainly cope but they are too expensive.
Our requirements are the following:
- Test ASP.NET applications
- Works on Windows XP with IE
- Compatible with NetAdvantage controls, iFrames, file uploads and Ajax
- Scripts IE including IE dialogs to drive functional UI tests
- Several instances can be executed concurrently to create load/stress tests
- Uses a familiar technology (low learning curve)
- Open source is a plus and a requirement if the supplier has not been around for a long time.
There are three types of solutions which cope more or less with these requirements:
- Macro recorders/players
- Test environments
- Web application scripting frameworks
Macro recorders/players and test environments
Searching on Tucows, Download.com and other shareware web sites reveals loads of macro recorders. Most of them hook the message pump and replay the windows messages. Obviously, the result is not good. We have tried a dozen of them but only iOpus iMacros 5.2 could do a decent job at automating a file upload from https://www.velodoc.net/. The code is reproduced below:
SIZE X=876 Y=627
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:aspnetForm ATTR=ID: SenderTextBox CONTENTfirstname.lastname@example.org
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:aspnetForm ATTR=ID: RecipientTextBox CONTENTemail@example.com
TAG POS=1 TYPE=TEXTAREA FORM=NAME:aspnetForm ATTR=ID: MessageTextBox CONTENT= Test<SP>with<SP>iMacro
WINCLICK X=100 Y=429 CONTENT=
WINCLICK X=100 Y=429 CONTENT=C:\test.bin
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:aspnetForm ATTR=ID: SendTermsCheckBox&&VALUE:on CONTENT=YES
WINCLICK X=490 Y=513 CONTENT=
I see at least three drawbacks to using iOpus iMacros as a functional test tool:
- The lack of assertions and reporting capabilities makes it insufficient for functional testing;
- The lack of infrastructure makes it insufficient for load testing;
- The proprietary language reduces the possibilities despite the fact that it can call external scripts or be called via a COM component.
I have also tried several test environments mentioned in the above lists. Generally, recording the file upload test on https://www.velodoc.net/ has always proved difficult but I cannot tell whether it was feasible or not for some of them. I have limited myself to 2 hours per evaluation and the inherent complexity and learning curve was not worth digging passed first impression.
Web application scripting frameworks
I have looked at two open-source frameworks, which both script IE to execute functional tests on the web application:
Both frameworks are very easy to start with due to a familiar language and an intuitive API. Additionally both frameworks provide the necessary assertions to report on the success or failure of a test fixture.
_.setTextArea("MessageTextBox", "Test with IEUnit");
var fname = "C:\\test.bin";
var cmdShell = new ActiveXObject("WScript.Shell");
cmdShell.Run("C:\\EnterFileName.sbk " + fname, 0, false);
Where EnterFileName.sbk contains:
var fpath = " " + WScript.Arguments(1);
var popupWin = _.waitForWindow("Choose file", 30000);
Scripting a file upload on the Velodoc home page with WatiN entails the following C# code:
using (IE ie = new IE(https://www.velodoc.net/))
ie.TextField(Find.ById("MessageTextBox")).TypeText("Test with WatiN");
Frame f = ie.Frame(Find.ById("FileUploadFrame"));
FileUpload fUp = f.FileUpload(Find.ById("FileInput"));
ie.CheckBox(Find.ById("SendTermsCheckBox")).Checked = true;
SimpleTimer t = new SimpleTimer(60 * 60);
s = ie.Span(Find.ById("DownloadLinkLabel"));
} while (!t.Elapsed);
throw new WatiN.Core.Exceptions.TimeoutException("...", 60 * 60));
The beauty of WatiN is that it builds on top of C# and .NET framework. Accordingly you get not only a rich language but also a rich environment. Test code built with WatiN can be executed within NUnit and Visual Studio unit testing projects which means that they can also be executed for load tests which I am going to try next although we know already that launching several instances of IE has its own limitation.