Git Product home page Git Product logo

Comments (50)

cojoj avatar cojoj commented on July 17, 2024

Well, that's not good but I there are some methods in which I see no sense of covering them with unit tests. What's more, some methods are't totally clear for me because of their dependencie, so I skip them as I cn't write propert tests for them 😭


I was thinking this morning about integrating Travis-CI. What'd you say @czechboy0?


Also, found this cool thing called coveralls πŸ˜ƒ

from xcodeserversdk.

czechboy0 avatar czechboy0 commented on July 17, 2024

They still don't have Xcode 7 support.

from xcodeserversdk.

cojoj avatar cojoj commented on July 17, 2024

from xcodeserversdk.

czechboy0 avatar czechboy0 commented on July 17, 2024

Their sluggish new Xcode version support is the whole reason Buildasaur exists πŸ˜†

from xcodeserversdk.

czechboy0 avatar czechboy0 commented on July 17, 2024

But yeah once Travis has Xcode 7 support, I'd be up for using it for testing and coverage. No idea how long that will take however.

from xcodeserversdk.

czechboy0 avatar czechboy0 commented on July 17, 2024

In the meantime we have Xcode 7's code coverage metric, so run it locally and report it in each PR, so that we know what we're at.

from xcodeserversdk.

cojoj avatar cojoj commented on July 17, 2024

There's no school like the oldschool... πŸ˜†

from xcodeserversdk.

cojoj avatar cojoj commented on July 17, 2024

I've seen test coverage for XcodeServer but all of them have DEV_ prefix so they're not rally doing anything at the moment. @czechboy0 is this on purpose? I wonder if DVR integration is ready and I can use it to implement new test cases?

from xcodeserversdk.

czechboy0 avatar czechboy0 commented on July 17, 2024

Yes, the DEV_ prefix is there on purpose. Those are live tests that actually affect and call the real server and I use it during development. So they need to be disabled most of the time unless you're testing live API calls.

And yes, DVR is ready. Just run carthage update --no-build and you're all set. I also added a folder just for Cassettes in the test target/folder.

from xcodeserversdk.

cojoj avatar cojoj commented on July 17, 2024

Hmm, any possibility you write steps needed to use DVR? I how now idea where to put my hands on 😞

from xcodeserversdk.

czechboy0 avatar czechboy0 commented on July 17, 2024

Look at test DEV_testLive_FetchAndRecordBot() in XcodeServerTests.

Create a test like that for whatever you want to test. Then you run it once and it records and crashes, printing out where it has saved the cassette. You copy that file into the test target in the Cassettes folder, add it to the project to both test targets only and then run it again. This time it will run fine, using the loaded cassette.

from xcodeserversdk.

cojoj avatar cojoj commented on July 17, 2024

Great, but it's easy for GETs, so how about POSTs? Do I have to manually remove added entities?

from xcodeserversdk.

cojoj avatar cojoj commented on July 17, 2024

With #48 we get 25% of test coverage for XcodeServerSDK... Slowly getting more and more πŸ‘

from xcodeserversdk.

esttorhe avatar esttorhe commented on July 17, 2024

Have we checked asking for CircleCI access instead of Travis maybe?

from xcodeserversdk.

cojoj avatar cojoj commented on July 17, 2024

Isn't CirlceCI paid?

from xcodeserversdk.

czechboy0 avatar czechboy0 commented on July 17, 2024

Yeah I tried them all yesterday. They don't yet support Xcode 7 :( Classic.

from xcodeserversdk.

cojoj avatar cojoj commented on July 17, 2024

Travis today has confirmed official support from 6.4...

from xcodeserversdk.

czechboy0 avatar czechboy0 commented on July 17, 2024

Link? But that doesn't help anyway. We need Xcode 7. Hopefully I'll be able to release an experimental build of Buildasaur soon locally on my Mac to get PR testing again.

from xcodeserversdk.

cojoj avatar cojoj commented on July 17, 2024

We just added support for Xcode 6.4 and the iOS 8.4 SDK! Add `osx_image: xcode6.4` to your .travis.yml to begin using it.

β€” Travis CI (@TravisCI) czerwiec 30, 2015
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

from xcodeserversdk.

esttorhe avatar esttorhe commented on July 17, 2024

