In order to get your Ivonna tests running, you have to do the following:
Setting up your environment
-
Ensure that you have installed TypeMock Isolator.
-
Add a test library project to your solution.
-
Make sure that your test project references TypeMock and Ivonna.
-
Optionally, you can publish your site. This will make the compiled web classes available to your test project. In the Publish dialog, you should check "use fixed naming and single page assemblies" checkbox.
-
Set the output path of your test project to the site's bin folder. If you published your site at the previous step, you should use the published site's bin folder. For more options, see Project setup scenarios.
-
If you use MS testing tools with VS 2008, you should disable deployment in your .testrunconfig file.
Note that VSTS 2005 doesn't have this option. The tests are always deployed in a special folder. Therefore, you should use the overload of the RunOnWebAttribute and provide the physical path (absolute or relative) to your Web.
Writing a test
-
Decorate your fixture class with the RunOnWebAttribute. You should also decorate it with whatever attribute your test runner requires, such as TestFixtureAttribute.
-
Add a method to your class, and decorate it with an appropriate attribute, such as TestAttribute.
-
Start your method with obtaining a reference to a new TestSession instance.
Example
| Visual Basic | |
|---|---|
Imports Ivonna.Framework Imports MbUnit.Framework <TestFixture(), RunOnWeb()> _ Public Class WebTester <Test()> Sub Test() Dim session As New TestSession() 'do some testing End Sub End Class | |
| C# | |
|---|---|
using MbUnit.Framework;
using Ivonna.Framework;
[TestFixture, RunOnWeb()]
public class WebTester {
[Test] public void Test() {
TestSession session = new TestSession();
//do some testing
}
}
| |