Use data from excel spreadsheet
Similar to how DataProvider works for Selenium.
found a useful link :- https://rjzaworski.com/2013/01/parameterized-testing-in-javascript
However , grabbing data from excel is where I got stuck , coz while using modules such as 'xlsx' to convert excel data to json to pass it into parameters , cypress throws an error _fs.readfileSync is not a function.
Since xlsx.readFile function is 'Node Only' Function and might be the code is being executed in the browser domain .
I am quite new to cypress , but having this functionality will be significantly better.
Try using cy.task to read and convert that file - task runs in Node context
Sent from my iPhone
On Mar 3, 2019, at 08:17, Yogit Thakral [email protected] wrote:
found a useful link :- https://rjzaworski.com/2013/01/parameterized-testing-in-javascript
However , grabbing data from excel is where I got stuck , coz while using modules such as 'xlsx' to convert excel data to json to pass it into parameters , cypress throws an error _fs.readfileSync is not a function.
Since xlsx.readFile function is 'Node Only' Function and might be the code is being executed in the browser domain .
I am quite new to cypress , but having this functionality will be significantly better.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
Thanks @bahmutov .
One more thing I would like to mention here , The link that I quoted , it runs paraterized test using for loop, it means that essentially , on outer context , this will be a single test case , not like separate test cases for separate test data as it is in testNG.
@yogitthakral I want to implement similar logic in my new project requirement. In current one, we are using dataprovider(excel) in Selenium Java. We are going to use data driven framework for Cypress and Read test data from excel file. I am new to Cypress. Can you please help me.
Thanks, Sushant
If you're currently using an Excel sheet, I think you could just convert your files to .json and use the "fixtures" feature of cypress to use your data within the tests.
If you need a Dynamic implementation you'll probably need to do a few more things.
@mrpicklez70 Thanks for your inputs.
The situation here is.. we are migrating from existing automation framework written in Selenium+Java to new automation framework in Cypress..
In old framework we used to read test data from multiple data tables mentioned in spread sheet. We are interested in knowing is there anyway we can directly use excel sheet in cypress automation.
We dont need dynamic Xls.. Our sheet is static in execution time..