GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - plumatic/schema-generators: test.check generators and data completion for Schema

BranchesTags
Open more actions menu

Latest commit

 

History

66 Commits
66 Commits

Folders and files

NameName
Last commit message
Last commit date
.circleci
.circleci
 
 
bin
bin
 
 
src/schema_generators
src/schema_generators
 
 
test/schema_generators
test/schema_generators
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
README.md
README.md
 
 
project.clj
project.clj
 
 

Repository files navigation

A Clojure(Script) library for data generation and generative testing with https://github.com/plumatic/schema and clojure.test.check.

Clojars Project

Circle CI

This is an alpha release. The API and organizational structure are subject to change. Comments and contributions are much appreciated.

--

This library provides two experimental forms of automatic test data generation from schemas.

(require '[schema-generators.complete :as c] '[schema-generators.generators :as g])

(g/sample 3 Animal)
;; => ({:name "", :barks? false, :type :dog}
;;     {:name "", :claws? false, :type :cat}
;;     {:name "\"|", :claws? false, :type :cat})

(g/generate Tree)
;; => {:value -8N, :children [{:value 5, :children [{:value -2N, :children []}]}
;;                            {:value -2, :children []}]}

(c/complete {:type :dog} Animal)
;; => {:name "nL@", :barks? false, :type :dog}

The schema-generators.generators namespace can compile Schemas into clojure.test.check generators. All of the built-in schemas are supported out of the box, and it is easy to extend to add new types or customize generation on a per-type basis. See schema-generators.generators-test for some more complex examples.

Moreover, the schema-generators.complete namespace can build on generation to allow "completion" of partial data. Whereas generators and clojure.test.check are very useful tools for abstract property testing, completers are useful when we want to test the behavior of a function on a specific complex data structure, where only some parts of the data structure are relevant for the function under test. Completion supports all of the extensibility of generators, plus the ability to provide coercions to create very succinct helpers for test data generation. See schema-generators.complete-test for examples.

Testing

  • Clojure - lein test
  • ClojureScript - doo is used for running cljs tests. After setting up your environment, run lein doo {js-env} test

Community

Please feel free to join the Plumbing mailing list to ask questions or discuss how you're using Schema.

We welcome contributions in the form of bug reports and pull requests; please see CONTRIBUTING.md in the repo root for guidelines.

Supported Clojure versions

Schema-generators are currently supported on Clojure 1.7 and 1.8 and the latest version of ClojureScript.

License

Distributed under the Eclipse Public License, the same as Clojure.

About

test.check generators and data completion for Schema

Resources

Readme

Contributing

Contributing
Activity
Custom properties

Stars

79 stars

Watchers

9 watching

Forks

7 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.