Use custom C#-libraries in Robot Framework

Read Install Robot Framework with IronPython on Windows and Use .NET libraries in Robot Framework first.

1. Save the Robot Framework file as ExampleTestCase.txt in C:\Program Files (x86)\robotframework-2.9\src\bin:

*** Settings ***
Library     FileManager
*** Test Cases ***
My Test
    Create File    fantastic.txt

2. Save the „middle-tier“ Python script as in C:\Program Files (x86)\robotframework-2.9\src\bin:

import clr
clr.AddReferenceToFileAndPath("C:/Program Files (x86)/robotframework-2.9/src/bin/FileCreator.dll")
import FileCreator
class FileManager:
    def create_file(self, fileName):

Note, that in Python an object is created with brackets: FileCreator()
Note, that Robot Framework automatically matches the keyword „Create File“ in ExampleTestCase.txt with „create_file“ in

3. Save your custom C# file as FileCreator.cs in C:\Program Files (x86)\robotframework-2.9\src\bin:

using System;
public class FileCreator
    public void CreateFile(String fileName)

4. Compile FileCreator.cs with csc in Command Prompt:

"C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe" /t:library /out:FileCreator.dll "C:\Program Files (x86)\robotframework-2.9\src\bin\FileCreator.cs"

5. Run the test in Command Prompt with:

ipybot ExampleTestCase.txt