Discussed in detail in document named 'Functional Tests and Automation Criteria' within this repository
- Automated UI Tests for some features of Xeneta's Website using .Net Core, Selenium, Specflow and Nunit
- Runs with current chrome version: 89.0.4389.114
- Selenium.WebDriver.ChromeDriver package can be updated for future chrome verisons via Nuget Manager in Visual Studio 2019
- Target framework version for the project is .Net Core 3.1
- The tests are defined using Gherkin Syntax in Feature files (extenseion: .features) located in Features folder
- Feature files contain Scnarios which are basically the tests
- The Scenarios have steps in Gherkin Syntax (Give, When, Then etc)
- The scenario steps map to corresponding Step Definition files located in Steps folder
- Pressing F12 on a scenario step will open its step definition method
- The step definition methods call functions in repective Page Object classes
- Page Object classes in the Pages folder use selenium to locate elements, perform actions and return properties
- Browser initialization and disposal is done in WebDriverHooks.cs in Hooks folder
- If you already have Visual Studio 2019 skip to step 3
- If you don't have Visual Studio 2019:
- For Windows: You can download and use the 2019 Community Edition for free
- During installation select '.NET Core cross-platform development' in 'Workloads' tab
- For Mac: You can download and use Visual Studio 2019 Mac for free
- During installation select '.Net Core' in 'What would you like to install' screen
- For Windows: You can download and use the 2019 Community Edition for free
- Open Visual Studio and Install SpecFlow extension:
- For Windows: Go to Extensions -> Manage Extensions and search 'SpecFlow' in Online Extensions and install
- For Mac: Go to Visual Studio -> Extensions -> Gallery and search 'Straight8's SpecFlow Integration' and install
- Restart Visual Studio and open 'XenetaWebApp.Tests.sln' file
- Build the solution:
- For Windows: Ctrl + Shift + B
- For Mac: Cmd + B
- Use Solution Explorer to view the project files
- The tests are structured as:
- Feature Files contain Scenarios(tests) -> Scenarios contain Steps -> Steps map to Step Definition methods -> Step Definition methods use Page Object classes
- Use Test Explorer to view, run and debug the tests
- You can start a test run as:
- Run all tests of all Features
- Run all tests of a particular Feature
- Run a particular test of a particular Feature
- For any failed test select it in Test Explorer and click Output to see the failed assertion
- After test run, double click GenerateReport.bat located in repository's root folder (Xeneta-Web-App-UI-Tests) to generate TestRunReport.html report file
- TestRunReport.html is generated in repository's root folder (Xeneta-Web-App-UI-Tests). Open the file to view Test Run statistics
- Download and Install latest '.Net Core 3.1 SDK' from: https://dotnet.microsoft.com/download/dotnet/3.1
- Open visual Studio Code and install following extensions from Extensions tab on left menu:
- C#
- vscode-solution-explorer
- Specflow Tools
- .Net Core Test Explorer (by Derivitec Ltd)
- Click File then click Open and select Solution folder named 'XenetaWebApp.Tests'
- Visual Studio Code will automatically resolve some dependencies like:
- OmniSharp for Windows
- .Net Core Debugger
- Razor Language Server
- Visual Studio Code may show a message to restore C# dependency. Click restore
- Build the solution:
- For Windows: Ctrl + Shift + B
- For Mac: Cmd + B
- Use Solution Explorer tab on left menu to view the project files
- The tests are structured as:
- Feature Files contain Scenarios(tests) -> Scenarios contain Steps -> Steps map to Step Definition methods -> Step Definition methods use Page Object classes
- Open Test Explorer tab on left menu and reload tests. Do this after evey build
- Use Test Explorer to view all features and their tests
- You can start a test run by:
- Running all tests of all Features
- Running all tests of a particular Feature
- Running a particular test of a particular Feature
- OUTPUT tab at the bottom will display the failed assertions if any tests fail
- After test run, double click GenerateReport.bat located in repository's root folder (Xeneta-Web-App-UI-Tests) to generate TestRunReport.html report file
- TestRunReport.html is generated in repository's root folder (Xeneta-Web-App-UI-Tests). Open the file to view Test Run statistics