Questions tagged [testing-and-verification]

Questions about creating, maintaining, and verifying tests for functions and packages. This includes doing unit tests, creating testing notebooks, running verification tests, generating test reports, and using the MUnit package.

Questions about creating, maintaining, and verifying tests for functions and packages. This includes doing unit tests, creating testing notebooks, running verification tests, generating test reports, and using the MUnit package.

Useful links:

61 questions
20
votes
1 answer

Automating Testing of Mathematica Code

I'm getting started with unit testing of Mathematica code and looking for information on fitting this into an automated testing environment. For example with Node.js I write some code and tests and then hook it up with a testing pipeline. So when I…
Sean Lynch
  • 1,079
  • 5
  • 16
10
votes
2 answers

How can I run MUnit TestSuites outside WorkBench?

I would like to run MUnit tests inside TestSuite constructs from the command line or a notebook interface without loading the Workbench GUI. I tried TestRun["suite.mt"] where suite.mt contains: TestSuite[{"file1.mt","file2.mt"}] and each of the…
Ian Hinder
  • 2,125
  • 1
  • 14
  • 22
8
votes
1 answer

Is there QuickCheck testing framework variant for Mathematica?

Is there QuickCheck-like testing framework variant for Mathematica? We could analyse function argument patterns and generating arbitrary values matching patterns. The idea of generating values, testing rewriting rules and validating that the result…
Pavel Perikov
  • 1,345
  • 6
  • 14
7
votes
0 answers

Testing Grids in a Testing Notebook

I have an issue testing functions that generate formatted output. For example: 1) Create a new testing notebook and a new test like this: 2) Now execute the test (it fails as expected) 3) Now click the "Replace Output" button and run it…
Gustavo Delfino
  • 8,348
  • 1
  • 28
  • 58
6
votes
2 answers

Testing Graphics in a Testing Notebook

Testing Notebooks report the result of Plot as a Failure, when in fact it should be a Success. Is there a way to fix this?
Chris K
  • 20,207
  • 3
  • 39
  • 74
6
votes
1 answer

Mock environment setup for unit testing

I am trying to set up the unit testing environment for mathematica code. The problem I am getting is that I can't find a way to mock the methods that my functions use inside Module - they are always taken from the initial context that they were…
grandrew
  • 550
  • 2
  • 10
4
votes
3 answers

VerificationTest for uncaught `Throw`?

I want to demonstrate that Catch[x_] does not catch things thrown with a tag. Catch[Throw[0, 0]] gives Throw::nocatch: Uncaught Throw[0,0] returned to top level. Hold[Throw[0, 0]] But I cannot put this behaviour into a VerificationTest that…
masterxilo
  • 5,739
  • 17
  • 39
3
votes
1 answer

How to access timings of each individual test in a TestReport?

I want to know how long each VerificationTest took to complete in the test report, so see which one was the longest and do some statistics on them: TestReport[ Table[VerificationTest[ FullSimplify[2 Sin[12 x + 15 y] Cos[14 x + 21 y]], …
M.R.
  • 31,425
  • 8
  • 90
  • 281
1
vote
1 answer

MUnit tests for aborted during evaluation

I would like to create unit tests, where the function is expected to generate $Aborted, e.g. because it was given wrong input. However, I don't see a way how to make MUnit accept such an outcome. In Workbench, what I get is Test Failure Message:…
vsht
  • 3,517
  • 13
  • 23
1
vote
1 answer

Testing notebook corrupted upon quitting kernel during Get

On Mathematica 12.0 for Windows, I have a package foo.wl, and a testing notebook fooTests.nb. My first test loads the file: Get[NotebookDirectory <> "foo.wl"] I had left code in foo.wl that causes an infinite loop; realizing this I first tried Alt…
lirtosiast
  • 684
  • 6
  • 14
0
votes
0 answers

Good match test (good fit test) - How to solve?

please advise me with this example. The solution should be done using the program wolfram mathematica. But I do not know how. Can you please advise me? Parents with blood group AB have children with blood groups AA, AB, BB. If the Mendelian…
Thera
  • 41
  • 2
0
votes
1 answer

Verifying formulas

I'm trying to Verify that sin(a + b) = sin(a) cos(b) + sin(b) cos(a) with mathematica, but I don't know how to. I've been given a suggestion to use Simplify, but I don't know where/how. I just started with Mathematica so forgive me if this has a…
jhndoe2
  • 83
  • 1
  • 8
-1
votes
1 answer

How to prevent tests from evaluating with TestCreate?

When I am creating a test for example with TestCreate, I have input and expected output. How can I prevent the expected input from evaluating the output? This was one of my favorite areas of new functionality expanded in 13.3. For example, if I have…
Peter Burbery
  • 1,695
  • 4
  • 15