1

I am new to Karate Framework and I need to execute multiple scenarios from one feature file on chrome, msedge and firefox browser. After each scenario outline I am adding configuration type in Example, as below:

Feature: Login test

Background: #* configure driver = {type: 'msedge', headless: true} #* configure driver = [{type: 'msedge'}, {type: 'chrome', executable:'C:\Program Files\Google\Chrome\Application\chrome.exe'}] * def element = read('classpath:Test/FunctionalAutomation/Locators/LoginWebelement.json') * def data = read ('classpath:Test/FunctionalAutomation/TestData/DataLogin.json')

 Scenario Outline: Login to application with positive and negative scenario #With correct p/w * configure driver = {type: '<conf>', executable: '<exePath>'} Given driver "https://www.saucedemo.com/" And input(element.x_username, data.txt_username) And input(element.id_password, data.txt_password) When click(element.id_loginButton) Then print driver.title Then match driver.title == 'Swag Labs' Examples: | conf | exePath | | msedge | C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe | | chrome | C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe | Scenario Outline: With invalid p/w * configure driver = {type: '<conf>', executable: '<exePath>'} Given driver "https://www.saucedemo.com/" And input(element.x_username, data.txt_username) And input(element.id_password, data.txt_wrongPassword) When click(element.id_loginButton) Then print text(element.x_errorMessageText) Then match text(element.x_errorMessageText) == data.err_msg_incorrectCredential Examples: | conf | exePath | | msedge | C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe | | chrome | C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe | 

Is there any way so that I can avoid repetition of same Example after each scenario as I wanted to execute scenarios on Chrome, firefox as well as edge.

1
  • @ptrthomas could you please help me on my above question? Commented Oct 7, 2022 at 13:16

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.