<commit_before>require "connectQtest/version"
require "rest-client"
require "oauth"
require "json"

class Qtest
  # Your code goes here...
  $projectid = 0 #your project Id
 
	def QtestPostTestResult (name,runid,failMessage) 

	    startdate = DateTime.now 
	    enddate = DateTime.now 

	    puts "Uploading ..... Testcase"
	    puts name
	    $id = runid
	    puts $id

	    response = RestClient::Request.execute(
	      method: :post, 
	      url: "https://mobiquity.qtestnet.com/api/v3/projects/#$projectid/test-runs/#$id/auto-test-logs",
	      payload:{                 
	          "name" => name,   
	          "automation_content" => "sample-demo-api-AutomationTestLog",   
	          "status" => failMessage  ? "PASS" : "FAIL",
	          "exe_start_date" => startdate,    
	          "exe_end_date" => enddate,  
	          "note" => failMessage ? "Testcase is passed" : "Testcase is failed"
	        }.to_json,

	          headers:{
	            "Content-Type"=> "application/json",
	            "Cache-Control" => "no-cache",
	            "verify_ssl" => "OpenSSL::SSL::VERIFY_NONE",
	            "Authorization" => "<KEY>"
	        }
	    )

	    puts "response code :"
	    puts response.code<commit_msg>Version 1.3<commit_after>require "connectQtest/version"
require "rest-client"
require "oauth"
require "json"

class Qtest
  # Your code goes here...
  $projectid = 0 #your project Id
  $qtesturl
  $id = 0
	def QtestPostTestResult (name,runid,failMessage) 

	    startdate = DateTime.now 
	    enddate = DateTime.now 

	    puts "Uploading ..... Testcase"
	    puts name
	    $id = runid
	    puts $id

	    response = RestClient::Request.execute(
	      method: :post, 
	      url: "#$qtesturl/api/v3/projects/#$projectid/test-runs/#$id/auto-test-logs",
	      payload:{                 
	          "name" => name,   
	          "automation_content" => "sample-demo-api-AutomationTestLog",   
	          "status" => failMessage  ? "PASS" : "FAIL",
	          "exe_start_date" => startdate,    
	          "exe_end_date" => enddate,  
	          "note" => failMessage ? "Testcase is passed" : "Testcase is failed"
	        }.to_json,

	          headers:{
	            "Content-Type"=> "application/json",
	            "Cache-Control" => "no-cache",
	            "verify_ssl" => "OpenSSL::SSL::VERIFY_NONE",
	            "Authorization" => "<KEY>"
	        }
	    )

	    puts "response code :"
	    puts response.code
{'fraction_non_alphanumeric': 0.1358784893267652, 'fraction_numerical': 0.0028735632183908046, 'mean_word_length': 2.027329192546584, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5481308', 'n_tokens_mistral': 825, 'n_tokens_neox': 755, 'n_words': 157}