Skip to content
👮 Cloud Elements API testing framework
Branch: master
Clone or download
tyler-cloud-elements Merge pull request #2033 from cloud-elements/onedrive-1
OneDrive Upto Date Churros | Fixed sending the query param
Latest commit 9924fdc Mar 22, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci bump to v2 due to version bump Mar 12, 2019
.github
deploy ...oh dear Aug 8, 2016
src
test Merge pull request #2026 from cloud-elements/EL-1552 Mar 20, 2019
.gitignore
.jsbeautifyrc
.jshintrc
CHANGELOG.md docs Jun 29, 2016
LICENSE.md much better error handling and init appends to file as not to overwri… Jan 9, 2016
README.md docs(readme): dead docs elimiation Mar 14, 2019
jsdoc.json
package-lock.json check if this works Mar 12, 2019
package.json circleci outage Mar 12, 2019

README.md

churros | Cloud Elements API Testing Framework


version versioning branching Circle CI Coverage Status

Overview

Integration testing framework for CE APIs, written in Javascript. Provides testing for all things Cloud Elements, from platform resources (elements, notifications, etc.) to all of the current elements in our catalog (sfdc, dropbox, etc.). This framework has up-to-date example JSON requests, example JSON transformations and much more. These tests are run against our platform many times a day, guaranteeing that they represent what our platform supports today.

How

Interact with the churros CLI to go about initializing churros, stubbing out tests and running tests. When it comes to running tests, the churros test sub-command simply wraps the mocha executable, which is the framework that all of our tests run as. The lower-level functions are all using the chakram node library to make HTTP requests, and then validation of payloads and HTTP responses is done using chai assertions. The churros framework relies heavily on Javascript promises in order to manage the asynchronous nature of nodejs. If you're new to Javascript, I recommend familiarizing yourself with promises before trying to write any of your own tests.

Installation

If you don't have node and npm installed, do that first.

Install the node dependencies and initialize churros.

# Install all necessary npm packages:
$ npm install

# Need phantomjs to be installed globally or somehow available on your $PATH:
$ npm install --global phantomjs-prebuilt

# Puts churros CLI on your $PATH:
$ npm link

# Initialize your churros properties file:
$ churros init

PROTIP: May have to sudo the global install and npm link depending on your environment

PROTIP: You can pass --template to churros init if you have an existing sauce template that you want to initialize from. It can accept both local filesystem paths and github urls:

  • churros init --template /absolute/path/to/existing/sauce.json
  • churros init --template https://token@github.com/cloud-elements/churros-sauce/sauce.json

PROTIP: You can set environment variables so that churros init does not prompt:

  • CHURROS_USER
  • CHURROS_PASSWORD
  • CHURROS_URL
  • CHURROS_TEMPLATE

PROTIP: Certain Firefox version are incompatible. You can find a compatible version(45.0b7) here. Once you install, you will need to immediately turn off automatic updates (Firefox -> Preferences -> Advanced -> Update). If you use Firefox as your primary browser and want to keep the latest version, you can run two version of Firefox if you set up your Profiles to enable it

Lastly, if you don't have a personal ngrok account, you'll need to signup for a free account here. After you have signed up, you should have a personal ngrok auth token that you'll need to setup on your computer per their instructions.

churros CLI

It is worth taking some time to familiarize yourself with the churros CLI. This CLI can run tests, help setup new test suites, and add/view properties that are needed in order to run certain suites. Run churros help and dig through some of the different sub-commands that are currently available. To see some examples of the most common command, churros test, continue on below.

1Password Support

Note: This feature is optional and prompt for it can be turned off by passing --no-1pass to churros init

1password is supported through environment variables export ONEPASS_SUBDOMAIN (eg 'cloudelements'), ONEPASS_USER, ONEPASS_PASSWORD, ONEPASS_SECRET, ONEPASS_VAULT(eg "churros") & ONEPASS (set to any value to use) or by providing these configurations to churros init prompts. Password and Secret are not saved beyond building of local sauce.json during churros init

Note: that if you provide your password as an environment variable you must escape any $ characters that may be in it (eg export ONEPASS_PASSWORD="MyPa\$\$word")

Requires 1password CLI >=v0.5.5

