Skip to content
techphoria414 edited this page Apr 6, 2017 · 12 revisions

Sitecore FakeDb is available on NuGet. To install the framework:

  1. Create a new Class Library project.
  2. Run the following command in the NuGet Package Manager Console:
PM> Install-Package Sitecore.FakeDb
  1. Add references to the following assemblies:
Lucene.Net.dll
Sitecore.Analytics.dll
Sitecore.Kernel.dll
Sitecore.Logging.dll
Sitecore.Nexus.dll
  1. Configure license.

Applying the license file

There are several ways to configure the license:

  • Copy the license.xml file to the root of your tests project
    That is the default license file location, so no any additional changes in the App.config required.

  • Modify the 'LicensePath' setting in the App.config file
    It allows to control the license file location, but requires merging the App.config when updating the FakeDb NuGet package.

  • Add the license.xml as an existing file to the root of your tests project
    It allows to avoid modifying the LicenseFile setting in the App.config file and allows to run tests in NCrunch without configuring the Additional files to include setting.

Note: If using NUnit 3.x, when copying the license file to your test project root, you will need to update the LicenseFile setting to /license.xml in the App.config.

Configuring the Database type for Sitecore 8.2 and later

Starting from Sitecore 8.2, the Database type is changed from Sitecore.Data.Database to Sitecore.Data.DefaultDatabase (see the Configuration file changes section for details). In the test project App.config file, ensure the proper type is selected:

<!-- DATABASE TYPE
     For Sitecore versions prior to 8.2 should be 'Sitecore.Data.Database, Sitecore.Kernel'.
     For Sitecore 8.2 and later should be 'Sitecore.Data.DefaultDatabase, Sitecore.Kernel'. -->
<sc.variable name="databaseType" value="Sitecore.Data.DefaultDatabase, Sitecore.Kernel" />

Configuring NCrunch

https://github.com/sergeyshushlyapin/Sitecore.FakeDb/wiki/Configuration#configuring-ncrunch

Updating

To upgrade the framework run the following command in the NuGet Package Manager Console:

PM> Update-Package Sitecore.FakeDb

Important:

You should always overwrite the App.config file if requested. Otherwise important configuration changes might be lost.

Clone this wiki locally