https://cypress.io logo
Using data from .csv files #need#help
# i-need-help
q
I have a test case scenario where I have more than a million data in .csv . I’m using those as a parameter and using it as a variable in my Api endpoint. The problem occurs, whenever there are more than 500 data in the .csv file. The webserver returns 502. However, when the data is less than 500, the test runs perfectly. What should be the best practice to cover all the data for the test scenario. @best-flower-17510
b
Hey @quiet-answer-70986 , sounds like this will become a big project! @nutritious-restaurant-91514 recently published a blog on large projects and might have more insight that you will find helpful. I will share the blog below 😀 https://filiphric.com/how-to-structure-a-big-project-in-cypress
Hey @quiet-answer-70986 , sounds like this will become a big project! @nutritious-restaurant-91514 recently published a blog on large projects and might have more insight that you will find helpful. I will share the blog below 😀 https://filiphric.com/how-to-structure-a-big-project-in-cypress
q
This blog was helpful, however it didn't served my purpose. Would be great if you provide any probable solution @best-flower-17510
m
Hi @quiet-answer-70986 , I have a case where I am reading more than 8k + rows from csv file.. I am using neat-csv plugin. It's working fine for me. Sample Code : const csv = require("neat-csv"); cy.fixture("/csv/datafile) .then(csv) .then((data) => { })
q
it('Read Property_ID_NMA from CSV file', () => { cy.fixture("testdata.csv").as('testData') cy.get('@testData').then((testData) => { testData.split('\n').forEach((line, index) => { if (index > 0) { // skip header row const propertyID = line.trim() cy.getPropertyInfoAddress(propertyID).then((response) => { expect(response.status).to.eq(200) cy.log(JSON.stringify(response.body)); }) } }) }) });
m
Did it work for you with the above approach?
q
It works for 1000 value of one row, however it doesn’t work above 1000.
m
The above approach, which I shared works perfectly fine for more than 8000 rows as well. Using the plugin neat-csv. You can try that