# 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.

58 questions
Filter by
Sorted by
Tagged with
88 views

### Implies does not return true for a equation

Check the Edited too, please: i have a simple equation which i expect to get TRUE from Implies but it just returns the same thing to me. Implies works well for easier examples but I have some more ...
• 351
590 views

### Finding which given functions are equal to each others

I have about 50 piece functions (generally trigonometric functions). I want to find out which ones are equal to each other after some simplifications such as ...
• 483
59 views

### My notebook backup function works fine. I am just asking for your critical review before submitting to FunctionRepository

Why the name and what does it do exactly? Youre probably asking yourselves why I named it NotebookBackupStack. All that is explained in ...
• 1,647
1k views

### What are some approaches to measuring code coverage?

I understand that Mathematica can have some peculiarities in this area, but just in case... I'm talking about things like measuring coverage of MUnit tests to get an idea of code quality.
• 1,295
88 views

### How to verify series solution to an ode generated by AsymptoticDSolveValue?

To verify solution returned by DSolve, one can use the method shown in howto/CheckTheResultsOfDSolve.html and look for True (...
• 108k
30 views

### 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 ...
• 41
483 views

### Why is the solution I obtained from Solve not verified in the original equation?

I have this equation $$x^2 \left(\sqrt{1-y^2} \sin (x)-\sin (4 x)\right)+2 x y=0$$ I want to solve this equation and find $y$ in terms of $x$. I use Solve ...
78 views

### 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, ...
• 1,295
124 views

### Alternative way for getting the roots of a transcendental equation and verifying them

I have the following transcendental equation: $$2 \cot(x)=\frac{kx}{h(L/N)}-\frac{h(L/N)}{kx}$$ I use the following code to solve it ...
• 143
209 views

### Continuous integration (CI, software development) with Wolfram Language?

Continuous integration (in the software engineering sense) is a common method to ensure that the code in your repository works as it should after each commit. For example, you can run a set of ...
• 3,302
105 views

### How to test if two plots are the same (say, for unit testing)

I'd like to be able to test if two plots are the same. My use-cases involve plots that in one case might be of one type but in another of another type. Principally, I'm interested in the "calculus-...
• 212k
52 views

### 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: <...
• 644
1 vote
50 views

### How does one test whether or not an integration has succeeded?

This must be a very simple matter--but how to address it eludes me at the moment. I have a series of integrands--and want to flag whether the symbolic integation has succeeded or not (in order to ...
• 2,205
172 views

### How to prove a numerical identity?

Let be a function power function f[s_, r_] := Piecewise[{{s^r, s >= 0}, {0, True}}]; And its convolution ...
• 171
291 views

### Meson build system + C/C++ LibraryLink, help needed for portability check/fix (Windows &MacOs)

As a proof of concept I have created a github repository that shows how to: use the Meson build system to create a Mathematica package using LibraryLink functions The goal is to provide an easy to ...
• 2,383
56 views

### Verifying formulas [closed]

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 ...
• 73
51 views

### How to use === with condition?

I have two expressions, and they are same when k is positive and x is non-zero real number. Below code gives me ...
• 3,389
1 vote
68 views

### How can I launch GenerateDocument with a template file on multiple kernels in a batch fashion?

I am trying to do automated testing of my MMA package by launching test cases that are generated on-the-fly with GenerateDocument and a template document, and then evaluated with NotebookEvaluate. I ...
• 1,275
57 views

### Testing packages against old Mathematica versions

I've made a Mathematica package available, and it's been reported to me that it doesn't work with Mathematica 4. I've guessed at some of the issues, and provided work arounds, but that process is ...
• 6,198
95 views

### Problems with Failure in Testing Notebooks

This always fails the test: Failure["General", <|"MessageTemplate" -> "1", "MessageParameters" -> {foo}|>] While this passes as expected: ...
• 132k
1 vote
100 views

### Can the window title be modified?

I would like to modify the window title upon initialisation so that the code base is readily identifiable, e.g. Live, Beta, Development, etc. Apparently some systems use different colours to make ...
• 29k
88 views

### CreateNotebook["Testing"] writes all TaggingRules to the notebook

Bug introduced in V11.2 or earlier and persisting through V11.3 CASE:4072649 Some of notebook types generate notebooks with TaggingRules for their purposes: ...
• 132k
1k views

### Best practices for using the Testing Framework

I am looking for best practices and recommended workflows for using the Testing Framework. For example, lets say I am developing a Mathematica package for other users, it is hosted on GitHub and I ...
• 6,373
112 views

### 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?
• 17.5k
107 views

### Notification if new output differs from old

I'm developing a package and keep a notebook of test cases to make sure a fix in one function doesn't break anything else. Right now, when I make a change to the package, I run the relevant parts of ...
• 17.5k
605 views

### 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 ...
• 1,019
82 views

### Extract the x values that make the two functions values equal

I have two functions for the x variable. I want to extract x values that make the functions equal. (1) ...
• 574
507 views

### Avoiding the suppression of messages by NIntegrate

Consider the following code: test[x_] := If[1 < x < 2, Message[Test::message]; x^2, x]; NIntegrate[test[x], {x, 0, 3}] 5.33333333333334 I.e. it gives me ...
• 6,902
503 views

### 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 ...
• 530
311 views

### Unit tests for Graphics or FE boxes

Consider the following expression with bad syntax: Graphics[{foo}] How can I detect the error and retrieve the error message programmatically, so I can check for ...
• 224k
81 views

### Can the bins for the Chi-Square test be chosen manually? [duplicate]

I'm trying to check if a vector of data is well-fitted to the negative binomial distribution, using PearsonChiSquareTest[] function. The problem is that my data are ...
334 views

### Write Unit Test with expected Message

Using Workbench, I would like to check if my function does emit a message under certain circumstances. How can I test this using an .mt file? I only know about the ...
• 1,363
1 vote
88 views

### Testing Notebook fails on Datasets

I have some functions that read in a .csv and convert them to a Dataset, and do some processing. I've written tests to validate that the correct transformations occur (so far very simple...like ...
• 387
208 views

### Can Mathematica be configured to not lazy-evaluate by default? [closed]

I notice that VerificationTest will see False for a function in cell 1 ...
• 101
195 views

### Check, Quiet and VerificationTest with messages?

I have a VerificationTest that is expected to generate some messages. It runs inside of code that uses Check to ...
• 5,559
225 views

### 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: ...
• 5,559
117 views

### Workbench TestSuite problem

I am working on an application using Workbench 3.0 and Mathematica 10.4.0. I've written a couple of test files for different parts of my work, and a master file with a test suite: ...
• 923
1 vote
46 views

• 3,302
354 views

### How do I correctly embed VerificationTests in my packages?

I like to write my tests before I code and write them inline when developing a package, and when loading a package those VerificationTests should run and the load should fail and print a report if ...
• 30.2k
159 views

### Testing Notebook severe slowdown with newlines

Bug introduced in 10.0 and fixed in 10.1.0 I am having a severe slowdown problem with Mathematica 10 new Testing Notebook feature (File -> New -> Testing Notebook). Please try this simple test: Now ...
• 7,408
306 views

### How can I programmatically call MUnit tests in Wolfram Workbench?

I have a collection of .mt test files in Wolfram Workbench. Is there a way to invoke the tests programmatically and then write the results to a text file for ...
• 4,665