How to use call method of TestFile Package

Best Rr_ruby code snippet using TestFile.call

test_generate_test_runner.rb

Source:test_generate_test_runner.rb Github

copy

Full Screen

...1152 if (testset[:yaml])1153 File.open("build/runner_options.yml",'w') {|f| f << { :unity => testset[:yaml] }.to_yaml }1154 yaml_option = "build/runner_options.yml"1155 end1156 #run script via command line or through hash function call, as requested1157 if (testset[:cmdline])1158 cmdstr = "ruby ../auto/generate_test_runner.rb #{yaml_option} #{testset[:cmdline]} \"#{testset[:testfile]}\" \"#{runner_name}\""1159 `#{cmdstr}`1160 else1161 UnityTestRunnerGenerator.new(testset[:options]).run(testset[:testfile], runner_name)1162 end1163 #test the script against the specified test file and check results1164 if (runner_test(testset[:testfile], runner_name, testset[:expected], testset[:testdefines], testset[:cmdline_args], testset[:features]))1165 report "#{testset_name}:PASS"1166 else1167 report "#{testset_name}:FAIL"1168 $generate_test_runner_failures += 11169 end1170 $generate_test_runner_tests += 1...

Full Screen

Full Screen

CoolTesterPluginActivation.rb

Source:CoolTesterPluginActivation.rb Github

copy

Full Screen

...33 createEntryMenu("Board tests",testName,testInstance,testClass,testParameters="{}") 34 when /Hal/35 createEntryMenu("Hal tests",testName,testInstance,testClass,testParameters="{}")36 when /Proto/37 # The Call test is specific : use start/end a call icons.38 if testFile=~/Auto_Call/39 cwAddMenuCommand("CoolTester","#{testName}","puts 'Please use phone icons to start/stop a call'",0) 40 # Create phone icons. 41 cwAddScriptButton("CoolTester","myCall=Proto_Auto_Call.new({:start=>0}) ; puts myCall.process ;" , CWIconLib::REDPHONEICON,"Cooltester call")42 cwAddScriptButton("CoolTester","myCall=Proto_Auto_Call.new({:timeout=>10, :start=>1, :number=>'112'}) ; puts myCall.process ;" , CWIconLib::GREENPHONEICON,"Cooltester call 112")43 else44 createEntryMenu("Proto tests",testName,testInstance,testClass,testParameters="{}") 45 end 46 if testFile=~/Multi_MO/47 cwAddMenuCommand("CoolTester","#{testName}","puts 'Please use phone icons to start/stop a Multi call'",0) 48 # Create phone icons. 49 cwAddScriptButton("CoolTester","myCall=Proto_Auto_Multi_MO.new({ :nbr_of_mo=>5, :call_number=>'888'}) ; puts myCall.process ;" , CWIconLib::GREENPHONEICON,"Cooltester call multi 888")50 end51 else52 53 end #end case54 55 end56 57 def CoolTesterPluginActivation.buildHelpMenu58 coolTesterWebPlatformURL='http://atlas/~cooltester/'59 60 cwAddMenuCommand("CoolTester","","",0)61 cwAddMenuCommand("CoolTester","Tests description",62 "openUrl('#{coolTesterWebPlatformURL}tests.php')",0)63 cwAddMenuCommand("CoolTester","Scenarii description",64 "openUrl('#{coolTesterWebPlatformURL}scenarii.php')",0)65 cwAddMenuCommand("CoolTester","Reports publication",66 "openUrl('#{coolTesterWebPlatformURL}reports.php')",0)67 end68 69 70 #####################################71 # Public section #72 #####################################73 74 public75 76 # Add all paths stored in pathsArray to mainPath.77 # Can raise a CT_Plugin_Activ_Err exception.78 def CoolTesterPluginActivation.addLoadPaths(mainPath, pathsArray)79 begin80 pathsArray.each do | pathToAdd |81 puts "html><font color='blue'>" + "Add path #{pathToAdd}" + "</font>"82 mainPath << pathToAdd83 end84 rescue85 # An error ocurred in the addLoadPaths process.86 # Raise a CT_Plugin_Activ_Err exception.87 raise CT_Plugin_Activ_Err , "Adding load paths error : #{$!}" 88 end89 end90 91 # Load all ruby scripts in userTestPath directory.92 # Create CW menus : Board tests, Hal tests, GSM tests, Others tests with tests ready to be processed.93 # Tests parameters will be the defaults ones.94 # Can raise a CT_Plugin_Activ_Err exception.95 def CoolTesterPluginActivation.loadUserTests(userTestPath)96 97 allTestsLoadSuccessfully=true98 99 begin100 # Open userTestPath directory. 101 puts "html><font color='blue'>" + "Opening #{userTestPath}..." + "</font>"102 testsDirectory=Dir.open(userTestPath).sort103 puts "Done successfully"104 105 testsList = []106 107 # Create an array of users tests, removing dismissed files.108 Find.find(userTestPath) do |path|109 testsList << path.split("/")[-1] if(path[-3..-1]==".rb")110 end111 112 puts "html><font color='blue'>"+"Loading tests...\n" + "</font>"113 114 testsList.each do |testFile|115 puts "html><font color='blue'>"+"Loading '"+testFile+"'..." + "</font>"116 117 # Load test file and add it to the menu.118 begin119 load testFile 120 # If the load is succesful, we add the test to @@TestsLoadsuccessfully array.121 @@TestsLoadsuccessfully<< testFile122 puts "Done successfully" 123 rescue 124 puts "html><font color='red'>"+ "Failed !" + "</font>"125 # Print the detail.126 puts "#{$!}"127 allTestsLoadSuccessfully=false128 # Keep trying to load the following tests...129 end 130 131 end 132 133 rescue134 # An error occurred while opening user test directory.135 puts "html><font color='red'>"+ "Failed !" + "</font>"136 # Print error detail.137 puts "#{$!}"138 raise CT_Plugin_Activ_Err , "Opening #{userTestPath} directory failed" 139 end140 141 # A user test directory has been open correctly.142 # Check is one user test script failed while loading.143 # If yes, raise a CT_Plugin_Activ_Err to warn the caller.144 if allTestsLoadSuccessfully==false 145 raise CT_Plugin_Activ_Err , "One or more tests failed while loading"146 end147 148 end149 150 def CoolTesterPluginActivation.createTestsHelp(tests_list_file,tests_content_file)151 puts "html><font color='blue'>"+"Generating Tests Help..."+ "</font>"152 begin153 TestsHelp.saveToFiles(tests_list_file,tests_content_file)154 puts "Generating Tests Help done successfully" 155 rescue TestsHelp_Err156 puts "html><font color='red'>"+ "Generating Tests Help failed !" + "</font>"157 raise CT_Plugin_Activ_Err , "#{$!}"...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful