Quick start guide
From an empty Visual Studio to a passing browser test, in five steps.
Install Visual Studio and Chrome
Download Visual Studio 2026 from visualstudio.microsoft.com. The Community edition is free; Professional and Enterprise work the same way. In the installer, select the .NET desktop development workload.
Have Google Chrome installed. You do not need to download ChromeDriver: Selenium finds or downloads the matching driver itself the first time a test runs.
Create an NUnit test project
- Choose File → New → Project.
- Search for NUnit Test Project and click Next.
- Enter the project name (the samples use
FirstVafTest) and location, then Next. - Keep .NET 10 as the framework and click Create.
.NET 8 and 9 are not supported — the build stops with error VAF0001. If your
Visual Studio offers only those, install the .NET 10 SDK, or use .NET Framework: set
<TargetFramework>net472</TargetFramework> in the project file.
Add VAF
Right-click the project in Solution Explorer, choose Manage NuGet Packages, search for VisionAutomationFramework on the Browse tab and click Install. From the command line, the same is:
dotnet add package VisionAutomationFramework
The essential part of the project file then looks like this:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.0" />
<PackageReference Include="NUnit" Version="4.3.2" />
<PackageReference Include="NUnit3TestAdapter" Version="5.0.0" />
<PackageReference Include="VisionAutomationFramework" Version="3.3.0" />
</ItemGroup>
</Project>
VAF brings Selenium with it. Selenium can be updated on its own to any newer 4.x — add
Selenium.WebDriver and Selenium.Support with the same version; VAF does not need a
new release for that.
Write the first test
Replace the content of UnitTest1.cs with these usings:
using NUnit.Framework;
using VisionAutomationFramework;
using VisionAutomationFramework.Browsers;
using VisionAutomationFramework.Extensions;
followed by the test:
namespace FirstVafTest
{
public class Tests
{
[Test]
public void OpensThePracticeForm()
{
var browser = Testing.On<Chrome>();
try
{
browser.LetsNavigateTo("https://www.visionautomationframework.com/practice/forms")
.Should().HaveTitle("Practice: forms — Vision Automation Framework");
}
finally
{
browser.Scope.Driver.Quit();
}
}
}
}
The test opens the sign-up form among this site's
practice pages and compares the whole title of the tab, exactly.
Should() and the other fluent methods live in
VisionAutomationFramework.Extensions — without that using, the test does not compile.
The browser stays open after a test unless it is closed, which is what the finally
block does.
Run it
Open Test → Test Explorer and click Run All. Chrome opens the form, VAF checks the title, the browser closes and the test turns green. The first run takes longer while Selenium fetches the driver.
To see a failure, change the expected title: the test fails and its message shows the expected and the actual title.
Using MSTest or xUnit instead of NUnit? VAF works with both. Create an
MSTest Test Project or xUnit Test Project instead; the test is the same, only the
attributes differ ([TestClass] and [TestMethod], or [Fact]).
Without Visual Studio
In VS Code, Rider or a build pipeline, the same steps are four commands with the
.NET 10 SDK. Before
dotnet test, put the usings and the test from step 4 into UnitTest1.cs:
dotnet new nunit -n FirstVafTest
cd FirstVafTest
dotnet add package VisionAutomationFramework
dotnet test
Still on VAF 2.1?
VAF 2.1 runs only on .NET Framework 4.7.2 with NUnit 3: on .NET the test
cannot start, and with NUnit 4 every VAF assertion fails with a MissingMethodException. Create the
NUnit project as in step 2, then replace the content of its .csproj file with:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<LangVersion>latest</LangVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="VisionAutomationFramework" Version="2.1.0" />
</ItemGroup>
</Project>
When Manage NuGet Packages offers updates, keep NUnit on 3.x. The test is the same as in step 4. With MSTest, keep the NUnit 3 package — VAF 2.1 asserts with NUnit internally — and add this to the test class to keep one test's failure out of the next:
[TestInitialize]
public void Initialize()
{
// VAF asserts with NUnit internally. Under MSTest this clears NUnit's result
// state, so a failure in one test does not carry over into the next one.
new NUnit.Framework.Internal.TestExecutionContext.IsolatedContext();
}
Moving to 3.0 is mostly a package update: see Migrating to VAF 3.0.
Next steps
This was lesson 1 of the tutorials. Next: lesson 2 — Map your first page, in the same project.
- Practice pages — 12 pages of forms, tables, waiting, windows, date pickers and more, built to be tested.
- Guide — page objects, shared steps and tests: how a real VAF suite is built, on the same form.
- VAF-Demo on GitHub — tests of every practice page, from plain VAF calls to shared steps and scenarios, to clone and run.