function TestBootstrap.run(B,I,q,H)q=q or TextReporter H=H or{}local A=H.showTimingInfo or false local i=H.testNamePattern local w=H.extraEnvironment or{}if type(I)~="\116\097\098\108\101"then error(("\066\097\100 \097\114\103\117\109\101\110\116 \035\049 \116\111 \084\101\115\116\066\111\111\116\115\116\114\097\112\058\114\117\110\046 \069\120\112\101\099\116\101\100 \116\097\098\108\101\044 \103\111\116 \037\115"):format(typeof(I)),2)end local O=tick()local e={}for I,q in ipairs(I)do local H=B:getModules(q)for I,q in ipairs(H)do table.insert(e,q)end end local g=tick()local p=TestPlanner.createPlan(e,i,w)local R=tick()local V=TestRunner.runPlan(p)local n=tick()q.report(V)local x=tick()if A then local I={("\084\111\111\107 \037\102 \115\101\099\111\110\100\115 \116\111 \108\111\099\097\116\101 \116\101\115\116 \109\111\100\117\108\101\115"):format(g-O),("\084\111\111\107 \037\102 \115\101\099\111\110\100\115 \116\111 \099\114\101\097\116\101 \116\101\115\116 \112\108\097\110"):format(R-g),("\084\111\111\107 \037\102 \115\101\099\111\110\100\115 \116\111 \114\117\110 \116\101\115\116\115"):format(n-R),("\084\111\111\107 \037\102 \115\101\099\111\110\100\115 \116\111 \114\101\112\111\114\116 \116\101\115\116\115"):format(x-n)}print(table.concat(I,"\n"))end return V end return TestBootstrap
--[[
	Runs all test and reports the results using the given test reporter.

	If no reporter is specified, a reasonable default is provided.

	This function demonstrates the expected workflow with this testing system:
	1. Locate test modules
	2. Generate test plan
	3. Run test plan
	4. Report test results

	This means we could hypothetically present a GUI to the developer that shows
	the test plan before we execute it, allowing them to toggle specific tests
	before they're run, but after they've been identified!
]]
function TestBootstrap:run(roots, reporter, otherOptions)
	reporter = reporter or TextReporter

	otherOptions = otherOptions or {}
	local showTimingInfo = otherOptions["showTimingInfo"] or false
	local testNamePattern = otherOptions["testNamePattern"]
	local extraEnvironment = otherOptions["extraEnvironment"] or {}

	if type(roots) ~= "table" then
		error(("Bad argument #1 to TestBootstrap:run. Expected table, got %s"):format(typeof(roots)), 2)
	end

	local startTime = tick()

	local modules = {}
	for _, subRoot in ipairs(roots) do
		local newModules = self:getModules(subRoot)

		for _, newModule in ipairs(newModules) do
			table.insert(modules, newModule)
		end
	end

	local afterModules = tick()

	local plan = TestPlanner.createPlan(modules, testNamePattern, extraEnvironment)
	local afterPlan = tick()

	local results = TestRunner.runPlan(plan)
	local afterRun = tick()

	reporter.report(results)
	local afterReport = tick()

	if showTimingInfo then
		local timing = {
			("Took %f seconds to locate test modules"):format(afterModules - startTime),
			("Took %f seconds to create test plan"):format(afterPlan - afterModules),
			("Took %f seconds to run tests"):format(afterRun - afterPlan),
			("Took %f seconds to report tests"):format(afterReport - afterRun),
		}

		print(table.concat(timing, "\n"))
	end

	return results
end

return TestBootstrap
