Example #1
0
def get_feature_dto(feature):
    workspace = WorkSpace.objects.get(pk=feature.workspace)
    workspace_path = workspace.getFolderPath()
    dict = Step.getStepByFolder(workspace_path)
    file_path = FeatureFileGenerator.get_workspace_entrance(workspace)
    feature = lettuce.Feature.from_file(file_path)
    feature_dto = FeatureDto(feature.name, feature.description)
    scenarios = []
    for sce in feature.scenarios:
        s_dto = ScenarioDto('id_missing', sce.name)
        for s_item in sce.steps:
            co_func, patten, result = match_definision(s_item, dict)
            action_type, varlist_tuple, variables = extract_func_info(co_func, s_item, result)
            step_dto = StepDto()
            func_code = co_func.func_code
            step_dto.fill(func_code.co_filename, func_code.co_firstlineno, func_code.co_argcount,
                          varlist_tuple, func_code.co_name, patten, action_type, variables, patten,
                          'id_no_use')
            s_dto.steps.append(step_dto)
        scenarios.append(s_dto)
    feature_dto.fill_scenarios(scenarios)
    return feature_dto
Example #2
0
def index(request):
    steps = Step.getStepByFolder('../simple-selenium')
    return render(request, 'auto/index.html', {'steps': steps})