This pull request primarily focuses on improving the execution of the test suite in the CucumberSwift project. The changes ensure that the default test suite is created only once and that tests are invoked only if they haven't run before. Additionally, a new test case has been added to verify this behavior.
Changes made:
Sources/CucumberSwift/Runner/CucumberTest.swift: Implemented a mechanism to ensure that the default test suite is created only once and that tests are invoked only if they haven't run before. This was achieved by introducing a static boolean didRun and a static XCTestSuite instance suiteInstance. didRun is checked before invoking a test and suiteInstance is checked before creating a new test suite. If suiteInstance already exists, it is returned instead of creating a new one.
Tests/CucumberSwiftTests/Reporter/CustomReporterTests.swift: Added a new test case testDefaultSuiteIsCreatedOnlyOnce to verify that the default test suite is indeed created only once. This test case runs a feature file, captures the default test suite before and after execution, and asserts that they are equal.
PR for #88.
This pull request primarily focuses on improving the execution of the test suite in the
CucumberSwift
project. The changes ensure that the default test suite is created only once and that tests are invoked only if they haven't run before. Additionally, a new test case has been added to verify this behavior.Changes made:
Sources/CucumberSwift/Runner/CucumberTest.swift
: Implemented a mechanism to ensure that the default test suite is created only once and that tests are invoked only if they haven't run before. This was achieved by introducing a static booleandidRun
and a staticXCTestSuite
instancesuiteInstance
.didRun
is checked before invoking a test andsuiteInstance
is checked before creating a new test suite. IfsuiteInstance
already exists, it is returned instead of creating a new one.Tests/CucumberSwiftTests/Reporter/CustomReporterTests.swift
: Added a new test casetestDefaultSuiteIsCreatedOnlyOnce
to verify that the default test suite is indeed created only once. This test case runs a feature file, captures the default test suite before and after execution, and asserts that they are equal.