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
48
49
50
|
# File 'lib/learn_test/strategies/csharp_nunit.rb', line 48
def cleanup
FileUtils.rm("TestResult.xml") if File.exist?("TestResult.xml")
end
|
#detect ⇒ Object
8
9
10
|
# File 'lib/learn_test/strategies/csharp_nunit.rb', line 8
def detect
runner.files.any? {|f| f.match(/project.json/)}
end
|
#output ⇒ Object
25
26
27
|
# File 'lib/learn_test/strategies/csharp_nunit.rb', line 25
def output
@output ||= Crack::XML.parse(File.read('TestResult.xml'))
end
|
#results ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/learn_test/strategies/csharp_nunit.rb', line 29
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
16
17
18
19
20
21
22
23
|
# File 'lib/learn_test/strategies/csharp_nunit.rb', line 16
def run
require 'crack'
require 'json'
system("dotnet test")
output
cleanup
end
|
#service_endpoint ⇒ Object
4
5
6
|
# File 'lib/learn_test/strategies/csharp_nunit.rb', line 4
def service_endpoint
'/e/flatiron_csharp_nunit'
end
|