ue4-test-runner 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/ue4-test-runner.exe +0 -0
- data/lib/TestResult/index.html +594 -0
- data/lib/TestResult/index.json +1243 -0
- data/lib/base_test.rb +15 -0
- data/lib/failed_test.rb +17 -0
- data/lib/final_test.rb +20 -0
- data/lib/parser.rb +23 -0
- data/lib/runner.rb +54 -0
- data/lib/successful_test.rb +11 -0
- data/lib/test_entry.rb +10 -0
- data/lib/ue4-test-runner.rb +2 -1
- metadata +10 -1
data/lib/base_test.rb
ADDED
data/lib/failed_test.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require_relative 'base_test'
|
2
|
+
require 'rainbow/refinement'
|
3
|
+
using Rainbow
|
4
|
+
|
5
|
+
class FailedTest < BaseTest
|
6
|
+
BASE_MESSAGE = "Fail".bg(:red)
|
7
|
+
|
8
|
+
def success?
|
9
|
+
false
|
10
|
+
end
|
11
|
+
|
12
|
+
def pretty
|
13
|
+
message = super
|
14
|
+
entries.each {|entry| message << entry.pretty}
|
15
|
+
message
|
16
|
+
end
|
17
|
+
end
|
data/lib/final_test.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rainbow/refinement'
|
2
|
+
using Rainbow
|
3
|
+
|
4
|
+
class FinalTest
|
5
|
+
def initialize(data)
|
6
|
+
@data = data
|
7
|
+
end
|
8
|
+
|
9
|
+
def success?
|
10
|
+
true
|
11
|
+
end
|
12
|
+
|
13
|
+
def pretty
|
14
|
+
"\nTotal run: #{@data[:succeeded] + @data[:succeededWithWarnings] + @data[:failed] + @data[:notRun]} \n" +
|
15
|
+
"#{"Succeeded".green}: #{@data[:succeeded] + @data[:succeededWithWarnings]} \n" +
|
16
|
+
"#{"Failed".red}: #{@data[:failed]} \n" +
|
17
|
+
"#{"Not run".white}: #{@data[:notRun]} \n" +
|
18
|
+
"#{"Total Time"}: #{@data[:totalDuration]} \n"
|
19
|
+
end
|
20
|
+
end
|
data/lib/parser.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
require_relative './test_entry'
|
4
|
+
require_relative './failed_test'
|
5
|
+
require_relative './successful_test'
|
6
|
+
require_relative './final_test'
|
7
|
+
|
8
|
+
class Parser
|
9
|
+
FAILED_STATE = "Failed"
|
10
|
+
SUCCESS_STATE = "Success"
|
11
|
+
|
12
|
+
def self.parse(file_name)
|
13
|
+
results = eval(File.read(file_name))
|
14
|
+
tests_results = results[:tests]
|
15
|
+
tests = tests_results.map do |test|
|
16
|
+
test_name = test[:testDisplayName]
|
17
|
+
entries = test[:entries].map{|entry| TestEntry.new(entry)}
|
18
|
+
test[:state] == SUCCESS_STATE ? SuccessfulTest.new(test_name, entries) : FailedTest.new(test_name, entries)
|
19
|
+
end
|
20
|
+
tests << FinalTest.new(results)
|
21
|
+
tests
|
22
|
+
end
|
23
|
+
end
|
data/lib/runner.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
require_relative './parser'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
module UE4TestRunner
|
5
|
+
UE4_ROOT = "D:\\UE_4.26"
|
6
|
+
EXECUTABLE_LOCATION = "\\Engine\\Binaries\\Win64\\UE4Editor-Cmd.exe"
|
7
|
+
FLAGS = '-unattended -silent -nopause -NullRHI -testexit="Automation Test Queue Empty" -log -log=RunTests.log'
|
8
|
+
MISSING_FILE_ERROR_MESSAGE = "File does not exists D:"
|
9
|
+
TEST_RESULT_DIR = 'TestResult'
|
10
|
+
|
11
|
+
def run
|
12
|
+
begin
|
13
|
+
puts "Running tests..."
|
14
|
+
system(build_command, :out => File::NULL)
|
15
|
+
file_name = "#{current_directory}\\#{TEST_RESULT_DIR}\\index.json"
|
16
|
+
|
17
|
+
puts "#{file_name}: #{MISSING_FILE_ERROR_MESSAGE}" and return unless File.file?(file_name)
|
18
|
+
|
19
|
+
tests = Parser::parse(file_name)
|
20
|
+
tests.each {|test| puts test.pretty}
|
21
|
+
|
22
|
+
FileUtils.rm_rf("#{current_directory}#{TEST_RESULT_DIR}")
|
23
|
+
rescue RuntimeError
|
24
|
+
puts MISSING_FILE_ERROR_MESSAGE
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def build_command
|
29
|
+
"#{UE4_ROOT}#{EXECUTABLE_LOCATION} #{project_file_path} #{FLAGS} #{tests_command} #{report_outputh_path}"
|
30
|
+
end
|
31
|
+
|
32
|
+
def project_file_path
|
33
|
+
file = Dir.entries(".").select {|file_name| file_name.include?('.uproject')}.first
|
34
|
+
raise MISSING_FILE_ERROR_MESSAGE if file.nil?
|
35
|
+
File.expand_path(file, File.dirname(file))
|
36
|
+
end
|
37
|
+
|
38
|
+
def tests_command
|
39
|
+
"-ExecCmds=\"Automation RunTests #{tests_to_run}\""
|
40
|
+
end
|
41
|
+
|
42
|
+
def tests_to_run
|
43
|
+
ARGV[0]
|
44
|
+
end
|
45
|
+
|
46
|
+
def report_outputh_path
|
47
|
+
"-ReportOutputPath=\"#{current_directory}\\#{TEST_RESULT_DIR}\""
|
48
|
+
end
|
49
|
+
|
50
|
+
def current_directory
|
51
|
+
File.expand_path(File.dirname(__FILE__))
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
data/lib/test_entry.rb
ADDED
data/lib/ue4-test-runner.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ue4-test-runner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Facundo Gerstner
|
@@ -19,6 +19,15 @@ extensions: []
|
|
19
19
|
extra_rdoc_files: []
|
20
20
|
files:
|
21
21
|
- bin/ue4-test-runner.exe
|
22
|
+
- lib/TestResult/index.html
|
23
|
+
- lib/TestResult/index.json
|
24
|
+
- lib/base_test.rb
|
25
|
+
- lib/failed_test.rb
|
26
|
+
- lib/final_test.rb
|
27
|
+
- lib/parser.rb
|
28
|
+
- lib/runner.rb
|
29
|
+
- lib/successful_test.rb
|
30
|
+
- lib/test_entry.rb
|
22
31
|
- lib/ue4-test-runner.rb
|
23
32
|
homepage: http://rubygems.org/gems/ue4-test-runner
|
24
33
|
licenses: []
|