Skip to content

Commit

Permalink
Update documentation for the API options.
Browse files Browse the repository at this point in the history
  • Loading branch information
thomthom committed Jun 20, 2024
1 parent 58620a6 commit d527b1d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/testup/api.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#-------------------------------------------------------------------------------
#
# Copyright 2013-2018 Trimble Inc.
# Copyright 2013-2024 Trimble Inc.
# License: The MIT License (MIT)
#
#-------------------------------------------------------------------------------
Expand All @@ -27,6 +27,10 @@ module API
#
# @param [TestUp::Report::TestSuite, Pathname, String] test_suite
# @param [Hash] config
# @option config [String] 'Seed' Integer numeric for the Minitest random seed.
# @option config [String] 'Verbose' Turns on verbose reporting if key is present.
# @option config [String] 'Output' JSON file to output results to.
# @option config [Array] 'Tests'
def self.run_suite_without_gui(test_suite, config = {})
test_suite_path = if test_suite.is_a?(TestUp::Report::TestSuite)
Pathname.new(test_suite.path)
Expand Down Expand Up @@ -70,22 +74,33 @@ def self.run_suite_without_gui(test_suite, config = {})
end

# @example Run a test case:
# TestUp.run_tests(["TC_Sketchup_Edge#"])
# TestUp::API.run_tests(["TC_Sketchup_Edge#"], path: path)
#
# @example Run single test:
# TestUp.run_tests(["TC_Sketchup_Edge#start"])
# TestUp::API.run_tests(["TC_Sketchup_Edge#start"], path: path)
#
# @example Run a set of test cases and/or tests:
# tests = [
# "TC_Sketchup_Face#",
# "TC_Sketchup_Edge#start", "TC_Sketchup_Edge#end"
# ]
# TestUp.run_tests(tests)
# path = "path/to/testsuite/"
# TestUp::API.run_tests(tests, path: path)
#
# @todo The `path` parameter is not optional.
# @todo The `title` parameter should be extracted from the path.
#
# @param [Array<String>] tests list of tests or test cases to run.
# @param [String] title Name of test_suite
# @param [String] path Path to the test_suite
# @param [Hash] options
# @option options [Boolean] :show_console Open the Ruby Console before running tests.
# @option options [Boolean] :clear_console Clear the Ruby Console before running tests.
# @option options [Boolean] :ci Generate JSON report to STDOUT.
# @option options [String] :ci_out Pipe JSON report to file.
# @option options [Boolean] :ui Update the TestUp dialog.
# @option options [Integer] :seed Set the randomization seed for Minitest.
# @option options [Boolean] :verbose
# @yield [Report::TestSuite]
# @return [Boolean]
def self.run_tests(tests, title: 'Untitled', path: nil, options: {})
Expand Down
15 changes: 15 additions & 0 deletions src/testup/test_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ def initialize(title: 'Untitled', path: nil)

# @param [Array<String>] tests
# @param [Hash] options
# @option options [Boolean] :ci Generate JSON report to STDOUT.
# @option options [String] :ci_out Pipe JSON report to file.
# @option options [Boolean] :ui Update the TestUp dialog.
# @option options [Integer] :seed Set the randomization seed for Minitest.
# @option options [Boolean] :verbose
# @yield [Array<Report::TestSuite>]
# return [Boolean]
def run(tests, options = {})
Expand All @@ -40,6 +45,11 @@ def run(tests, options = {})

# @param [Array<String>] tests
# @param [Hash] options
# @option options [Boolean] :ci Generate JSON report to STDOUT.
# @option options [String] :ci_out Pipe JSON report to file.
# @option options [Boolean] :ui Update the TestUp dialog.
# @option options [Integer] :seed Set the randomization seed for Minitest.
# @option options [Boolean] :verbose
# return [nil]
def run_tests(tests, options)
TestUp::FileReporter.set_run_info(@title, @path) # Hack!
Expand All @@ -64,6 +74,11 @@ def run_tests(tests, options)

# @param [Array<String>] tests
# @param [Hash] options
# @option options [Boolean] :ci Generate JSON report to STDOUT.
# @option options [String] :ci_out Pipe JSON report to file.
# @option options [Boolean] :ui Update the TestUp dialog.
# @option options [Integer] :seed Set the randomization seed for Minitest.
# @option options [Boolean] :verbose
# return [Array<String>]
def minitest_arguments(tests, options)
arguments = []
Expand Down

0 comments on commit d527b1d

Please sign in to comment.