CircleCI is free if we use it only for 1 job at a time (which i think would be fine) except there's no Xcode 7 love yet.


how about Bitrise ? (just checked, they support up to 6.4)

from xcodeserversdk.

cojoj avatar cojoj commented on July 17, 2024

I guess we'll have to wait for anything to support Xcode 7... Other possibility - someone has to allow us to access OS X Server 5.

from xcodeserversdk.

esttorhe avatar esttorhe commented on July 17, 2024

We can use Ship.io; they have Xcode 7 support already https://ship.io/xcode-7-beta-is-here/

They have a free plan for individual accounts with 2 jobs or something along those lines; might be worth looking at it

from xcodeserversdk.

cojoj avatar cojoj commented on July 17, 2024

πŸ‘Œ

from xcodeserversdk.

czechboy0 avatar czechboy0 commented on July 17, 2024

Just FYI, I do have an Xcode Bot running locally which tests the swift-2 branch after every single commit, so no worries there. I turned on email notifications so you'll also get them if something breaks.

Unfortunately, we need Pull Request testing, which Buildasaur has (I'm working on Xcode 7 support there) and CI services like Travis do as well, but they don't yet support Xcode 7. It's exactly what happened last year. Ship.io doesn't give us any benefit over a local Xcode Bot. Plus, their Scheme detection is broken, I tried it yesterday.

So once Buildasaur has an Xcode 7 version ready I'll turn it on for this repo so that all PRs will get tested.

from xcodeserversdk.

esttorhe avatar esttorhe commented on July 17, 2024

πŸ‘ that sounds great then πŸŽ‰

TBH i didn't like Ship.io when I tried it.

If I can help with bringing Xcode 7 support to Buildasaur just let me know

from xcodeserversdk.

esttorhe avatar esttorhe commented on July 17, 2024

Am I the only one seeing weird behavior with code coverage?

Yesterday I added a test that specifically triggers the invalid scheme path of code but this is what i'm seeing after running that tests:
screen shot 2015-07-01 at 15 31 27

Is marked as never called

from xcodeserversdk.

cojoj avatar cojoj commented on July 17, 2024

That's really strange... Was it covering the failable path yesterday? Looks fine to me...

Nothing has changed in those files AFAIK.

from xcodeserversdk.

esttorhe avatar esttorhe commented on July 17, 2024

It wasn't covered and that's why I went and wrote a test for it but didn't check. now I came to check and is still uncovered.

No matter if I run only that test or all the tests on iOS or OSX that path keeps being marked as not checked.

Perhaps the throws thing has something to do with it?

from xcodeserversdk.

esttorhe avatar esttorhe commented on July 17, 2024

Disregard my last comment… this invalidates my theory

guard let url = NSURL(string: host) else {
            /*******************************************************************
             **   Had to be added to silence the compiler Β―\_(ツ)_/Β―
             **   Radar: http://openradar.me/21514477
             **   Reply: https://twitter.com/jckarter/status/613491369311535104
             ******************************************************************/
            self.host = ""; self.user = nil; self.password = nil

            throw ConfigurationErrors.InvalidHostProvided(host)
        }

This is passing and marked as checked

from xcodeserversdk.

czechboy0 avatar czechboy0 commented on July 17, 2024

Just FYI, current state of things:
screenshot 2015-07-01 23 37 05

from xcodeserversdk.

esttorhe avatar esttorhe commented on July 17, 2024

That's weird; if you check at the tests and the coverage XcodeServerConfig should be near 100% but the coverage is not working as expected

from xcodeserversdk.

czechboy0 avatar czechboy0 commented on July 17, 2024

It might also have bugs. We'll see throughout the summer. We know we're still not testing most of the parsing/dictionarifying logic anyway :) I guess once we're confident about that we can tackle these weirdnesses.

from xcodeserversdk.

cojoj avatar cojoj commented on July 17, 2024

Hmmm this whole test coverage works fine for me everytime but bugs are possible...

from xcodeserversdk.

cojoj avatar cojoj commented on July 17, 2024

@czechboy0, @esttorhe I wonder...
Who's the first one to strat writing tests for API calls? 😜

from xcodeserversdk.

czechboy0 avatar czechboy0 commented on July 17, 2024

All the tools are there. Here is an example of a working test and how easily you get a recording Server. And here is how it works.

from xcodeserversdk.

czechboy0 avatar czechboy0 commented on July 17, 2024

And here is how you can reuse a recorded Cassette to add many parsing tests.

from xcodeserversdk.

cojoj avatar cojoj commented on July 17, 2024

Did you just point at me? 😜

from xcodeserversdk.

czechboy0 avatar czechboy0 commented on July 17, 2024

πŸ‘ˆ πŸ‘‰ πŸ‘ˆ πŸ‘‰ πŸ‘‡ ☝️ πŸ‘‡ ☝️

Not pointing at anyone, just πŸ’ƒ

from xcodeserversdk.

cojoj avatar cojoj commented on July 17, 2024

from xcodeserversdk.

cojoj avatar cojoj commented on July 17, 2024

On thing I've noticed, you use:

let config = try! XcodeServerConfig(
            host: "https://127.0.0.1",
            user: "ICanCreateBots",
            password: "superSecr3t")

For sake of consistency, should we use default XcodeServerConfig or pass ours? I think the first option will do better as all tests will have the same XcodeServerConfig but in this case all of us will have to create ICanCreateBots user with superSecr3t password.

from xcodeserversdk.

czechboy0 avatar czechboy0 commented on July 17, 2024

Depends how your XCS is setup, but I have that anyone can view bots and only logged in users can create bots. Which means that any user, including the non-existent ICanCreateBots will return all read-only requests. So you don't need to create this user at all to test most get requests.

When it comes to post requests, I haven't decided yet how we're going to test that since in post requests it's what we're sending is what we want to test, whereas with get requests it's what you're receiving that you want to test.

TL;DR - enable any user to read bots on your XCS and let's write tests for all the get requests first. I'll think of a good way to test posts later. Aight?

from xcodeserversdk.

cojoj avatar cojoj commented on July 17, 2024

I can't agree with you... While testing POST requests it's necessary to assert request but response is also important!

from xcodeserversdk.

cojoj avatar cojoj commented on July 17, 2024

@czechboy0 strange thing happened... I've written test for getRepository() which looks like:

func testGetRepositories() {
        let expectation = self.expectationWithDescription("Get Repositories")
        let server = self.getRecordingXcodeServer("get_repositories")

        server.getRepositories() { (repositories, error) in
            XCTAssertNil(error, "Error should be nil")
            XCTAssertNotNil(repositories, "Repositories shouldn't be nil")

            if let repos = repositories {
                XCTAssertEqual(repos.count, 2, "There should be two repositories available")

                for (index, repo) in repos.enumerate() {
                    XCTAssertEqual(repo.name, "Test\(index + 1)")
                }
            }

            expectation.fulfill()
        }

        self.waitForExpectationsWithTimeout(10) { error in
            if let error = error {
                print("Timeout error: \(error.localizedDescription)")
            }
        }
    }

So at first I had to move get_repositories.json and re-run tests - fine, works and even test is passing but when I look at code coverage I'm like WTF, bro!?:
screen shot 2015-07-02 at 14 53 00

I can agree that the fragment where completion with nil is passed may not be executed but [Repository] parsing?


I set a breakpoint where the code isn't covered and it executes so this is being called but marked differently πŸ˜“

from xcodeserversdk.

cojoj avatar cojoj commented on July 17, 2024

@esttorhe seems like I've been having similiar kind of issue with guard statements...

from xcodeserversdk.

esttorhe avatar esttorhe commented on July 17, 2024

Yeah; I saw your tweet to Joe; seems like radar time!! πŸ‘―

from xcodeserversdk.

cojoj avatar cojoj commented on July 17, 2024

from xcodeserversdk.

cojoj avatar cojoj commented on July 17, 2024

New follower...

joe

Things just got serious! 😁

from xcodeserversdk.

czechboy0 avatar czechboy0 commented on July 17, 2024

πŸŽ†

from xcodeserversdk.

czechboy0 avatar czechboy0 commented on July 17, 2024

Getting around 50% now. Not great but getting much better, especially thanks to @cojoj!

from xcodeserversdk.

czechboy0 avatar czechboy0 commented on July 17, 2024

This is nice, we had fun with it, but it's not really actionable. Closing.

from xcodeserversdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.