From the course: Robot Framework Test Automation: Level 2

Unlock this course with a free trial

Join today to access over 23,400 courses taught by industry experts.

Custom CSV parsing library

Custom CSV parsing library

- [Instructor] The next thing we'll do is to create a custom library that can read CSV files. So for this, I'm going to right-click and create a new directory called CustomLibs or CustomLibs for those of you who pronounce it that way. And from there, I'll right-click on this, create a new file and I'm just going to call it Csv.py and we're calling it PY instead of .robot because this is actually a Python script that represents a custom robot framework library. The first thing we type at the top of the file is import, space, CSV and notice how we get to IntelliSense so we know this is a valid thing to do. And you can see where this lives. It's in C:\Python27\Lib which means it's a library that comes as part of Python. So this CSV library is going to do the heavy lifting for us. Hit return, and now just like we did in a previous lecture about creating custom libraries, I'll type in def and the name of my function read_csv_file and if I put a colon on the end, we already have the makings…

Contents