Skip to Content
avatar image
Former Member

Qunit test for csv fileupload

Hi,

Can someone help me out in how to write qunit test for csv file upload? I have three use cases - 1. read csv file succesfully 2. upload wrong type file 3. upload bad data csv file

This is the sample code i am using - csvfile upload link

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Mar 08, 2017 at 09:17 AM

    Unfortunately you cannot properly/fully test a file input with Qunit. The JavaScript APIs will not allow you to set the files to the input due to security restrictions. If JavaScript would be able to access any file on the users disk and apply it to such an input field, the area for misuse great.

    As a workaround you could directly call your callback functions and provide whatever input an event from the file input control would have given.

    To get more concrete ideas, check the Qunit tests written for the control:https://github.com/SAP/openui5/blob/master/src/sap.m/test/sap/m/qunit/UploadCollection.qunit.html

    Add comment
    10|10000 characters needed characters exceeded