LogoLogo
GoDocGitHub
  • Introduction
  • FAQ
  • Authentication strategies
    • Overview
    • Strategies
      • Azure Certificate Auth
      • Azure Creds Auth
      • Azure Env-based Auth
      • Azure Device Flow
      • SAML Auth
      • AddIn Only
        • Configuration
      • NTLM Auth
      • NTLM (alternative)
      • On-Demand Auth
      • ADFS Auth
      • FBA Auth
      • TMG Auth
      • Anonymous
    • Dynamic auth
    • Custom Auth
  • SharePoint client
    • HTTP Client
    • Fluent API
    • Hooks
    • Retries
    • Context
  • Samples
    • Library Initiation
    • Basic CRUD
    • Documents
    • Chunk upload
    • Permissions
    • Groups & Users
    • Search API
    • User Profiles
    • Change API
    • Attachments
    • Record Management
    • Sending Emails
    • Property Bags
    • Recycle Bin
    • Feature management
    • Advanced item requests
    • Advanced add/update
    • Unmarshaling responses
  • Sandbox
    • Overview
  • Utilities
    • Headers presets
    • Cpass
    • Compatibility matrix
  • Contributing
    • Overview
    • Testing
Powered by GitBook
On this page
  • Authentication testing
  • API integration tests
  • Run manual tests
  • Run CI tests
  • Test coverage

Was this helpful?

Edit on GitHub
Export as PDF
  1. Contributing

Testing

🚦Gosip automated testing

PreviousOverview

Last updated 5 years ago

Was this helpful?

In a clone or fork.

Authentication testing

Create auth credentials store files in ./config folder for corresponding strategies:

See .

go test ./... -v -race -count=1

Not provided auth configs and therefore strategies are ignored and not skipped in tests.

API integration tests

Create auth credentials store files in ./config/integration folder for corresponding environments:

  • private.spo.json

  • private.2013.json // 2013 has its nuances with OData mod and not supported methods

SPAUTH_ENVCODE=spo go test ./api/... -v -race -count=1
SPAUTH_ENVCODE=2013 go test ./api/... -v -race -count=1

API integration tests are mostly targeted to SharePoint Online and not regularly processed on the legacy versions of the platform so you can face some test exceptions which still should be escaped with t.Skip and envCode != "spo" condition:

if envCode != "spo" {
  t.Skip("is not supported with old SharePoint versions")
}

Environment variables

  • SPAUTH_ENVCODE=code environment variable switches target environments. spo is a default one.

  • SPAPI_HEAVY_TESTS=true turns on "heavy" methods, e.g. web creation.

Run manual tests

Modify cmd/test/main.go to include required scenarios and run:

go run ./cmd/test

Optionally, you can provide a strategy to use with a corresponding flag:

go run ./cmd/test -strategy adfs

Run CI tests

Configure environment variables:

  • SPAUTH_SITEURL

  • SPAUTH_CLIENTID

  • SPAUTH_CLIENTSECRET

  • SPAUTH_USERNAME

  • SPAUTH_PASSWORD

go test ./... -v -race -count=1
SPAUTH_ENVCODE=spo SPAPI_HEAVY_TESTS=true go test ./api/... -v -race -count=1

Test coverage

Branch

Coverage

Master

Dev

We are targeted to keep code coverage higher than 80% for API and Auth methods altogether.

Check .

Codecov
samples
codecov
codecov
private.onprem-ntlm.json
private.spo-user.json
private.spo-addin.json
private.onprem-tmg.json
private.onprem-adfs.json
private.onprem-wap-adfs.json
private.onprem-wap.json
private.spo-adfs.json
private.onprem-fba.json