Property definitions

popcorn $ TestPopcorn :: defaultinit
# TestSuite for Popcorn blackbox testing.
class TestPopcorn

	# Host used to run App.
	var host: String = test_host

	# Port used to run App.
	var port: Int = test_port

	# Directory of the current test suite
	#
	# Useful when your tested app need to load some external files.
	var test_path: String = "NIT_TESTING_PATH".environ.dirname

	# Run the test suite on the App.
	fun run_test(app: App) do
		var server = new AppThread(host, port, app)
		server.start
		0.1.sleep

		var client = new ClientThread(self)
		client.start
		client.join
		0.1.sleep

		exit 0
	end

	# Redefine this method to implement your test scenario.
	fun client_test do end

	# Regex to catch and hide the port from the output to get consistent results
	var host_re: Regex = "localhost:\[0-9\]+".to_re

	# Execute a System function.
	fun system(cmd: String, title: nullable String)
	do
		title = title or else cmd
		title = title.replace(host_re, "localhost:*****")
		print "\n[Client] {title}"
		sys.system cmd
	end
end
lib/popcorn/pop_tests.nit:126,1--168,3