The primary class for defining test cases, test methods, and performance tests for iOS and Mac OS development.
Questions tagged [xctestcase]
226 questions
0
votes
1 answer
How to iterate over test data, then pass to XCTestCase?
I have several versions (IOS, JavaScript, Android) of the same calculator that have to produce the same result on every platform.
I have developed a set of test data, spread across multiple data sets like:
onedigit.json:
{n1: 1, n2: 2, a: 3},
…

ssteinerX
- 191
- 1
- 6
0
votes
1 answer
Do we need to write UI test case for Login?
Question :
While writing UI Test cases for app do i need to write test case for login also ?
Already Done :
As currently i have written test cases for various scenarios but if i Will not login in app and run the test cases then all my test cases…

Nik
- 1,679
- 1
- 20
- 36
0
votes
2 answers
iOS Unit Test on switch case
I'm a beginner in Unit Test and I would like to test my cases in a switch but I don't know how to do it.
I have :
- (void)testClickSmiley
{
[self.viewController click:nil];
// Here What i do ? I use what kind of XCTest Assertions ? I want…

Aximem
- 714
- 8
- 27
0
votes
1 answer
How to use expectationForPredicate with a XCUIElementQuery UISwitch
How to write a UI Test (XCTestCase) that waits for a UISwitch to be enabled.
I added this code to one of my tests but it timed out:
let firstSwitch = XCUIApplication().switches.elementBoundByIndex(0)
_ = self.expectationForPredicate(
…

izik lisbon
- 121
- 2
- 4
0
votes
1 answer
XCTest with custom UICollectionViewCell
I am not able to get UI Testing record a custom UICollectionViewCell selection.
How to do it? Is it supported?
Below is the code automatically generated when i tapped first cell.
I am setting these properties too:
in…

Akshit Zaveri
- 4,166
- 6
- 30
- 59
0
votes
0 answers
How to fail a async XCTestCase which crashes the test before calling completionHandler block?
I am doing iOS unit testing using XCTestCase and I am getting a crash due to "unrecognized selector" on async web service handler which returns manipulated NSDictionary by means of completionHandler block.
The crash is not my expectation for…

The Debugger
- 330
- 8
- 19
-1
votes
1 answer
Swift XCTestCase default examples now says "throws" on each test function
so I'm a seasoned iOS developer and I noticed something that I didn't notice before which is when you make a new XCTestCase class it's example test functions all has this new word "throws" at the end, and I was just wondering why (because I never…

Morgan.J.Kennedy
- 117
- 1
- 8
-1
votes
1 answer
API violation - multiple calls made to -[XCTestExpectation fulfill], How can i solve this problem
I'm writing unit test for my codes which using Combine framework
i have a async operation, so i use expectation(descrption:) to wait async operation
this is my code example
class MyViewModel {
private var someOtherSubject:…

PrepareFor
- 2,448
- 6
- 22
- 36
-1
votes
1 answer
Why isn't +setup in my testcases being called when I create a custom test suite with XCTest?
I have a subclass of XCTestSuite that I instantiate and populate with tests on the fly:
+ (XCTestSuite *)defaultTestSuite {
MySuite *suite = [[MySuite alloc] initWithName:@"suite"];
[suite addTest:[[MyTestCase alloc]…

dmaclach
- 3,403
- 1
- 21
- 23
-1
votes
1 answer
XCUITest: Failed ( Thread 1: EXC_BAD_ACCESS (code=1, address=0x0) ) when trying click on text field
I'm getting this error on the XCUITest when trying click on text field: (i'm using Xcode Version 9.4.1 )
Thread 1: EXC_BAD_ACCESS (code=1, address=0x0)
This the unit Test:
let app = XCUIApplication()
let textField =…

Qusai Dahboor
- 114
- 7
-1
votes
1 answer
Try-catch like feature for uncertain code block in Swift 4
I am writing a test in XCUITest. There is an introductory banner which may or may not come on the mobile screen while my test is in progress. I want to write my case in such a way that, if the banner is present, I have to verify certain elements on…

Amit Jathar
- 319
- 3
- 14
-1
votes
1 answer
How to access Two switches (elements) individually inside a tableview cell in UI Testing
I am in UI Testing one of my screen of my project. I have a tableview one of its cell is containing one and two switches.I am able to access the first cell's switch (element) easily by
let tablesQuery = app.tables
let…

iNoob
- 144
- 1
- 15
-2
votes
1 answer
How to check launch image is added in application using XCUITest?
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
-2
votes
1 answer
Generic parameter 'T' could not be inferred when XCTAssertEqual() called
The topic title is a compiler error related to the xCode Assert Equal test in the testPrimesUpTo100ShouldBe25() method.
One thing I noticed is that the call to the calculate() method in PrimeCalculator, when called from testPrimePerformance() and…

Tirna
- 383
- 1
- 12
-2
votes
1 answer
Xcode unit test fail runnings immediately (without)
My project's unit test fails even before running!:
I've cleaned the build director, restarted simulator, tried on the device, disabled code signing, restarted Xcode...everything!
I cmd-u, cmd-ctrl-u, and it fails immediately.
I use CocoaPods, so…

Alterecho
- 665
- 10
- 25