Questions tagged [xctestcase]

The primary class for defining test cases, test methods, and performance tests for iOS and Mac OS development.

226 questions
3
votes
0 answers

iOS: xctest (48745) encountered an error (Failed to create a bundle instance representing, Check that the bundle exists on disk

I am getting error in my Jenkin pipeline. Test case running locally but it failed in jenkin pipeline with following error: xctest (48745) encountered an error (Failed to create a bundle instance representing…
3
votes
1 answer

typeText() is typing inconsistent characters

I'm beginning to dip my toes into Swift alongside writing UI tests and am having a problem with typing text into a textField. Below is the code: func testLoginUsernameField() { let app = XCUIApplication() app.launch() let username =…
Bonteq
  • 777
  • 7
  • 24
3
votes
1 answer

How to write unit test cases (XCTest) in UIWebView / WebKit - Swift

I want to write unit test cases (XCTest) in UIWebView/ Webkit- Swift Please post any helpful link, example, or tutorial. Thank you. Shriram
Shriram Kadam
  • 394
  • 1
  • 4
  • 20
3
votes
2 answers

XCUITest - Failed to find matching element

In one of my view controllers, I have code like: class ViewController: UIViewController { @IBOutlet weak var _tableView: UITableView! private lazy var searchBar: UISearchBar = { let searchBar:UISearchBar = UISearchBar() …
x4h1d
  • 6,042
  • 1
  • 31
  • 46
3
votes
2 answers

How to Unit-Test with global structs?

It is clear for me that in a UnitTest you generate an input property pass this property to the method you want to test Compare the results with your expected results However, what if you have a global struct with e.g. the game xp and game level…
Hans Bondoka
  • 437
  • 1
  • 4
  • 14
3
votes
2 answers

XCTest: Can expectationForPredicate fulfill on async variable change?

I'm using expectation(for:evaluatedWith:handler:) to watch a variable in production code for a change, but it's never fulfilled - why? I'd rather not clutter my production code by adding artificial completion blocks or notifications. class…
ozool
  • 94
  • 1
  • 9
3
votes
0 answers

Can we automate testing for in-app purchases in iOS using XCTest ? If yes, then how?

I want to automate the process of making an in-app purchase in an iOS native app using XCTest. Is it possible using XCTest? or any other way? Thanks for help in advance. :)
Gaurav
  • 119
  • 1
  • 10
3
votes
2 answers

Get result of each test case executed in Xcode UI tests

I need the test status after each test case is executed in my test suite in Xcode. I know an observer can help in achieving it. But how do I use it in my tests?
Coder95
  • 159
  • 2
  • 13
3
votes
1 answer

How to iterate through ui table elements of different types in swift

Using XCUITest, is there a way to iterate through a subset of a table in swift that contains both 'Cells' and 'Other'? I know I could do table.otherElements or table.cells to get access to each of those separately, but is there a way to get all…
reutsey
  • 1,743
  • 1
  • 17
  • 36
3
votes
1 answer

XCTestCase not launching application in setUp class method

I am using XCode 8 and XCTestCase. I created a class setUp function to be ran once before all tests, and the other setUp to be ran before each test case. I want the application to be launched once before all test cases. If I use the launch in the…
reutsey
  • 1,743
  • 1
  • 17
  • 36
3
votes
3 answers

How is the setUp() method called before the invocation of each test method?

I'm going through a great book learning about test-driven development in Swift. My ultimate goal is to get a better understanding of OOP architecture. As I'm reading the book, a section early on states that the setUp() method is fired before each…
Laurence Wingo
  • 3,912
  • 7
  • 33
  • 61
3
votes
2 answers

How to run specific tests from one class xcode uitesting

I'm creating ui tests in xcode using XCTest(Swift) How can I run, for example, 2-3 tests from one class without launching the rest of the test from this class? Is it possible to add some tests to suite or run and run from command line just…
vvvvside
  • 31
  • 1
  • 3
3
votes
1 answer

How to use XCTestSuite? (Swift 3)

We have a Jenkins job that runs our iOS UI tests, and I need to be able to ignore some tests (or test classes) based on certain runtime information during a test run. According to the XCTestSuite documentation…
sjalv
  • 33
  • 1
  • 5
3
votes
2 answers

How to override tableview delegate in XCTest

How to write a testcase for this "success" scenario? if ([tblView.delegate respondsToSelector:@selector(tableView:viewForHeaderInSection:)]) { ... }else{ ... } I have tried by creating the below mock delegate in swift: class…
SaRaVaNaN DM
  • 4,390
  • 4
  • 22
  • 30
3
votes
0 answers

How to fix runtime discovered tests ("rT")

In my project that is using Objective-C and Swift I have noticed that suddenly all tests in the Test navigator turned purple with “rT” icon: I did some digging and I found out that they are runtime discovered tests. These tests are not discovered…
sash
  • 8,423
  • 5
  • 63
  • 74
1 2
3
15 16