/GHUnitIOS.framework/Versions/A/Headers/GHTestSuite.h

http://github.com/zwaldowski/BlocksKit · C++ Header · 118 lines · 13 code · 16 blank · 89 comment · 0 complexity · 30febeed831a02745b8e07b3eeccf131 MD5 · raw file

  1. //
  2. // GHTestSuite.h
  3. // GHUnit
  4. //
  5. // Created by Gabriel Handford on 1/25/09.
  6. // Copyright 2009. All rights reserved.
  7. //
  8. // Permission is hereby granted, free of charge, to any person
  9. // obtaining a copy of this software and associated documentation
  10. // files (the "Software"), to deal in the Software without
  11. // restriction, including without limitation the rights to use,
  12. // copy, modify, merge, publish, distribute, sublicense, and/or sell
  13. // copies of the Software, and to permit persons to whom the
  14. // Software is furnished to do so, subject to the following
  15. // conditions:
  16. //
  17. // The above copyright notice and this permission notice shall be
  18. // included in all copies or substantial portions of the Software.
  19. //
  20. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  21. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  22. // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  23. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  24. // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  25. // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  26. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  27. // OTHER DEALINGS IN THE SOFTWARE.
  28. //
  29. //! @cond DEV
  30. #import "GHTestGroup.h"
  31. /*!
  32. If set, will run it as a "test filter" like the env variable TEST.
  33. */
  34. extern NSString *GHUnitTest;
  35. /*!
  36. Test suite is an alias for test group.
  37. A test case is an instance of a test case class with test methods.
  38. A test is a id<GHTest> which represents a target and a selector.
  39. A test group is a collection of tests; A collection of id<GHTest> (GHTest or GHTestGroup).
  40. For example, if you have 2 test cases, GHTestCase1 (with some test methods) and GHTestCase2 (with some test methods),
  41. your test suite might look like:
  42. "Tests" (GHTestSuite)
  43. GHTestGroup (collection of tests from GHTestCase1)
  44. - (void)testA1 (GHTest with target GHTestCase1 + testA1)
  45. - (void)testA2 (GHTest with target GHTestCase1 + testA2)
  46. GHTestGroup (collection of tests from GHTestCase2)
  47. - (void)testB1; (GHTest with target GHTestCase2 + testB1)
  48. - (void)testB2; (GHTest with target GHTestCase2 + testB2)
  49. */
  50. @interface GHTestSuite : GHTestGroup { }
  51. /*!
  52. Create test suite with test cases.
  53. @param name Label to give the suite
  54. @param testCases Array of init'ed test case classes
  55. @param delegate
  56. */
  57. - (id)initWithName:(NSString *)name testCases:(NSArray *)testCases delegate:(id<GHTestDelegate>)delegate;
  58. /*!
  59. Creates a suite of all tests.
  60. Will load all classes that subclass from GHTestCase, SenTestCase or GTMTestCase (or register test case class).
  61. @result Suite
  62. */
  63. + (GHTestSuite *)allTests;
  64. /*!
  65. Create suite of tests with filter.
  66. This is useful for running a single test or all tests in a single test case.
  67. For example,
  68. 'GHSlowTest' -- Runs all test method in GHSlowTest
  69. 'GHSlowTest/testSlowA -- Only runs the test method testSlowA in GHSlowTest
  70. @param testFilter Test filter
  71. @result Suite
  72. */
  73. + (GHTestSuite *)suiteWithTestFilter:(NSString *)testFilter;
  74. /*!
  75. Create suite of tests that start with prefix.
  76. @param prefix If test case class starts with the prefix; If nil or empty string, returns all tests
  77. @param options Compare options
  78. */
  79. + (GHTestSuite *)suiteWithPrefix:(NSString *)prefix options:(NSStringCompareOptions)options;
  80. /*!
  81. Suite for a single test/method.
  82. @param testCaseClass
  83. @param method
  84. @result Suite
  85. */
  86. + (GHTestSuite *)suiteWithTestCaseClass:(Class)testCaseClass method:(SEL)method;
  87. /*!
  88. Return test suite based on environment (TEST=TestFoo/foo)
  89. @result Suite
  90. */
  91. + (GHTestSuite *)suiteFromEnv;
  92. @end
  93. @interface GHTestSuite (JUnitXML)
  94. - (BOOL)writeJUnitXML:(NSError **)error;
  95. @end
  96. //! @endcond