AC3428

Blazor Testing Training

This Blazor Testing course equips developers with the skills and knowledge to effectively test Blazor applications, ensuring their robustness and reliability. Participants gain proficiency in unit, integration, and end-to-end (E2E) testing methodologies, specifically tailored for the Blazor framework.

Course Details

Duration

2 days

Prerequisites

Experience in HTML, CSS, JavaScript, C# programming, and Blazor

Skills Gained

  • Master the fundamental principles and practices of testing Blazor applications
  • Distinguish between unit, integration, and E2E testing approaches and their applications
  • Effectively organize and execute C# and JavaScript tests for Blazor applications
  • Identify and test critical components of Blazor applications, including Razor Components
  • Leverage mocks, stubs, and fakes to enable isolated testing and enhance test coverage
  • Program and execute unit and integration tests for Razor Components using XUnit and bUnit
  • Develop E2E tests for Blazor web pages using Selenium WebDriver and C#
Course Outline
  • Introduction
  • Kinds of Testing
    • Unit Tests
    • Integration Tests
    • E2E Testing
    • Automated vs. Manual Testing
    • Testing & DevOps
  • Testing Parts
    • Tests
    • Test Suites
    • Assertions
    • Setup/Teardown
    • Mocks, Fakes, Stubs
    • Arrange, Act, Assert
    • Test Frameworks
    • Test Runners
    • Code Coverage
  • Overview of .NET Core and Testing
    • XUnit
    • Test Runners: Command-Line, Visual Studio, Visual Studio Code, JetBrains Rider
    • Testing with XUnit and the Selected IDE (see above)
    • Mocking with Moq
    • Fluent Assertions
    • BUnit
  • Test C# and Razor code with xUnit
    • What is xUnit?
    • Testing Framework
    • Test Parallelism
    • Shared Test Context
    • Facts vs. Theory
    • Assertions
    • Integration with Visual Studio
    • Debugging Unit Tests in Visual Studio
    • Debugging Unit Tests in Visual Studio Code
  • Razor Component Unit and Integration Testing
    • What Should be tested on a Razor Component?
    • What is bUnit?
    • Using bUnit with xUnit
    • Setup and define components under tests in C# or Razor syntax
    • Verify outcome using semantic HTML comparer
    • Interact with and inspect components
    • Trigger event handlers
    • Provide cascading values
    • Inject services
    • Mock IJsRuntime
    • Perform snapshot testing
  • JavaScript Testing
    • Is JavaScript Unit Testing a Thing?
    • Benefits of Unit Testing JavaScript
    • Challenges of Unit Testing JavaScript
    • Testing JavaScript with Jest
    • Test Suites
    • Tests
    • Assertions
    • Mocks and Spies
  • JavaScript Testing within a Blazor Project
    • Configure Unit Testing for a JavaScript/TypeScript project
    • Organize Code for Efficient Testing
    • Mocking the DOM
    • Testing DOM Manipulation Code
    • Testing AJAX Code
    • Running Tests
    • Debugging Tests
  • E2E Testing Overview
    • What is End-To-End Testing?
    • Selenium WebDriver
    • Program and Run E2E tests with C#
    • Finding Elements in the DOM Tree
    • Page Objects