From 58b7c42fc5d9727d2642016eea9b6938119e99a5 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Tue, 15 Oct 2019 11:58:26 +1100 Subject: [PATCH] Create features template --- src/ifcbimtester/features/environment.py | 5 +++ src/ifcbimtester/features/steps/steps.py | 33 +++++++++++++++ src/ifcbimtester/features/template.html | 51 ++++++++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 src/ifcbimtester/features/environment.py create mode 100644 src/ifcbimtester/features/steps/steps.py create mode 100644 src/ifcbimtester/features/template.html diff --git a/src/ifcbimtester/features/environment.py b/src/ifcbimtester/features/environment.py new file mode 100644 index 0000000000..9ee093267e --- /dev/null +++ b/src/ifcbimtester/features/environment.py @@ -0,0 +1,5 @@ +from behave.model import Scenario +def before_all(context): + userdata = context.config.userdata + continue_after_failed = True + Scenario.continue_after_failed_step = continue_after_failed diff --git a/src/ifcbimtester/features/steps/steps.py b/src/ifcbimtester/features/steps/steps.py new file mode 100644 index 0000000000..a2abaf7411 --- /dev/null +++ b/src/ifcbimtester/features/steps/steps.py @@ -0,0 +1,33 @@ +import ifcopenshell +from behave import given, when, then, step + +class IfcFile(object): + file = None + + @classmethod + def load(cls, path=None): + cls.file = ifcopenshell.open(path) + + @classmethod + def get(cls): + return cls.file + +@given('the IFC file "{file}"') +def step_impl(context, file): + IfcFile.load(file) + +@given('that an IFC file is loaded') +def step_impl(context): + assert IfcFile.get() + +@then('the file should be an {schema} file') +def step_impl(context, schema): + assert IfcFile.get().schema == schema + +@then('the element {id} is an {ifc_class}') +def step_impl(context, id, ifc_class): + assert IfcFile.get().by_id(id).is_a(ifc_class) + +@then('the element {id} should not exist because {reason}') +def step_impl(context, id, reason): + assert not IfcFile.get().by_id(id) diff --git a/src/ifcbimtester/features/template.html b/src/ifcbimtester/features/template.html new file mode 100644 index 0000000000..5a4b6ae2f9 --- /dev/null +++ b/src/ifcbimtester/features/template.html @@ -0,0 +1,51 @@ + + + + + + + BlenderBIM + + + + +
+

IFC QA Report: {{report_name}}

+
+ {{#testcases}} +
+

{{name}}

+

+ {{#is_success}}Success{{/is_success}}{{^is_success}}Failure{{/is_success}} + Tests passed: {{total_passes}} / {{total_steps}} + + Time taken: {{time}} seconds + +

+
    + {{#steps}} +
  1. + {{name}} + {{time}} +
  2. + {{/steps}} +
+
+ {{/testcases}} + + +