Skip to content

Instantly share code, notes, and snippets.

@mkorpela
Created October 17, 2012 18:53
Show Gist options
  • Save mkorpela/3907371 to your computer and use it in GitHub Desktop.
Save mkorpela/3907371 to your computer and use it in GitHub Desktop.
Script to help in Robot Framework test optimization
import cProfile
import pstats
from robot.run import run_cli
import os, sys
import tempfile
profile_results = tempfile.mktemp(suffix='.out', prefix='pybot-profile', dir='.')
cProfile.run('run_cli(sys.argv[1:])', profile_results)
stats = pstats.Stats(profile_results)
stats.sort_stats('cumulative').print_stats(50)
os.remove(profile_results)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment