Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG/Question] Is [Parallelizable(ParallelScope.Children)] and or sharding supported in the dotnet version? #2732

Closed
nullptrerror opened this issue Oct 17, 2023 · 0 comments · Fixed by microsoft/playwright#27745

Comments

@nullptrerror
Copy link

System info

  • Playwright Version: [v1.38]
  • Operating System: [All, Windows 11, Ubuntu 20]
  • Browser: [All, Chromium, Firefox, WebKit]
  • Other info: I'm trying to figure out if parallel test case execution is supported in the .NET version of Playwright. The documentation mentions, Running test in parallel using ParallelScope.All or ParallelScope.Fixtures is not supported. Does this mean parallel test execution isn't supported at all, or is it just specific tags on methods or classes that aren't supported?
    /// <summary>
    /// Specifies the degree to which a test, and its descendants, 
    /// may be run in parallel.
    /// </summary>
    [Flags]
    public enum ParallelScope
    {
        /// <summary>
        /// The test may be run in parallel with others at the same level.
        /// Valid on classes and methods but has no effect on assemblies.
        /// </summary>
        Self = 1,
        /// <summary>
        /// Descendants of the test may be run in parallel with one another.
        /// Valid on assemblies and classes but not on non-parameterized methods.
        /// </summary>
        Children = 256,
        /// <summary>
        /// Descendants of the test down to the level of TestFixtures may be 
        /// run in parallel with one another. Valid on assemblies and classes
        /// but not on methods.
        /// </summary>
        Fixtures = 512,
        /// <summary>
        /// The test and its descendants may be run in parallel with others at
        /// the same level. Valid on classes and parameterized methods.
        /// For assemblies it is recommended to use <see cref="Children"/>
        /// instead, as <see cref="Self"/> has no effect on assemblies.
        /// </summary>
        All = Self + Children
    }
}

Source code

  • [X ] I provided exact source code that allows reproducing the issue locally.

Link to the GitHub repository with the repro

using NUnit.Framework;
using NUnit_E2E.TestFixture.PlaywrightTest;

namespace NUnit_E2E.TestPlan.Httpbin.TestSuites;

[TestFixture]
[Parallelizable(ParallelScope.Children)]
public sealed class HttpbinTestSuite : BrowserTest
{
    [TestCase("get/200")]
    [TestCase("basic-auth/username/password")]
    [TestCase("headers")]
    [TestCase("ip")]
    [TestCase("user-agent")]
    [TestCase("cache")]
    [TestCase("cache/60")]
    [TestCase("etag/etag")]
    [TestCase("response-headers")]
    [TestCase("brotli")]
    [TestCase("defalte")]
    [TestCase("deny")]
    [TestCase("encoding/utf8")]
    [TestCase("gzip")]
    [TestCase("html")]
    [TestCase("json")]
    [TestCase("robots.txt")]
    [TestCase("xml")]
    public async Task GotoAsync(string endpoint)
    {
        string url = "https://httpbin.org/" + endpoint;
        await Page.GotoAsync(url);
        Assert.That(Page.Url, Does.StartWith(url));
    }
}

Steps

  • [Run the test]
  • [Observe if tests are running in parallel or not]

Expected

Tests should run in parallel if parallel test case execution is supported.
Test should be shardable.

Actual

Tests run in parallel but I'm not sure if it's because my test cases are simple.
Test seem to be able to be shardable but I'm still working on it on my repo poc.

@yury-s yury-s transferred this issue from microsoft/playwright Oct 18, 2023
mxschmitt added a commit to microsoft/playwright that referenced this issue Oct 23, 2023
Germandrummer92 pushed a commit to OctoMind-dev/playwright that referenced this issue Oct 27, 2023

Verified

This commit was signed with the committer’s verified signature.
suemto suem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant