How xuannguyen2k4/selenium-test-csharp works
Main Components
• Test Runner and Controller – Represented by Program.cs, which is the entry point that initializes and orchestrates the execution of the tests.
• Test Cases – Individual test classes (LoginTest.cs, NavigationTest.cs, SearchTest.cs) that implement specific testing scenarios (login, search, navigation) including error handling with try-catch.
• Test Web Pages – The SeleniumFrontend folder containing HTML files (login.html, navigation.html, search.html) which serve as the web content that the tests interact with.
• Selenium Automation Layer – The Selenium WebDriver along with ChromeDriver (as shown in the packages section and the presence of chromedriver.exe) that actually drives browser activities.
• Configuration & Dependencies – Files like App.config, packages.config, and dependency folders (e.g., Microsoft.Bcl.AsyncInterfaces, Selenium.WebDriver, Selenium.Support) that support configuration and runtime dependency management.
Relationships and Interactions
• The Test Runner (Program.cs) starts the application and sequentially invokes the Test Cases.
• Each Test Case utilizes the Selenium API (via Selenium.WebDriver and Selenium.Support) to launch and control a browser session with ChromeDriver.
• The tests operate on the web pages (the HTML files under SeleniumFrontend) by simulating user interactions (input username, password, search queries, clicking links).
• Configuration settings (from App.config) inform aspects of the test execution such as browser settings and timeouts.
• External dependencies (managed via NuGet packages) are used by the test components to interact with the browser and assist with asynchronous operations, JSON processing, etc.
Architectural Patterns and Design Principles
• Modular Test Design – Separation of tests into individual classes for login, search, and navigation encourages maintainability.
• Layered Architecture – Clear separation between test logic (test case files) and the underlying automation driver (Selenium WebDriver/ChromeDriver).
• Dependency Management – Use of NuGet packages to manage third-party libraries keeps the project decoupled from the implementation details.
• Error Handling – Incorporating try-catch blocks in the tests for robust error handling.