def wrap_run_autoit(script_path): # Create a suite suite = TestSuite.locate_by_path(script_path) run = suite.start_run() result = run_autoit_script(script_path, run) run.finish(result) # Trigger a save for each created testmeasure item so time_spent # field is updated. for x in run.testmeasure_set.all(): x.save() return result
def appmonitorSetUp(self, filename): # Setup internet explorer #caps = DesiredCapabilities.INTERNETEXPLORER.copy() #caps['ignoreProtectedModeSettings'] = True #self.driver = webdriver.Ie(capabilities=caps) self.driver = webdriver.Ie() self.driver.implicitly_wait(30) self.verificationErrors = [] self.accept_next_alert = True # Setup testrun django.setup() self.test_suite = TestSuite.locate_by_path(filename) self.test_run = self.test_suite.start_run() # Register cleanup handler self.addCleanup(self.appmonitorCleanup)
import sys import os import subprocess from django.conf import settings from django import db from appmonitor.models import TestSuite if __name__ == "__main__": if not len(sys.argv) > 1: raise Exception("You must specify a script to run") env = os.environ.copy() env['APPMONITOR_SQLITE_FILE'] = str(settings.DATABASES['default']['NAME']) # Create a suite suite = TestSuite.locate_by_path(sys.argv[1]) run = suite.start_run() env['APPMONITOR_RUN_ID'] = str(run.pk) # Disconnect the django db connection to avoid locking issues db.connection.close() # Call autoit script_file = sys.argv[1] ext_idx = len(script_file) - 4 ext = script_file[ext_idx:].lower() if ext != ".au3": raise Exception("Target script is not an .au3 file") exe_file = script_file[:ext_idx] + ".exe"