class LearnTest::Strategies::CSharpNunit

Public Instance Methods

check_dependencies() click to toggle source
# File lib/learn_test/strategies/csharp_nunit.rb, line 14
def check_dependencies
  Dependencies::CSharp.new.execute
end
cleanup() click to toggle source
# File lib/learn_test/strategies/csharp_nunit.rb, line 50
def cleanup
  FileUtils.rm('TestResult.xml') if File.exist?('TestResult.xml')
end
detect() click to toggle source
# File lib/learn_test/strategies/csharp_nunit.rb, line 10
def detect
  runner.files.any? { |f| f.match(/project.json/) }
end
output() click to toggle source
# File lib/learn_test/strategies/csharp_nunit.rb, line 27
def output
  @output ||= Crack::XML.parse(File.read('TestResult.xml'))
end
results() click to toggle source
# 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() click to toggle source
# File lib/learn_test/strategies/csharp_nunit.rb, line 18
def run
  require 'crack'
  require 'json'

  system('dotnet test')
  output
  cleanup
end
service_endpoint() click to toggle source
# File lib/learn_test/strategies/csharp_nunit.rb, line 6
def service_endpoint
  '/e/flatiron_csharp_nunit'
end