Skip to content

Testing infrastructure #24

@ijlyttle

Description

@ijlyttle

Over the past few days, I have been getting my thoughts together for this project (trying to remember what I had forgotten since UseR!)

I am starting to grasp what needs to be done in terms of documentation, but I think the immediate need is for a testing infrastructure.

I see three levels of tests:

  1. End-to-end translation of a ggplot object to a ggspec to a Vega-Lite spec.
  2. Visual confirmation that our ideas for end-to-end translation make visual sense
  3. Unit tests for subcomponents of the translations.

I plan to work on 1. and 2. in the very short-term. This will include some reference ggplot2 plots for geom_point() and geom_bar() (or maybe geom_col()), which will let Wenyu start to extend things at his end.

For item 3., this is something that Haley has already implemented for "ggspec", but that we will plan to work with Wenyu on in "ggvega" (as I try to get better with TS testing).

Here's my immediate plan for a PR:

  • move inst/exploratory to dev/exploratory, and add the dev directory to .Rbuildignore.
  • create a directory inst/examples/ggplot2 where there would a file for each example, e.g.:
    • scatterplot-iris.R containing the source code to create the ggplot object
  • incorporate a bar-chart example

I will build some helper functions to make it easier to access the source code to compile the objects themselves, something like:

# return the path to the example file
gg_example_file("scatterplot-iris") # for external use
gg_example_file_dev("scatterplot-iris") # for internal use 

# return a ggplot object
gg_example("scatterplot-iris")
gg_example_dev("scatterplot-iris")

Once all this is done, I plan to merge the PR so that the examples can be used right away.

In the coming days, I plan to build some testing infrastructure that will work for entire specs (as opposed to components of specs).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions