-1

After a bit of research on the available automation frameworks for python, I find that Robot Framework fits almost all my requirements, except that it has not listed pymedia, tkSnack (on which my scripts are based) in any of the (built-in or external) libraries. Since the scripts primarily deal with audio processing using pymedia, and the data on focus is the output .wav files, I cannot figure a way out.

So, my question is - is there a way I can use pymedia, tkSnack libraries with Robot Framework? I would appreciate any help, direction or guiding in this regard.

P.S : I am a total newbie. So, pardon my ignorance or any errors in my understanding. There are chances that I might be missing out on something.

skrowten_hermit
  • 437
  • 3
  • 11
  • 28

1 Answers1

1

You can create your own keyword library in python since there aren't any pre-made libraries.

Create a python module named "my_keywords.py". In that file create a function named "verify_wav_file". Have that function accept a filename, and perform some checks on the file. if the checks fail, throw an exception.

For example:

# my_keywords.py
import os.path
def verify_wav_file(wav_file):
    if not os.path.exists(wav_file):
        raise Exception("bummer, the file doesn't exist")

You can put any code in there you want. So, you can import snack or pymedia or anything else (tkSnack is probably a bad idea, since it has a GUI component). You can use any python libraries you want, because you're just writing a normal python function.

Write a little python program to prove that function works. For example:

# my_program.py
from my_keywords import verify_wav_file
verify_wav_file("/path/to/a/file.wav")

If you can get that to work, you can use that in a robot test without modification. You would simply import the library, and then call the library:

*** Settings ***
| Library | my_keywords.py

*** Test Cases ***
| Example
| | verify wav file | /path/to/a/file.wav
Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685