One time instance of Blazor application for test automation with Playwirght

The article discusses the process of automating functional tests of Blazor applications using the Microsoft.AspNetCore.Mvc.Testing library and the Playwright tool. The author presents the implementation steps, from configuring the class that runs the application to writing tests to check the correct operation of the home page and the FAQ section. Thanks to this solution, a one-time test instance was obtained, significantly facilitating the testing process

Continue reading...

DI for testing purposes in .NET - WebApplicationFactory

The material presents a DI-based approach to integration testing in .NET applications, utilizing the WebApplicationFactory for in-memory testing. It showcases how to implement and switch between different feature implementations using DI, enhancing test stability and dependency isolation.

Continue reading...

Retry policy for methods in terms of integration tests

Using the Polly library for implementing a retry policy in integration tests within .NET projects to address race conditions and enhance test stability. The author provides an example of applying the retry logic to database interaction methods and highlights the importance of careful time frame definition for optimal test execution.

Continue reading...

Selected for you

  1. Challenges of managing heavy dependencies like databases for integration tests and introduces TestContainers, a tool used to manage containers for testing purposes. The author demonstrates how to set up and use TestContainers with an MSSQL database in a .NET project, highlighting its simplicity and potential for improving test efficiency.

  2. Value of sending automated test results to Slack after the CI build process, outlining a technical solution using PowerShell, Webhooks, and the Slack API. This approach enhances the quality of automated tests and encourages team analysis of test results in various CI environments.

  3. Explains how to set up Cypress test reporting in Azure DevOps pipelines. It outlines the steps to configure test reporting using the JUnit format, ensuring that test failures do not interrupt the pipeline, and provides an overview of the resulting test report features in Azure DevOps, emphasizing the ease of integration and the potential for additional functionalities in future posts.

  4. Discusses the integration of Cypress testing into Azure DevOps for continuous integration. It provides a step-by-step guide on configuring the CI pipeline in Azure DevOps, making necessary script adjustments, handling environment variables, and highlights the importance of testing in the CI process. Additionally, it emphasizes the ease of integration and the significance of applying testing to CI for testers. You can find the code on GitHub for reference.

  5. Concept of visual regression testing, where you compare the expected interface appearance with the actual state during testing to detect defects not caught by traditional regression tests. It explains how to set up visual regression testing using the Cypress framework with the free cypress-image-snapshot plugin, and provides examples of testing the entire screen and specific elements for visual differences, showcasing its effectiveness in detecting even small changes.

  6. Microsoft recently announced Playwright, a platform designed for automating browser operations, offering multi-browser support for Chromium, WebKit, Firefox, and Edge. While not a standalone test automation tool, it can be integrated with libraries like Mocha and Chai to perform tasks such as launching browsers, taking screenshots, finding elements, clicking, and handling input, making it a user-friendly choice for test automation enthusiasts. The platform's extensive documentation and accessible features bode well for its potential in test automation.

  7. Cypress has introduced support for new browsers, Firefox and Microsoft Edge, in its latest update. Despite some initial installation issues, the author successfully updated Cypress and conducted tests on these browsers, noting that the new features are valuable for testing purposes.

  8. The author discusses the implementation of artificial intelligence in Selenium WebDriver test automation, specifically utilizing the test-ai-classifier plugin. They encounter challenges during installation, ultimately achieving success. While the AI-based element recognition shows promise, it currently has limited functionality, and the project's development holds potential for the future of testing.

  9. In this blog post, the author reflects on the ideal test process they aim to achieve in their projects, emphasizing the importance of quick feedback on code changes and the drawbacks of manual testing. They advocate for a balanced approach, combining both automated tests (unit and acceptance tests) with manual tests, and stress the benefits of a Continuous Delivery process for rapid code validation and defect correction.

  10. The author emphasizes the importance of using stable and high-quality selectors in automated tests and advocates for the use of the "data-cy" attribute for this purpose in Cypress. They demonstrate how to add and utilize these attributes in a React project, simplifying selector complexity and enhancing test resilience, providing links to corresponding code changes on GitHub.

  11. In this blog post, the author discusses the importance of proper URL management in automated tests and addresses this issue by using Cypress hooks to centralize URL navigation and configuration settings. They also make improvements to the URL assertion function to ensure accurate testing.

  12. The author discusses the process of refactoring code tests and compares two approaches. App Actions and Page Object Model. They start by implementing App Actions, creating custom commands and functions to make tests cleaner and more organized. Then, they transition to Page Object Model, creating classes to represent pages and managing test actions through these classes. They conclude that both approaches have their benefits and drawbacks, with the choice depending on the project's needs and preferences.

  13. This blog post discusses the implementation of login tests with Cypress on the author's website. It covers four test cases, successful login, incorrect password, not existing user, and empty fields. The author demonstrates how to prepare test data and use the Cypress framework to perform these tests while also addressing issues with the application under test.

  14. The author has shared their technique for creating end-to-end tests using the Cypress tool for applications built on ASP.NET Core and React. They provide step-by-step instructions for setting up Cypress, creating basic tests to visit a website, search for elements, click on them, make assertions, and interact with input fields, highlighting the power of Cypress for testing web applications.

  15. In this introduction to Cypress, the author shares their technique for creating end-to-end tests for a web application built on ASP.NET Core and React. They explain the setup process, including installing Cypress and writing basic tests to visit web pages, search for elements, click on them, and perform assertions. They also provide a link to their repository for further reference and mention their intention to write more tests in future posts.