AutomatedVisualTesting 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package AutomatedVisualTesting --version 1.0.0
NuGet\Install-Package AutomatedVisualTesting -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AutomatedVisualTesting" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AutomatedVisualTesting --version 1.0.0
#r "nuget: AutomatedVisualTesting, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install AutomatedVisualTesting as a Cake Addin
#addin nuget:?package=AutomatedVisualTesting&version=1.0.0

// Install AutomatedVisualTesting as a Cake Tool
#tool nuget:?package=AutomatedVisualTesting&version=1.0.0

Automated Visual Testing

Lots of tests rely on Selenium WebDriver and similar tools to automate end to end testing. Whilst this ensures elements are displayed 'somewhere' on a page, they do not guarantee that elements are exactly where they should be and looking as expected!

Using this 'Visual' approach tests can execute a lot quicker and ensure elements are rendered how we expect them to be rathan than the typical approach of trying to find each element to ensure things have loaded on to a page.

It is also necessary sometimes to check contents of files, which can be quite time consuming to open up pdf files to check that the contents are as expected. Using this framework it is also possible to save all pdf pages as images and compare those to previously saved pdf images to check for changes.

How it works

Base images for websites

Once you are happy with how a particular area or how the whole of your web page looks you write tests using this framework. The first time you run your tests the base images will not exist,this framework will automatically take the base images for you and alert you to tell you that this has been done.

Compare a base image of a web page to an image of a web page taken by visiting a url:

[TestMethod]
public void Full_Page_Comparison_Test()
{
         // Create a new chrome webdriver
	 var driver = new ChromeDriver();
         
         // Navigate to the page we want to compare
         driver.Navigate().GoToUrl("https://computer-database.herokuapp.com/computers");
         
         // Specify where the base image is to compare
         var baseImage = "ComputerDatabaseHomePage.Chrome.png";

         // Get differences between base image and actual image taken with the chrome webdriver
         var result = Differences(baseImage, driver);
         
         // Assert expected result is match (no differences)
         Assert.IsTrue(result.Match);

         // Close down the driver
         driver.Quit();
}

Debugging when tests fail

When your tests fail because results were not as expected, the framework will take screenshots of what it actually compared as well as an image displaying where the differences were found.

Product Compatible and additional computed target framework versions.
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 16,271 7/16/2018
1.1.1 990 7/16/2018
1.1.0 947 7/16/2018
1.0.0 1,005 7/12/2018

Initial release.