Class: LearnTest::Strategies::CSharpNunit
Instance Attribute Summary
#options, #runner
Instance Method Summary
collapse
#argv, #configure, #die, #initialize, #learn_oauth_token, #push_results?, #run_install, #user_id, #username
Instance Method Details
#check_dependencies ⇒ Object
#cleanup ⇒ Object
50
51
52
|
# File 'lib/learn_test/strategies/csharp_nunit.rb', line 50
def cleanup
FileUtils.rm('TestResult.xml') if File.exist?('TestResult.xml')
end
|
#detect ⇒ Object
10
11
12
|
# File 'lib/learn_test/strategies/csharp_nunit.rb', line 10
def detect
runner.files.any? { |f| f.match(/project.json/) }
end
|
#output ⇒ Object
27
28
29
|
# File 'lib/learn_test/strategies/csharp_nunit.rb', line 27
def output
@output ||= Crack::XML.parse(File.read('TestResult.xml'))
end
|
#results ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/learn_test/strategies/csharp_nunit.rb', line 31
def results
{
username: username,
github_user_id: user_id,
repo_name: runner.repo,
build: {
test_suite: [{
framework: 'nunit',
formatted_output: output.to_json,
duration: output['test_run']['duration']
}]
},
examples: output['test_run']['total'],
passing_count: output['test_run']['passed'],
pending_count: output['test_run']['skipped'],
failure_count: output['test_run']['failed'],
}
end
|
#run ⇒ Object
18
19
20
21
22
23
24
25
|
# File 'lib/learn_test/strategies/csharp_nunit.rb', line 18
def run
require 'crack'
require 'json'
system('dotnet test')
output
cleanup
end
|
#service_endpoint ⇒ Object
6
7
8
|
# File 'lib/learn_test/strategies/csharp_nunit.rb', line 6
def service_endpoint
'/e/flatiron_csharp_nunit'
end
|