Skip to content

Does not handle Test Suite names with spaces #15

@e28eta

Description

@e28eta

I'm having trouble with one of my projects, because it has a test suite with a space in the name.

Here's an example of the relevant output:

[DEBUG] Test Suite 'All tests' started at 2013-06-18 00:59:57 +0000
Test Suite '/Users/e28eta/source/MyApp/build/Ad Hoc-iphonesimulator/MyAppTests.octest(Tests)' started at 2013-06-18 00:59:57 +0000
Test Suite 'MyApp Tests' started at 2013-06-18 00:59:57 +0000
Test Case '-[MyAppTest someTestCase]' started.

Results in the following error:

/Users/e28eta/bin/ocunit2junit.rb:158:in `handle_test_passed': undefined method `+' for nil:NilClass (NoMethodError)
    from /Users/e28eta/bin/ocunit2junit.rb:80:in `parse_input'
    from /Users/e28eta/bin/ocunit2junit.rb:50:in `each'
    from /Users/e28eta/bin/ocunit2junit.rb:50:in `parse_input'
    from /Users/e28eta/bin/ocunit2junit.rb:44:in `initialize'
    from /Users/e28eta/bin/ocunit2junit.rb:186:in `new'
    from /Users/e28eta/bin/ocunit2junit.rb:186

It dies on @total_passed_test_cases += 1 because:

  • handle_start_test_suite was never called, because the Test Suite name regex doesn't accept spaces
  • and, all three of the initial Test Suite lines in my output have a space.

The reason I have a space in 'MyApp Tests' is because we're manually setting up a suite:

SenTestSuite *suite = [SenTestSuite testSuiteWithName:@"MyApp Tests"];

So it looks like I can work around it (remove the space). However, it'd be nice if that wasn't necessary.

I'm too unfamiliar with OCUnit's output to know whether it's safe to simply change the Test Suite regex to something like this:

when /Test Suite '([^']+)'.*started at\s+(.*)/

or if that would break something else. Do you know?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions