tesults 2.0.1
dotnet add package tesults --version 2.0.1
NuGet\Install-Package tesults -Version 2.0.1
<PackageReference Include="tesults" Version="2.0.1" />
paket add tesults --version 2.0.1
#r "nuget: tesults, 2.0.1"
// 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 Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- AWSSDK.S3 (>= 3.7.101.3)
- Microsoft.CSharp (>= 4.7.0)
- Newtonsoft.Json (>= 13.0.1)
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.