Module: UE4TestRunner
- Defined in:
- lib/runner.rb
Constant Summary collapse
- UE4_ROOT =
"D:\\UE_4.26"- EXECUTABLE_LOCATION =
"\\Engine\\Binaries\\Win64\\UE4Editor-Cmd.exe"- FLAGS =
'-unattended -silent -nopause -NullRHI -testexit="Automation Test Queue Empty" -log -log=RunTests.log'- MISSING_FILE_ERROR_MESSAGE =
"File does not exists D:"- MISSING_PROJECT_FILE_ERROR_MESSAGE =
"uproject file does not exists D: make sure you're in the ue4 project root directory"- TEST_RESULT_DIR =
'TestResult'
Instance Method Summary collapse
- #build_command ⇒ Object
- #current_directory ⇒ Object
- #project_file_path ⇒ Object
- #report_outputh_path ⇒ Object
- #run ⇒ Object
- #tests_command ⇒ Object
- #tests_to_run ⇒ Object
Instance Method Details
#build_command ⇒ Object
29 30 31 |
# File 'lib/runner.rb', line 29 def build_command "#{UE4_ROOT}#{EXECUTABLE_LOCATION} #{project_file_path} #{FLAGS} #{tests_command} #{report_outputh_path}" end |
#current_directory ⇒ Object
51 52 53 |
# File 'lib/runner.rb', line 51 def current_directory File.(File.dirname(__FILE__)) end |
#project_file_path ⇒ Object
33 34 35 36 37 |
# File 'lib/runner.rb', line 33 def project_file_path file = Dir.entries(".").select {|file_name| file_name.include?('.uproject')}.first raise MISSING_PROJECT_FILE_ERROR_MESSAGE if file.nil? File.(file, File.dirname(file)) end |
#report_outputh_path ⇒ Object
47 48 49 |
# File 'lib/runner.rb', line 47 def report_outputh_path "-ReportOutputPath=\"#{current_directory}\\#{TEST_RESULT_DIR}\"" end |
#run ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/runner.rb', line 12 def run begin puts "Running tests..." system(build_command, :out => File::NULL) file_name = "#{current_directory}\\#{TEST_RESULT_DIR}\\index.json" puts "#{file_name}: #{MISSING_FILE_ERROR_MESSAGE}" and return unless File.file?(file_name) tests = Parser::parse(file_name) tests.each {|test| puts test.pretty} FileUtils.rm_rf("#{current_directory}#{TEST_RESULT_DIR}") rescue RuntimeError => error puts error end end |
#tests_command ⇒ Object
39 40 41 |
# File 'lib/runner.rb', line 39 def tests_command "-ExecCmds=\"Automation RunTests #{tests_to_run}\"" end |
#tests_to_run ⇒ Object
43 44 45 |
# File 'lib/runner.rb', line 43 def tests_to_run ARGV[0] end |