Download and put the op binary somewhere in your $PATH (eg /usr/local/bin) or anywhere else and create a symbolic link to it from a directory in your $PATH ($HOME/.churros is a good candidate!)

$ curl -O -L -s https://raw.githubusercontent.com/cloud-elements/onepass/master/osx/op
$ chmod a+x op
$ mv $PWD/op /usr/local/bin/op

Validate your installation worked by running:

$ op -v
> 0.5.5

API Docs

For full API docs, see the API docs here.

Examples

Element Tests

To run the tests for any element, you must have the necessary properties setup for that element. ALL properties for the elements below must be populated. To see what properties are required, you can call churros props {element}. You can also run churros help props for more info.

# Run all elements tests
$ churros test elements

# Run all elements tests except a suite
$ churros test elements --exclude 'onedrive'

# Run all elements tests starting at certain element
$ churros test elements --start 'box'

# Run the entire suite for the closeio element
$ churros test elements/closeio

# Run just the tests for the closeio contacts resource
$ churros test elements/closeio --test 'contacts'

# Run just the tests in the contacts.js file
$ churros test elements/closeio --file 'contacts'

# Run the entire suite for the sfdc element and during provisioning use the phantomjs browser
$ churros test elements/sfdc --browser phantomjs

# Run the polling tests if there are any
$ churros test elements/sfdc --polling

# Run suite on a existing instance(FOR DEVELOPMENT ONLY)
$ churros test elements/pipedrive --instance 1234

# Run suite with additional provisioning parameters
$ churros test elements/zuorav2 --params '{"zuorav2.sandbox": true}'

PROTIP: The --test value will search all tests describe(...) and it(...) strings to determine which test(s) to run

PROTIP: The --file value will run all the tests inside the JavaScript. Leave the .js off of the value

PROTIP: The --browser value defaults to firefox, however if you want to use a headless browser, you can pass --browser phantomjs as seen above

PROTIP: The --params requires valid JSON

Platform Tests

All Platform

# Run all platform tests
$ churros test platform

# Run all platform tests except a suite
$ churros test platform --exclude 'bulk'

# Run all platform tests starting at certain suite
$ churros test platform --start 'jobs'

Formulas

# Run the entire formulas suite:
$ churros test platform/formulas

# Run all tests that contain 'should not allow':
$ churros test platform/formulas --test 'should not allow'

# Run all test that contain 'should allow' as a different user than is setup in your properties file:
$ churros test platform/formulas --test 'should allow' --user frank --password sinatra

PROTIP: Passing a --user, --password and/or --url to churros test [suite] overrides the default value that was setup during churros init.

Notifications

# Run the entire notifications suite:
$ churros test platform/notifications

# Run the entire notifications suite with verbose logging on:
$ churros test platform/notifications --verbose

PROTIP: Passing a --verbose to churros test [suite] will log all of the debug messages to the console while the tests are running.

Events

These tests create an instance of an element with event notifications enabled and the event notification callback URL as a locally exposed URL. churros then simulates x number of events into our platform and ensures that our local callback receives x number of callbacks.

# Run the event tests, using the defaults in `churros props events`:
$ churros test platform/events

# Run the event tests, using sfdc as the element to simulate events:
$ churros test platform/events --element sfdc

# Run the event tests, using sfdc as the element to simulate events, sending in 25 events and waiting 60 seconds to receive them in churros:
$ churros test platform/events --element sfdc --load 25 --wait 60 --verbose

PROTIP: Passing a --wait, --load and/or --element to churros test platform/events overrides any default value that may be in your property file.

PROTIP: If you want to change the default port that is exposed to receive events, then change the events:port property by calling churros props events:port <my_port>

PROTIP: Some elements are not currently supported as they need to have an events/assets/{element}.event.json file setup so churros knows how to simulate events from that system. If you run the event tests with an element that is not supported you will see an error message like:

$ churros test platform/events --element box
$ No box.event.json file found in the events/assets directory.  Please create this file before this element can be tested with events

Known Limitations

  • Currently, churros tests can not be run if you have authenticated into CE using SSO (GitHub, Google, etc.).

Changelog

See CHANGELOG.md

Contributing

See CONTRIBUTING.md

License

See LICENSE.md

You can’t perform that action at this time.