3

Just learning Test Driven Development in Swift.I created a class that is subclass of XCTestCase in the "ProjectNameTests" group.

    class BasicFunctionTest: XCTestCase {

        var values : [Int]?
        override func setUp() {
            super.setUp()
            // Put setup code here. This method is called before the invocation of each test method in the class.

        }

        override func tearDown() {
            // Put teardown code here. This method is called after the invocation of each test method in the class.
            super.tearDown()
        }

        func testExample() {
            // This is an example of a functional test case.
            XCTAssert(true, "Pass")
        }

        func testPerformanceExample() {
            // This is an example of a performance test case.
            self.measureBlock() {
                // Put the code you want to measure the time of here.
                for i in 1...100000{

                    println("ok i need to know the time for execution")


                }
            }
        }
}

I want to perform performance testing of these method

func testPerformanceExample() {
    // This is an example of a performance test case.
    self.measureBlock() {
        // Put the code you want to measure the time of here.
        for i in 1...100000{

            println("ok i need to know the time for execution")


        }
    }
}

and want to find out the time for execution of the for loop.I run the project on going to Product -> Perform Action - > Test Without Building.

I can see the execution time as 3.50 sec but when i try to set the baseline clicking on the Stroke Area as below image:

enter image description here

I get warning as as

Would you like to update the baseline values for all tests on all devices? You'll have a chance to review the changes the next time you commit to source control.

Now when i click on Update the error is as below:

enter image description here

How can i set Baseline of the time for my specific method as Here

Here is my test project : https://drive.google.com/file/d/0Bzk4QVQhnqKmUzYyclp6ZnJvekE/view?usp=sharing

1 Answer 1

1

Can you check whether BasicFunctionTest file Target membership includes your test target. You should be able to check this by selecting the file and navigating to File Inspector (target membership).

Sign up to request clarification or add additional context in comments.

5 Comments

thanks for your response....i double checked it.....and its done...i have uploaded my project..please see my question
strange, I just tried the same step and was able to update the baseline.
did you just tried in the demo project that i have created??which xcode version are you using?
Yes the same UnitTesting project, Xcode version is 6.4
i just downloaded xcode 6.4 and tested ..well everything is fine..my bad was using xcode 6.3 although having few bugs in it :) any thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.