Giter Club home page Giter Club logo

flipcharttests's Introduction

flipChartTests

This package contains only unit tests for flipStandardChart and flipChart. Test outputs are machine-specific, so it is recommended that you use the image files included inside the repository rather than local versions.

Checking for snapshot diffs

Tests are run automatically in TravisCI, after a push to flipChartTests, flipChart, flipStandardCharts or other upstream dependencies. Snapshots will be found in tests/testthat/snapshots. Diffing files are in the diff directory and should be compared against files of the same name that are in the accepted directory.

Creating new tests

Tests can be added to the R files in the testthat directory. Convenience functions have been provided in flipChartTests so the tests can be created easily. For example,

pp <- plot_ly(x = 1:10, y = 1:10, trace = "scatter")
expect_true(TestWidget(pp, "test1"))

Only the test file (e.g. tests/testthat/test-background.R) should be committed, not the test outputs (PNG files).

Running tests locally

The output from running tests locally are not reliable, and should be compared against the output in TravisCI. If working locally, the dependencies can be set up by

install.packages("devtools")
install.packages("testthat")
require(devtools)
install_github("MangoTheCat/visualTest")
install.packages("webshot")
webshot::install_phantomjs()

Because the snapshots are machine-specific, the first time they are run locally, you may need to delete all files inside tests/testthat/snapshots/accepted before regenerating.

To accept new test outputs, simply delete the existing test output inside tests/testthat/snapshots/accepted and the new outputs will saved in that directory next time the tests are run using devtools::test() or testthat_test_file(<filename>) to run a subset of tests.

Note that you should use devtools::test() rather than devtools::check() as check() will give the same errors and warning but will not generate output PNG files in the repository.

Displayr logo

flipcharttests's People

Contributors

chschan avatar mwmclean avatar jakehoare avatar jrwishart avatar

Watchers

James Cloos avatar

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.