integrating python scripts with django -
i have written test scripts in python call apis paritcular application , output results database can use jasper report on results. scripts run using python interpreter, ie double click on python file has parameters , variables modifed within script initiates tests. move towards more user friendly interface other people can use these test scripts without having modify python code. thinking using django , creating web page has check boxes, , if check box ticked, execute particular python test script or text box pass values given variable, example. have few questions around how might achieved.
1 - need implement python code in django source code or can call python script web page served django?
2 - if run web page, how ensure if web page closed, test continue in background.
3 - there way output status of test case web page , if web page closed, status availble if web page reopened?
many - oli
if have python function can call django django view maybe form parameter input. if have long running processes might want consider tip here: how start long-running process django view?
from mytests import testfunc def test_parameter_view(request): if request.method == 'post': # if form has been submitted... form = parameterform(request.post) if form.is_valid(): testfunc(form.cleaned_data['parameter']) # <-- here actual testing happens return httpresponseredirect(reverse(test_result)) # redirect after post else: form = parameterform() return render_to_response('test.html', { 'form': form, }) in test_result view can access test result values database.
if user closes browser or not doesn't affect server processes have been started. , since write results database persistent , can accessed time after test has finished.
Comments
Post a Comment