Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Client class in XCTest #1

Open
chh51 opened this issue Apr 21, 2016 · 4 comments
Open

Using Client class in XCTest #1

chh51 opened this issue Apr 21, 2016 · 4 comments

Comments

@chh51
Copy link

chh51 commented Apr 21, 2016

I need to run some Xcode unit tests based on the XCTest class. In SMART_on_FHIR_iOSTests.swift you have a simple example

class ClientTests: XCTestCase {

    func testInit() {
        let client = Client(baseURL: "https://api.io", settings: ["cliend_id": "client", "redirect": "oauth://callback"])
        XCTAssertTrue(client.server.baseURL.absoluteString == "https://api.io/")

//      //XCTAssertNil(client.auth.clientId, "clientId will only be queryable once we have an OAuth2 instance")
        client.ready { error in
            XCTAssertNil(error)
        }
    }
}

I notice that the client_id parameter is misspelled to cliend_id. Is this intentional ?

Can this be used to test against one of the SMART-on-FHIR test servers such as fhir-open-api-dstu2.smarthealthit.org ?

If so, what would the input settings to Client init( baseURL:, settings:, title: ) be ?

@p2
Copy link
Member

p2 commented Apr 21, 2016

Nice catch, and not intentional; shows the desolate state the SMART specific test cases are in! The instruction to wait for the block callback is also missing, I don't think this test class is any good.

Yes, you can use the client to connect to the open FHIR endpoint. I haven't tried it in unit tests and am using a mock server in the other test cases, testing metadata parsing. Maybe that's a better approach for unit testing? What do you need to test?

@chh51
Copy link
Author

chh51 commented Apr 21, 2016

Well, my goal is to test many of the SMART-on-FIHR apis ( with some of my wrapper code around them ) in XCTests against
the Smart, Cerner, and Epic test servers.

I need automated tests so that I can run regression tests every day or so to make sure I am not breaking something.

This describes what I am trying to do http://e2.edgemoor.com/doc/s16s3.html http://e2.edgemoor.com/doc/s16s3.html

Chris Hawkins
[email protected]

On Apr 21, 2016, at 1:08 PM, Pascal Pfiffner [email protected] wrote:

Nice catch, and not intentional; shows the desolate state the SMART specific test cases are in! The instruction to wait for the block callback is also missing, I don't think this test class is any good.

Yes, you can use the client to connect to the open FHIR endpoint. I haven't tried it in unit tests and am using a mock server in the other test cases https://github.com/smart-on-fhir/Swift-SMART/blob/master/Tests/ServerTests.swift#L33, testing metadata parsing. Maybe that's a better approach for unit testing? What do you need to test?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub #1 (comment)

@p2
Copy link
Member

p2 commented Apr 21, 2016

Ah great! Yes, that makes sense. The client works by reading the Conformance statement the first time any REST call is needed, so for open servers you may only need to specify baseURL and an empty settings dictionary on Client.init.

Let me know how it goes!

@chh51
Copy link
Author

chh51 commented Apr 21, 2016

I hope to be working on that by tomorrow, will let you know how it works out.

On Apr 21, 2016, at 1:20 PM, Pascal Pfiffner [email protected] wrote:

Ah great! Yes, that makes sense. The client works by reading the Conformance statement the first time any REST call is needed, so for open servers you may only need to specify baseURL and an empty settings dictionary on Client.init.

Let me know how it goes!


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub #1 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants