This project automates web UI testing for the Demoblaze Product Store website using the following technologies:
- C# (.NET 8)
- Selenium WebDriver
- NUnit test framework
- WebDriverManager for automatic browser driver setup
- Page Object Model (POM) design pattern
- Configurable browser options via
appsettings.json
The goal is to provide a clean, maintainable, and beginner-friendly automation framework.
Before running the tests, make sure you have the following installed on your computer:
- Windows 10/11 or macOS
- Visual Studio 2022 (Community, Professional, or Enterprise)
- .NET 8 SDK Download from: https://dotnet.microsoft.com/download
- Google Chrome (latest version)
- Internet connection to restore NuGet packages automatically
💡 No need to manually download ChromeDriver — it’s managed automatically by WebDriverManager.
Follow these steps carefully — even if you have never used Visual Studio before.
-
Unzip the project
- Right-click on the ZIP file and select Extract All…
- Save the extracted folder somewhere easy to find, e.g.
C:\Projects\DemoblazeProductStore
-
Open the project in Visual Studio
- Start Visual Studio 2022.
- Click Open a project or solution.
- Browse to the extracted folder and open the file
DemoblazeProductStore.csproj.
-
Restore dependencies
-
When the project loads, Visual Studio automatically restores NuGet packages.
-
Wait until the process finishes (check the progress bar at the bottom).
-
If it doesn’t happen automatically:
-
Go to Tools → NuGet Package Manager → Package Manager Console
-
Run this command:
dotnet restore
-
-
-
Build the solution
- In the top menu, click Build → Build Solution or press
Ctrl + Shift + B. - Wait for the build to complete successfully (you should see “Build succeeded”).
- In the top menu, click Build → Build Solution or press
-
Run the tests
- Open the Test Explorer from Test → Test Explorer.
- You’ll see a list of available tests (for example,
ValidLoginTest,InvalidLoginTest, etc.). - Right-click a test or select Run All Tests.
- Chrome will open automatically, run the test, and close when finished.
You can modify how the browser behaves by editing the Config/appsettings.json file:
{
"browser": "chrome",
"headless": false
}"browser"— choosechromeor another browser if implemented."headless": true— runs tests without showing the browser window.
| Folder | Description |
|---|---|
| Drivers/ | Contains DriverFactory for initializing and closing the browser. |
| Pages/ | Contains all Page Object classes representing pages of the website. |
| Tests/ | Contains NUnit test classes that perform actions and verifications. |
| Config/ | Contains configuration files like appsettings.json. |
| Utils/ | Contains helper classes (if any). |
- The test starts and calls the
DriverFactoryto initialize Chrome using WebDriverManager. - The browser opens https://www.demoblaze.com.
- Page Object classes interact with elements (login, add products, etc.).
- NUnit validates the expected results (assertions).
- The browser closes after each test (handled automatically by hooks or teardown methods).
| Problem | Possible Cause / Solution |
|---|---|
| Chrome does not open | Make sure Google Chrome is installed and up to date. |
| Build fails | Ensure .NET 8 SDK is installed correctly. |
| Tests not visible in Test Explorer | Go to Test → Test Explorer → Run All Tests or rebuild the solution. |
| Browser stays open after tests | Verify that Driver.Quit() is called in your teardown method. |
- Create a new class under the
Testsfolder (e.g.,SignupTests.cs). - Decorate the class with
[TestFixture]. - Add test methods marked with
[Test]. - Use Page Object classes to perform actions and assertions.
- Build and run the new test — it will automatically appear in Test Explorer.
Example:
[Test]
public void ExampleTest()
{
var driver = DriverFactory.Driver;
driver.Navigate().GoToUrl("https://www.demoblaze.com");
Assert.IsTrue(driver.Title.Contains("STORE"));
}After following this guide, you will:
- Open and run automated UI tests with Selenium and NUnit.
- Understand how Page Object Model organizes code.
- Adjust settings in
appsettings.jsonto change browsers or run headless.
The framework is simple, scalable, and ready for further extensions (e.g., reporting, logging, or CI/CD integration).
Enjoy testing!