i have implemented XCTest case for each module and i'm looking for how to know that launch Image is added in xcasset using xctest case.
Asked
Active
Viewed 67 times
-2
-
I upvoted the Frankenstein's answer, but want to notice that UI Tests are not designed for checks like this. If you tell more about your task, maybe you will find a better solution. – Roman Zakharov Jul 03 '20 at 13:56
1 Answers
2
Not entirely sure what you're going for here.
You could check if LaunchImage
is available by checking the bundle images for the name.
func checkIfLaunchImageAvailable() -> Bool {
for imageName in Bundle.main.paths(forResourcesOfType: "png", inDirectory: nil) {
if imageName.contains("LaunchImage"), UIImage(named: imageName) != nil {
print("Launch image is available!")
return true
}
}
return false
}
And could check using XCTAssertTrue
:
XCTAssertTrue(checkIfLaunchImageAvailable)

Frankenstein
- 15,732
- 4
- 22
- 47
-
You're welcome! Don't forget to upvote and mark as right if it helped. – Frankenstein Jul 09 '20 at 10:42