Skip to Content
0

Qunit test for csv fileupload

Mar 06, 2017 at 06:28 PM

78

avatar image

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Ulrich Block
Mar 08, 2017 at 09:17 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded