Contributions to XCStrings Tool are welcome!
-
For ideas and questions: Visit the Discussions
-
For bugs: Open an Issue
-
For contributions: Open a Pull Request
To build and run all test cases open XCStrings Tool with Xcode and hit ⌘U (command + U).
The majority of tests for XCStrings Tool are implemented using snapshot tests. Snapshot tests compare a "snapshot" of the output generated by a previous version of the software with the output generated by a subsequent version. The test is passed if the outputs are the same.
Snapshot testing is handled by the GenerateTests
class. When the snapshot tests are run, XCStrings Tool generates Swift code using the Strings Catalogs in the Fixtures directory. These files are then compared against the previous snapshots in the Snapshots directory.
If there is a discrepancy between a generated Swift file and its corresponding snapshot, the relevant snapshot test will fail. This means that either:
-
A bug has been introduced; or
-
The changes that have been made are expected to generate an "expected diff" (i.e. a new Swift file). In this case you will want to re-record the snapshot by setting
record
totrue
:
record: Bool = false,
(source)
If you want to view the Swift files generated by the snapshot tests:
- Comment out the following line in the trailing closure taken by
addTearDownBlock
in GenerateTests.swift:
try? fileManager.removeItem(at: outputURL)
(source)
- Rerun the tests using command + U in Xcode.
This will prevent the generated Swift files from being removed after the tests are run. The filepath for these files will be printed in the console.
Note
By commenting out this line you will be generating potentially unwanted Swift files every time you run the snapshot tests.
Thanks for your contributions!