Kanchan Sharma
Kanchan Sharma

Reputation: 1

How to use cross browser testing in Specflow Playwright C# linking with specflow.actions.json

My JSON file is:

specflow.actions.json file

{
  "target": {
    "defaultTimeout": 60,
    "headless": false,
    "traceDir": "traces"
  }
}

My custom json file I am willing to use for targetting different browsers and OS

{
  "BrowserTypes": [
      {
        "BrowserName": "Chrome",
        "OS": [ "Win10_Chrome", "Win11_Chrome", "Mac" ]
      },
      {
        "BrowserName": "Edge",
        "OS": [ "Win10_Chrome" ]
      },
      {
        "BrowserName": "Mobile",
        "OS": [ "IOS_Chrome", "Android_Chrome" ]
      }
    ],
    "DefaultBrowser": [ "Chrome", "Mobile" ],
    "DefaultEnvironment": "Demo"
}

I am new to Specflow playwright c# and I want to see how we can achieve Cross bowser testing. I have gone through the document provided at git, but I am unable to tweak the configuration at runtime.

I am expecting to control the configuration at runtime so that the test cases run for the defined browsers at run time

Upvotes: 0

Views: 463

Answers (1)

Gaurav Khurana
Gaurav Khurana

Reputation: 3936

You can use runsettings file to get a value

Then using that value you can read the json file and get further configuration

That configuration , lets say chrome / windows10 can be passed to browser instance at run time to decide which configuration to run.

Also another idea would be lets say your piepline runs twice a day , based on day / time pass a browser. This way you need not to run all test in all browsers and you can save time and cost

Upvotes: 0

Related Questions