https://github.com/martincostello/browserstack-automate
.NET client for the BrowserStack Automate REST API
https://github.com/martincostello/browserstack-automate
browserstack browserstack-automate dotnet-core
Last synced: 6 months ago
JSON representation
.NET client for the BrowserStack Automate REST API
- Host: GitHub
- URL: https://github.com/martincostello/browserstack-automate
- Owner: martincostello
- License: apache-2.0
- Created: 2015-12-10T17:54:36.000Z (over 10 years ago)
- Default Branch: main
- Last Pushed: 2025-10-02T14:54:52.000Z (6 months ago)
- Last Synced: 2025-10-02T16:32:51.581Z (6 months ago)
- Topics: browserstack, browserstack-automate, dotnet-core
- Language: C#
- Homepage: https://martincostello.github.io/browserstack-automate/
- Size: 3.56 MB
- Stars: 8
- Watchers: 4
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
#  BrowserStack Automate REST API .NET Client
[](https://www.nuget.org/packages/MartinCostello.BrowserStack.Automate)
[](https://www.nuget.org/packages/MartinCostello.BrowserStack.Automate)
## Build Status
[](https://github.com/martincostello/browserstack-automate/actions/workflows/build.yml?query=branch%3Amain+event%3Apush)
[](https://codecov.io/gh/martincostello/browserstack-automate)
[](https://securityscorecards.dev/viewer/?uri=github.com/martincostello/browserstack-automate)
## Overview
This repository contains a .NET client library/NuGet package for the [BrowserStack Automate](https://www.browserstack.com/automate) REST API.
Features include:
- Querying the status of a BrowserStack Automate plan.
- Querying the available browsers.
- Querying and deleting builds.
- Querying and deleting projects.
- Querying and deleting sessions.
- Querying session log.
- Setting the status of a session.
- Regenerating the API access key.
The assembly supports .NET Standard 2.0.
## Installation
```powershell
dotnet add package MartinCostello.BrowserStack.Automate
```
## Usage Examples
The following example shows a custom [xUnit.net](https://xunit.github.io/) `[Fact]` that checks for an available BrowserStack Automate session before running the test, otherwise it is skipped.
```csharp
namespace MyApp.Tests;
using MartinCostello.BrowserStack.Automate;
using Xunit;
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public sealed class RequiresBrowserStackAutomateAttribute : FactAttribute
{
public RequiresBrowserStackAutomateAttribute()
{
var userName = Environment.GetEnvironmentVariable("BrowserStack_UserName");
var accessKey = Environment.GetEnvironmentVariable("BrowserStack_AccessKey");
if (userName is not null && accessKey is not null)
{
using var client = new BrowserStackAutomateClient(userName, accessKey);
var plan = client.GetStatusAsync().Result;
if (plan.MaximumAllowedParallelSessions < 1 ||
plan.ParallelSessionsRunning == plan.MaximumAllowedParallelSessions)
{
Skip = "No BrowserStack Automate sessions are currently available.";
}
}
else
{
Skip = "No BrowserStack Automate credentials are available.";
}
}
}
```
## Feedback
Any feedback or issues can be added to the issues for this project in [GitHub](https://github.com/martincostello/browserstack-automate/issues).
## Repository
The repository is hosted in [GitHub](https://github.com/martincostello/browserstack-automate):
## License
This project is licensed under the [Apache 2.0](https://github.com/martincostello/browserstack-automate/blob/main/LICENSE) license.
## Building and Testing
To build and test the assembly run one of the following set of commands:
```powershell
$env:BrowserStack_UserName = "MyUserName"
$env:BrowserStack_AccessKey = "MyAccessKey"
./build.ps1
```
_If you do not have a BrowserStack Automate access key you can still just run the build script and the integration tests that require credentials will be skipped._