tesults 2.0.1

.NET Standard 2.0
dotnet add package tesults --version 2.0.1
NuGet\Install-Package tesults -Version 2.0.1
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="tesults" Version="2.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add tesults --version 2.0.1
#r "nuget: tesults, 2.0.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install tesults as a Cake Addin
#addin nuget:?package=tesults&version=2.0.1

// Install tesults as a Cake Tool
#tool nuget:?package=tesults&version=2.0.1

Tesults

Tesults is a test results reporting application. https://www.tesults.com

This library is for uploading test results data to Tesults from .NET.

Installation

Install-Package tesults

Documentation

Documentation is available at https://www.tesults.com/docs/csharp.

API Overview

Upload results using the Upload method in the Results class. This is the single point of contact between your code and Tesults.

Tesults.Results.Upload(data);

The Upload method returns a response indicating success or failure:

var response = Tesults.Results.Upload(data);

// The response value is a dictionary with four keys.

// Value for key "success" is a bool, true if successfully uploaded, false otherwise.
Console.WriteLine("Success: " + response["success"]);

// Value for key "message" is a string, useful to check if the upload was unsuccessful.
Console.WriteLine("Message: " + response["message"]);

// Value for key "warnings" is List<string>, if non empty there may be file upload issues.
Console.WriteLine("Warnings: " + ((List<string>)response["warnings"]).Count);

// Value for key "errors" is List<string>, if success is true this will be empty.
Console.WriteLine("Errors: " + ((List<string>)response["errors"]).Count);

The data param passed to Upload is a Dictionary<string, object> containing your results data. Here is a complete example showing how to populate data with your build and test results and complete upload to Tesults with a call to Tesults.Results.Upload(data):

// Required namespaces:
// using System;
// using System.Collections.Generic;

// Create a list to hold your test case results.
var testCases = new List<Dictionary<string, object>>();

// Each test case is a dictionary. Usually you would
// create these in a loop from whatever data objects your
// test framework provides.
var testCase1 = new Dictionary<string, object>();
testCase1.Add("name", "Test 1");
testCase1.Add("desc", "Test 1 Description");
testCase1.Add("suite", "Suite A");
testCase1.Add("result", "pass");

testCases.Add(testCase1);

var testCase2 = new Dictionary<string, object>();
testCase2.Add("name", "Test 2");
testCase2.Add("desc", "Test 2 Description");
testCase2.Add("suite", "Suite A");
testCase2.Add("result", "pass");

// (Optional) For a paramaterized test case:
var parameters = new Dictionary<string, object>();
parameters.Add("param1", "value1");
parameters.Add("param2", "value2");
testCase2.Add("params", parameters);

// (Optional) Custom fields start with an underscore:
testCase2.Add("_CustomField", "Custom field value");

testCases.Add(testCase2);

var testCase3 = new Dictionary<string, object>();
testCase3.Add("name", "Test 3");
testCase3.Add("desc", "Test 3 Description");
testCase3.Add("suite", "Suite B");
testCase3.Add("result", "fail");
testCase3.Add("reason", "Assert fail in line 203 of example.cs");

// (Optional) Add start and end time for test:
// In this example, start is offset to 60 seconds earlier
// but it should be set to current time when the test starts
testCase3.Add("start", (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) - 60000);
testCase3.Add("end", DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);

// Optional for file uploading
var files = new List<string>();
files.Add(@"full/path/to/file/log.txt");
files.Add(@"full/path/to/file/screencapture.png");
files.Add(@"full/path/to/file/metrics.xls");
testCase3.Add("files", files);

// Optional for adding test case steps
var steps = new List<Dictionary<string, object>>();

var step1 = new Dictionary<string, object>();
step1.Add("name", "Step 1");
step1.Add("desc", "Step 1 Description");
step1.Add("result", "pass");
steps.Add(step1);

var step2 = new Dictionary<string, object>();
step2.Add("name", "Step 2");
step2.Add("desc", "Step 2 Description");
step2.Add("result", "fail");
step2.Add("reason", "Assert fail in line 203 of example.cs");
steps.Add(step2);

testCase3.Add("steps", steps);

testCases.Add(testCase3);

// The results dictionary will contain the test cases.
var results = new Dictionary<string, object>();
results.Add("cases", testCases);

// Finally a dictionary to contain all of your results data.
var data = new Dictionary<string, object>();
data.Add("target", "token");
data.Add("results", results);

// Complete the upload.
var response = Tesults.Results.Upload(data);

// The response value is a dictionary with four keys.

// Value for key "success" is a bool, true if successfully uploaded, false otherwise.
Console.WriteLine("Success: " + response["success"]);

// Value for key "message" is a string, useful to check if the upload was unsuccessful.
Console.WriteLine("Message: " + response["message"]);

// Value for key "warnings" is List<string>, if non empty there may be file upload issues.
Console.WriteLine("Warnings: " + ((List<string>)response["warnings"]).Count);

// Value for key "errors" is List<string>, if success is true this will be empty.
Console.WriteLine("Errors: " + ((List<string>)response["errors"]).Count);  }
}

The target value, 'token' above should be replaced with your target token. If you have lost your token you can regenerate one from the config menu. The cases array should contain your test cases. You would usually add these by looping through the test case objects you currently have in your build and test scripts.

The API library makes use of generics rather than providing classes with specific properties so that the package does not require updating often as and when the Tesults service adds fields.

See https://www.tesults.com/docs/csharp for more details.

Support

help@tesults.com

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on tesults:

Package Downloads
Tesults.NUnit

Tesults NUnit library for uploading test results data to Tesults from NUnit 3 tests.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.1 204 10/27/2022
2.0.0 104 10/27/2022
1.1.2 1,948 4/23/2017
1.1.1 781 4/22/2017
1.1.0 782 4/22/2017
1.0.2 842 12/7/2016
1.0.1 830 12/7/2016
1.0.0 953 12/6/2016