Skip to content

Commit 58574ee

Browse files
committed
update tests
1 parent 59cf5b6 commit 58574ee

File tree

3 files changed

+43
-91
lines changed

3 files changed

+43
-91
lines changed

.github/workflows/continuous_integration.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ jobs:
7171
- name: Translator Sizing Run Spec
7272
run: bundle exec rspec spec/tests/translator_sizing_run_spec.rb
7373
if: always()
74-
- name: Translator Perform SR and Baseline Simulations Spec
75-
run: bundle exec rspec spec/tests/translator_baseline_simulation_spec.rb
76-
if: always()
7774
- name: Translator Perform SR and Baseline Simulations, Gather and Save Results Spec
7875
run: bundle exec rspec spec/tests/translator_baseline_gather_save_spec.rb
7976
if: always()

spec/tests/translator_quick_simulations_spec.rb

Lines changed: 0 additions & 55 deletions
This file was deleted.

spec/tests/translator_spec.rb

Lines changed: 43 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -42,48 +42,58 @@
4242
require 'parallel'
4343

4444
RSpec.describe 'Translator' do
45-
it 'should write parameter value into XML' do
46-
# -- Setup
47-
file_name = 'building_151_one_scenario.xml'
48-
std = CA_TITLE24
49-
xml_path, output_path = create_xml_path_and_output_path(file_name, std, __FILE__, 'v2.2.0')
50-
epw_path = nil
51-
results_xml = File.join(output_path, 'results.xml')
45+
describe "Example Full Workflow" do
46+
tests = [
47+
# file_name, standard, epw_path, schema_version
48+
['building_151_one_scenario.xml', CA_TITLE24, nil, 'v2.2.0'],
49+
['L000_OpenStudio_Pre-Simulation_01.xml', CA_TITLE24, nil, 'v2.2.0']
50+
]
51+
tests.each do |test|
52+
it 'Should Run the Prototypical Workflow' do
53+
file_name = test[0]
54+
std = test[1]
55+
epw_path = test[2]
56+
version = test[3]
57+
xml_path, output_path = create_xml_path_and_output_path(file_name, std, __FILE__, version)
58+
results_xml = File.join(output_path, 'results.xml')
5259

53-
# This should be the prototypical workflow in most cases.
54-
# 1. Create new translator from file
55-
# 2. Perform a SR to get an OSM with efficiencies / etc. for the location
56-
# determined from the location defined in the BSync file
57-
# OR
58-
# for the location overriden by the epw file
59-
# 3. Write new scenarios for
60-
translator = BuildingSync::Translator.new(xml_path, output_path, epw_path, std)
61-
translator.setup_and_sizing_run
60+
# This should be the prototypical workflow in most cases.
61+
# 1. Create new translator from file
62+
# 2. Perform a SR to get an OSM with efficiencies / etc. for the location
63+
# determined from the location defined in the BSync file
64+
# OR
65+
# for the location overriden by the epw file
66+
# 3. Write new scenarios for
67+
translator = BuildingSync::Translator.new(xml_path, output_path, epw_path, std)
68+
translator.setup_and_sizing_run
6269

63-
# -- Assert sizing run performs as expected
64-
sizing_run_checks(output_path)
70+
# -- Assert sizing run performs as expected
71+
sizing_run_checks(output_path)
6572

66-
workflows_successfully_written = translator.write_osws
73+
workflows_successfully_written = translator.write_osws
6774

68-
# -- Assert
69-
expect(workflows_successfully_written).to be true
70-
failures = translator.run_osws
75+
# -- Assert
76+
expect(workflows_successfully_written).to be true
77+
failures = translator.run_osws
7178

72-
# -- Assert no failures
73-
expect(failures.empty?).to be true
79+
# -- Assert no failures
80+
expect(failures.empty?).to be true
7481

75-
translator.gather_results
82+
translator.gather_results
7683

77-
# -- Assert result_gathered set to true
78-
expect(translator.results_gathered).to be true
84+
# -- Assert result_gathered set to true
85+
expect(translator.results_gathered).to be true
7986

80-
translator.prepare_final_xml
87+
translator.prepare_final_xml
8188

82-
# -- Assert final_xml_prepared set to true
83-
expect(translator.final_xml_prepared).to be true
89+
# -- Assert final_xml_prepared set to true
90+
expect(translator.final_xml_prepared).to be true
8491

85-
# Expect a results.xml file to exist
86-
translator.save_xml
87-
expect(File.exist?(results_xml)).to be true
92+
# Expect a results.xml file to exist
93+
translator.save_xml
94+
95+
translator_save_xml_checks(translator, results_xml)
96+
end
97+
end
8898
end
8999
end

0 commit comments

Comments
 (0)