-2

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.

Sweta Vani
  • 61
  • 9
  • 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 Answers1

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