Follow

QMetry Automation Studio Data Driven Approach

To make any test data driven,user can use QAFDataProvider annotation on test method , where test cases are executed for each data set provided in external data file. QMetry Automation Studio supports following file formats to provide data for data driven tests.

  • CSV
  • MS-EXCEL
  • JSON
  • XML
  • DATABASE

For Example

As shown below with QAFDataProvider annotation User can provide file name in dataFile parameter and other required values in their related parameters for associated file format.

        @QAFDataProvider(dataFile = "resources/searchdata.csv") 
	@QAFDataProvider(dataFile = "resources/searchdata.json") 
	@QAFDataProvider(dataFile = "resources/searchdata.xls") 
	@QAFDataProvider(dataFile = "resources/data/searchdata.xls", sheetName="sheet2") 
	@QAFDataProvider(key="search.data") //xml key no need to provide file name 
	@QAFDataProvider(sqlQuery = "select col1, col2 from tbl")  

Here is the example how you can make your test data driven with csv file.

JAVA:

@QAFDataProvider(dataFile = "resources/searchdata.csv")
    @Test(groups = { "SMOKE", "P1" }, description = "Search using keyword")
    public void searchWithDifferentKeyword(Map<String, String> map) {
        get("http://www.google.com");
        sendKeys(map.get("keyword"), "text.google.search");
        click("submit.google.search");
        assertLinkWithPartialTextPresent(map.get("link-text"));
    }

BDD:

SCENARIO: Search with different keyword
META-DATA: {"description":"Search using different keyword","groups":["SMOKE", "P1"], "dataFile":"resources/searchdata.csv" }

Given get 'http://www.google.com'
    Then assert 'text.google.search' is present
    When sendKeys '${keyword}' into 'text.google.search'
    And submit 'submit.google.search'
    Then assert link with partial text '${link-text}' is present
    
END

Another Example:
@QAFDataProvider(dataFile = "resources/logindata.csv")
@Test(description = "login validation message " , groups={"p1" , "p2"})
public void login(Map <String, String> data) {
	doLogin(data.get("Username"),data.get("password"));
	assertLoginMsg(data.get("expectedMsg")) }

Generated Report after Test Execution.

For more details you can click on below link.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk