Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass the testing debug data through to formatter for future formatting #338

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/xcpretty/formatters/formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def format_codesign(file); EMPTY; end
def format_preprocess(file); EMPTY; end
def format_pbxcp(file); EMPTY; end
def format_shell_command(command, arguments); EMPTY; end
def format_test_debug_data(time, message); EMPTY; end
def format_test_run_started(name); EMPTY; end
def format_test_run_finished(name, time); EMPTY; end
def format_test_suite_started(name); EMPTY; end
Expand Down
6 changes: 6 additions & 0 deletions lib/xcpretty/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ module Matchers
# $3 = time
TEST_CASE_PASSED_MATCHER = /^\s*Test Case\s'-\[(.*)\s(.*)\]'\spassed\s\((\d*\.\d{3})\sseconds\)/

# @regex Captured groups
# $1 = test run time debug data
# $2 = test run debug message
TEST_CASE_DEBUG_DATA_MATCHER = /^\s+t =\s+(\d+\.\d+s)\s+(.*)$/

# @regex Captured groups
# $1 = suite
Expand Down Expand Up @@ -386,6 +390,8 @@ def parse(text)
formatter.format_pending_test($1, $2)
when TEST_CASE_PASSED_MATCHER
formatter.format_passing_test($1, $2, $3)
when TEST_CASE_DEBUG_DATA_MATCHER
formatter.format_test_debug_data($1, $2)
when PODS_ERROR_MATCHER
formatter.format_error($1)
when PROCESS_INFO_PLIST_MATCHER
Expand Down
6 changes: 6 additions & 0 deletions spec/fixtures/constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
SAMPLE_OCUNIT_SUITE_COMPLETION = "Test Suite '/Users/musalj/Library/Developer/Xcode/DerivedData/ReactiveCocoa-eznxkbqvgfsnrvetemqloysuwagb/Build/Products/Test/ReactiveCocoaTests.octest(Tests)' finished at 2013-12-08 22:09:37 +0000."
SAMPLE_XCTEST_SUITE_COMPLETION = "Test Suite 'ObjectiveSugarTests.xctest' finished at 2013-12-09 04:42:13 +0000."

SAMPLE_UITEST_DEBUG_DATA = %Q(\
Wait for connect to desktop done
t = 19.06s Snapshot accessibility hierarchy for com.vmware.horizon
t = 20.31s Find: Descendants matching type Window
t = 20.32s Find: Elements matching predicate '"rdsh1" IN identifiers'
)
SAMPLE_UITEST_CASE_WITH_FAILURE = %Q(\
Test Case '-[viewUITests.vmtAboutWindow testConnectToDesktop]' started.
t = 0.00s Start Test at 2016-08-18 09:07:17.822
Expand Down
6 changes: 6 additions & 0 deletions spec/xcpretty/parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ module XCPretty
@parser.parse(SAMPLE_COPYSTRINGS)
end

it "parses UITest debug data" do
@formatter.should receive(:format_test_debug_data).with('19.06s', 'Snapshot accessibility hierarchy for com.vmware.horizon')
@parser.parse(SAMPLE_UITEST_DEBUG_DATA)
end


it "parses CpHeader" do
@formatter.should receive(:format_copy_header_file).with(
'/path/to/Header.h', '/some other/path/Header.h')
Expand Down