I’m trying to figure out what testing etc libraries I should be using for julia, especially for property-based testing. I’m aware of SafeTestSets.jl, TestSetExtensions.jl, ReferenceTests.jl, UnitTestDesign.jl, RandomizedPropertyTest.jl Are there any other libraries I should look into?
Is the main way to program with contracts in Julia to use ‘traits’?
Note that the original poster on Slack cannot see your response here on Discourse. Consider transcribing the appropriate answer back to Slack , or pinging the poster here on Discourse so they can follow this thread .
(Original message ) (More Info)
2 Likes
ymh
March 3, 2021, 9:55pm
2
I’ll now transcribe the responses, since they were interesting (though I feel like this transcription should be automatable):
Valentin:
I’m not aware of any package explicitly for property based testing (though I’ve worked on a prototype I’m not happy with)
In julia, traits are mostly used to encode extra information that’s not part of the type, to change or control dispatch more finely grained
most of the time, regular dispatch and duck typing is enough though
Boston Gelwan: Development with Interface Packages · Invenia Blog
When I brought up RandomizedPropertyTest, Valentin pointed out that it has a serious shortcoming:
RandomizedPropertyTest.jl does type based generation and no shrinking, sadly
in julia we don’t really have the same kind of type information as Haskell, so type based shrinking doesn’t come for free for composite types
Integrated vs type based shrinking - Hypothesis
Drew Dolgert also volunteered a very nice summary of the testing libraries out there, and which I’ll paste in a reply below; Drew also mentioned a test reduction package that’s worth noting: see GitHub - maleadt/creduce_julia and ANN: Automatic test-case reduction and Bugs in Julia with AFL and C-Reduce · maleadt
Finally, one unit-testing framework that isn’t already in Drew’s notes, and which seems worth being aware of, is
4 Likes
ymh
March 6, 2021, 9:09pm
3
Drew’s notes:
Extensions to Test Sets
XXX what’s up with this? Still in use?
nested, typed test sets
makes results pretty
group tests under a description
makes a unit test
skippable tests
Contribute to YingboMa/SafeTestsets.jl development by creating an account on GitHub.
Makes testsets less likely to interfere with each other
by wrapping them in a module
Custom Julia test sets with output similar to that of Python's unittest
shows dots as tests complete, by hooking Test
Extensions to Julia's Base.Test
shows colored dots
failing tests show diffs between found and expected
selectively run test files with @includetests
Testing framework for Julia
filter tests based on regular expressions against testset names
include tests found within source files
Making JUnit style XML reports for your julia tests
Makes JUnit XML test reports
Some useful additions to the Julia Test Standard Library
adds @timedtestset
adds @constinferred to see if return value inferred from constant propagation
Continuous testing while developing functions
Watch code and test when it is updated, on a function-by-function basis
Separate testing frameworks
some useful steps in tests 👣
run specific tests
run test when files change
skip test modules
run a block only once in a loop
conditionally evaluate module
Julia library for functional testing.
Write a Markdown description of behavior and pull out tests
A Py.Test-like testing framework for Julia
Identifies tests, like functions, to collect them and then run.
like py.test
Testing for Julia, simplified.
Puts tests in functions in modules
Contribute to tkf/LiterateTest.jl development by creating an account on GitHub.
Literate programming tools (like Sweave) to write tests
Testing tools
Performance testing
Contribute to JuliaTesting/PerformanceTestTools.jl development by creating an account on GitHub.
enables nonfunctional performance testing inside CI tools
adds an include macro that runs tests in different process
Regression testing
Utility package for comparing data against reference files
compares values with values in files
Contribute to maleadt/creduce_julia development by creating an account on GitHub.
Generates smaller testing examples.
Reduce size of suite while keeping behavior
Floating-point assessment
Library for validated numerics using interval arithmetic
Run a function on an interval in order to find numerical accuracy problems.
BigFloat can set rounding mode, which is a common heuristic to
understand sensitivity of a calculation to numerical problems.
Mocking
Allows Julia function calls to be temporarily overloaded for the purpose of testing
A basic mocking module
Let's play pretend!
Mocking by annotating a function that you want to patch later
Mutation testing
Mutation Testing for Julia
Prototype of a fuzzer for Julia based on concolic execution
Fuzzer using concolic (concrete + symbolic) execution
Runs code, watches it run, uses that to make the next choice.
Generation of parameter values
Generate arbitrary sequences for testing
Generates parameter values from the input domain
Weights random generation to emphasize edge cases
Like Python’s Hypothesis
https://gitlab.com/quf/randomizedpropertytest.jl
Randomized property testing
QuickCheck inspired
Automated unit test coverage with fewer test cases using all-pairs and other covering arrays.
Factorial test designs
All-pairs, all-triples.
Code Coverage
Instrument Julia code so we can trace it, calculate coverage, do mutation testing etc...
Instrument code to get coverage
Code coverage generation for Julia, implemented in pure Julia
Instruments for smaller code coverage by line
Test specific tools
Regression Testing for Terminal UIs
Regression testing of user interfaces to command-line sessions
An Extensible Test Matrix Collection for Julia
A suite of matrices used for testing algorithms
A collection of systems of polynomials for benchmarking, testing etc.
Polynomials to solve for benchmarking
Common utilities for testing JSServe apps with Electron
run javascript to test within Electron
A common suite of test functions for stressing the robustness of differentiation tools.
Specific to testing differentiation tools
commonly used test images
Reproducible tests for HTTP requests
Record and replay http tests
Automated integrated regression tests for graphics libraries
Compare images for testing
A collection of test problems for optimization problems.
Tests of optimization problems
Utilities for testing custom AD primitives.
Test automatic differentiation primitives
Code for testing of Julia's random numbers
Test of random number generation
Problem models for testing POMDPs.jl
A Julia package collecting `ℝⁿ → ℝᵐ` functions commonly used for testing nonlinear solvers and optimizers.
Functions to test nonlinear optimization
Unit and Integration Tests for JuMP NLP and MINLP solvers
Tests for nonlinear / polynomial solvers.
julia package for phylogenetic networks analyses using 4-taxon subsets.
Data for tests of phylogenetic networks
Tools for development & test of PHY communication layer
Tests of the physical layer (OSI model)
A set of common benchmark functions for testing optimization algorithms in Julia
Functions to optimize to test optimization
Biological file format specimens for testing packages, and functions to assist in testing.
Biological file format specimens
Code rewriting
Insert behavior into the JIT
MacroTools provides a library of tools for working with Julia code and expressions.
Work with Julia code and expressions
Symbolic parser for Julia language term rewriting using REDUCE algebra
Symbolic parser generator
Julia functional programming infrastructures and metaprogramming facilities
Pattern-matching metaprogramming
Expression transformation package
https://github.com/FluxML/IRTools.jl
Provides an intermediate representation to work with.
Works with Cassette.jl
8 Likes