Xping.Sdk 1.0.0-rc2

This is a prerelease version of Xping.Sdk.
dotnet add package Xping.Sdk --version 1.0.0-rc2
                    
NuGet\Install-Package Xping.Sdk -Version 1.0.0-rc2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Xping.Sdk" Version="1.0.0-rc2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Xping.Sdk" Version="1.0.0-rc2" />
                    
Directory.Packages.props
<PackageReference Include="Xping.Sdk" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Xping.Sdk --version 1.0.0-rc2
                    
#r "nuget: Xping.Sdk, 1.0.0-rc2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Xping.Sdk@1.0.0-rc2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Xping.Sdk&version=1.0.0-rc2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Xping.Sdk&version=1.0.0-rc2&prerelease
                    
Install as a Cake Tool

About The Project

Xping SDK provides a set of tools to make it easy to write automated tests for Web Application and Web API, as well as troubleshoot issues that may arise during testing. The library provides a number of features to verify that the Web Application is functioning correctly, such as checking that the correct data is displayed on a page or that the correct error messages are displayed when an error occurs.

The library is called Xping, which stands for eXternal Pings, and is used to verify the availability of a server and monitor its content.

You can find more information about the library, including documentation and examples, on the official website https://xping.io.

Getting Started

The library is distributed as a NuGet packages, which can be installed using the .NET CLI command dotnet add package. Here are the steps to get started:

Installation using .NET CLI

  1. Open a command prompt or terminal window.

  2. Navigate to the directory where your project is located.

  3. Run the following command to install the Xping NuGet package:

    dotnet add package Xping.Availability
    
  4. Once the package is installed, you can start using the Xping library in your project.

using Xping.Sdk.Core.DependencyInjection;

Host.CreateDefaultBuilder()
    .ConfigureServices(services =>
    {
        .AddHttpClientFactory()
        .AddTestAgent(agent =>
        {
            agent.UploadToken = "--- Your Dashboard Upload Token ---";
            agent.UseDnsLookup()
                 .UseIPAddressAccessibilityCheck()
                 .UseHttpClient()
                 .UseHttpValidation(response =>
                 {
                     Expect(response)
                         .ToHaveSuccessStatusCode()
                         .ToHaveHttpHeader(HeaderNames.Server)
                             .WithValue("Google", new() { Exact = false });
                 })
        });
    });
using Xping.Sdk.Core;
using Xping.Sdk.Core.Session;

var testAgent = _serviceProvider.GetRequiredService<TestAgent>();

TestSession session = await testAgent.RunAsync(new Uri("www.demoblaze.com"));

You can also integrate it with your preferred testing framework, such as NUnit, as shown below:

[TestFixtureSource(typeof(XpingTestFixture))]
public class HomePageTests(TestAgent testAgent) : XpingAssertions
{
    public required TestAgent TestAgent { get; init; } = testAgent;

    [OneTimeSetUp]
    public void OneTimeSetUp()
    {
        TestAgent.UploadToken = "--- Your Dashboard Upload Token ---"; // optional
    }

    [Test]
    public async Task VerifyHomePageTitle()
    {
        TestAgent.UseBrowserClient()
                 .UsePageValidation(async page =>
                 {
                     await Expect(page).ToHaveTitleAsync("STORE");
                 });

        await using TestSession session = await TestAgent.RunAsync(new Uri("https://demoblaze.com"));

        Assert.That(session.IsValid, Is.True, session.Failures.FirstOrDefault()?.ErrorMessage);
    }

That’s it! You’re now ready to start automating your web application tests and monitoring your server’s content using Xping.

License

Distributed under the MIT License. See LICENSE file for more information.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-rc2 75 1/5/2025
1.0.0-rc1 71 12/13/2024