Closed BrandonQA closed 2 years ago
We recommend nunit as a test-runner for C#, since it provides the best integration with Playwright, gives you an isolated page out of the box and works well with parallelism: https://playwright.dev/dotnet/docs/test-runners#running-nunit-tests-in-parallel
isn't Testcafe only for JS/TS? (If you are using JS/TS, see here.)
For other third-party test-runners we can't provide any support.
We recommend nunit as a test-runner for C#, since it provides the best integration with Playwright, gives you an isolated page out of the box and works well with parallelism: https://playwright.dev/dotnet/docs/test-runners#running-nunit-tests-in-parallel
isn't Testcafe only for JS/TS? (If you are using JS/TS, see here.)
For other third-party test-runners we can't provide any support.
Hi Sorry miss type on old application i'm using playwright
Do you mean you are using Playwright with Node.js or C#?
Using Playwright with C# when using -- NUnit.NumberOfTestWorkers=10 my tests still seem to run individually not at the same time
Using -- NUnit.NumberOfTestWorkers=10 My test still seem to run individually not at the same time.
Are you using SpecFlow?
Are you using SpecFlow?
No
This worked fine for me, although I noticed that if you were following the instructions here then it doesn't state to setup your runsettings file, nor to set the Scope accordingly (note I have set it to All as his will make the methods run in parallel)
using Microsoft.Playwright;
using NUnit.Framework;
using System.Threading.Tasks;
namespace PlaywrightParallel
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
public class Tests
{
private static IBrowserContext Context;
[SetUp]
public async Task Setup()
{
var pw = await Playwright.CreateAsync();
var chromium = await pw.Chromium.LaunchAsync(new BrowserTypeLaunchOptions
{
Headless = false
});
Context = await chromium.NewContextAsync();
}
[Test]
public async Task Test1()
{
var page = await Context.NewPageAsync();
await page.GotoAsync("https://playwright.dev/dotnet/docs");
await Task.Delay(5000);
}
[Test]
public async Task Test2()
{
var page = await Context.NewPageAsync();
await page.GotoAsync("https://playwright.dev/dotnet/docs");
await Task.Delay(5000);
}
[Test]
public async Task Test3()
{
var page = await Context.NewPageAsync();
await page.GotoAsync("https://playwright.dev/dotnet/docs");
await Task.Delay(5000);
}
[Test]
public async Task Test4()
{
var page = await Context.NewPageAsync();
await page.GotoAsync("https://playwright.dev/dotnet/docs");
await Task.Delay(5000);
}
[Test]
public async Task Test5()
{
var page = await Context.NewPageAsync();
await page.GotoAsync("https://playwright.dev/dotnet/docs");
await Task.Delay(5000);
}
}
}
Hi guys, currently looking for the best way to run multiple tests at the same time using Playwright. I'm not sure if this is possible from the artical i was reading on https://playwright.dev/dotnet/docs/test-runners.
Thank you for your help and information in advance, brandon