xcthealthkit

An XCTest Framework to test the creation of HealthKit samples using the Health App

https://github.com/stanfordbdhg/xcthealthkit

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.6%) to scientific vocabulary

Keywords

healthkit stanford swift test xctest
Last synced: 6 months ago · JSON representation ·

Repository

An XCTest Framework to test the creation of HealthKit samples using the Health App

Basic Info
Statistics
  • Stars: 16
  • Watchers: 8
  • Forks: 0
  • Open Issues: 3
  • Releases: 16
Topics
healthkit stanford swift test xctest
Created about 3 years ago · Last pushed 7 months ago
Metadata Files
Readme License Citation

README.md

XCTHealthKit

Build and Test codecov DOI

XCTHealthKit is an XCTest-based framework to test the creation of HealthKit samples using the Apple Health App on the iPhone simulator.

How To Use XCTHealthKit

You can use XCTHealthKit in your UI tests. The API documentation provides a detailed overview of the public interface of XCTHealthKit.

The framework has the following functionalities:

Add Mock Data Using the Apple Health App

Use the XCTestCase.launchAndAddSample(healthApp:_:) throws function passing in an NewHealthSampleInput instance to add mock data using the Apple Health app: ```swift import XCTest import XCTHealthKit

class HealthKitUITests: XCTestCase { func testAddMockData() throws { let healthApp = XCUIApplication.healthApp try launchAndAddSample(healthApp: healthApp, .steps(value: 71)) try launchAndAddSample(healthApp: healthApp, .electrocardiogram()) } } ```

Alternatively, the XCTestCase.launchAndAddSamples(healthApp:_:) throws function can be used to add multiple samples in a single call: ```swift import XCTest import XCTHealthKit

class HealthKitUITests: XCTestCase { func testAddMockData() throws { let healthApp = XCUIApplication.healthApp try launchAndAddSamples(healthApp: healthApp, [ .activeEnergy(), .electrocardiogram(), .pushes(value: 117), .restingHeartRate(value: 91), .steps() ]) } } ```

Handle the HealthKit Authorization Sheet

You can use the XCUIApplication's handleHealthKitAuthorization() throws function to handle the HealthKit authorization sheet: ```swift import XCTest import XCTHealthKit

class HealthKitUITests: XCTestCase { func testHandleTheHealthKitAuthorizationSheet() throws { let app = XCUIApplication() app.launch()

    app.buttons["Request HealthKit Authorization"].tap()
    try app.handleHealthKitAuthorization()
}

} ```

Installation

The project can be added to your Xcode project or Swift Package using the Swift Package Manager.

Xcode: For an Xcode project, follow the instructions on Adding package dependencies to your app.

Swift Package: You can follow the Swift Package Manager documentation about defining dependencies to add this project as a dependency to your Swift Package.

License

This project is licensed under the MIT License. See Licenses for more information.

Contributors

This project is developed as part of the Stanford Byers Center for Biodesign at Stanford University. See CONTRIBUTORS.md for a full list of all XCTHealthKit contributors.

Stanford Byers Center for Biodesign Logo Stanford Byers Center for Biodesign Logo

Owner

  • Name: Stanford Biodesign Digital Health
  • Login: StanfordBDHG
  • Kind: organization
  • Location: United States of America

Citation (CITATION.cff)

#
# This source file is part of the XCTHealthKit open source project
#
# SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
#
# SPDX-License-Identifier: MIT
# 

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Schmiedmayer"
  given-names: "Paul"
  orcid: "https://orcid.org/0000-0002-8607-9148"
title: "XCTHealthKit"
doi: 10.5281/zenodo.7538174
url: "https://github.com/StanfordBDHG/XCTHealthKit"

GitHub Events

Total
  • Create event: 11
  • Release event: 5
  • Issues event: 1
  • Watch event: 3
  • Delete event: 5
  • Issue comment event: 17
  • Member event: 2
  • Push event: 20
  • Pull request review event: 18
  • Pull request review comment event: 12
  • Pull request event: 14
Last Year
  • Create event: 11
  • Release event: 5
  • Issues event: 1
  • Watch event: 3
  • Delete event: 5
  • Issue comment event: 17
  • Member event: 2
  • Push event: 20
  • Pull request review event: 18
  • Pull request review comment event: 12
  • Pull request event: 14

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 16
  • Total Committers: 1
  • Avg Commits per committer: 16.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Paul Schmiedmayer P****r@u****m 16

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 3
  • Total pull requests: 25
  • Average time to close issues: over 1 year
  • Average time to close pull requests: about 9 hours
  • Total issue authors: 2
  • Total pull request authors: 3
  • Average comments per issue: 0.0
  • Average comments per pull request: 1.64
  • Merged pull requests: 25
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 14
  • Average time to close issues: N/A
  • Average time to close pull requests: about 14 hours
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 2.07
  • Merged pull requests: 14
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • PSchmiedmayer (2)
  • philippzagar (1)
Pull Request Authors
  • lukaskollmer (14)
  • PSchmiedmayer (10)
Top Labels
Issue Labels
enhancement (3) good first issue (2) help wanted (1)
Pull Request Labels
enhancement (8) bug (3) documentation (2)

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 0
  • Total dependent repositories: 5
  • Total versions: 15
swiftpackageindex.com: github.com/StanfordBDHG/XCTHealthKit

An XCTest Framework to test the creation of HealthKit samples using the Health App

  • Versions: 15
  • Dependent Packages: 0
  • Dependent Repositories: 5
Rankings
Dependent repos count: 6.8%
Dependent packages count: 16.7%
Average: 36.2%
Forks count: 60.6%
Stargazers count: 60.6%
Last synced: 7 months ago

Dependencies

.github/workflows/build-and-test.yml actions
.github/workflows/pull_request.yml actions
Package.swift swiftpm