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.

Filter by
Sorted by
Tagged with
1 vote
0 answers
38 views

How to take a derivative of a function with respect to another function inside the function?

I have these two equations: ...
user avatar
2 votes
2 answers
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 ...
user avatar
  • 351
9 votes
6 answers
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 ...
user avatar
  • 483
0 votes
0 answers
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 ...
user avatar
  • 1,787
23 votes
1 answer
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.
user avatar
3 votes
1 answer
89 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 (...
user avatar
  • 108k
0 votes
0 answers
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 ...
user avatar
  • 41
9 votes
3 answers
485 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 ...
user avatar
8 votes
1 answer
79 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, ...
user avatar
2 votes
2 answers
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 ...
user avatar
  • 143
12 votes
0 answers
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 ...
user avatar
  • 3,302
4 votes
1 answer
106 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-...
user avatar
  • 213k
0 votes
1 answer
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: <...
user avatar
1 vote
1 answer
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 ...
user avatar
3 votes
1 answer
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 ...
user avatar
  • 171
3 votes
1 answer
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 ...
user avatar
0 votes
1 answer
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 ...
user avatar
  • 73
0 votes
0 answers
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 ...
user avatar
  • 3,389
1 vote
0 answers
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 ...
user avatar
  • 1,275
4 votes
0 answers
58 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 ...
user avatar
  • 6,208
5 votes
0 answers
95 views

Problems with Failure in Testing Notebooks

This always fails the test: Failure["General", <|"MessageTemplate" -> "`1`", "MessageParameters" -> {foo}|>] While this passes as expected: ...
user avatar
  • 132k
1 vote
1 answer
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 ...
user avatar
  • 29.1k
5 votes
1 answer
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: ...
user avatar
  • 132k
40 votes
5 answers
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 ...
user avatar
  • 6,373
6 votes
2 answers
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?
user avatar
  • 17.6k
4 votes
1 answer
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 ...
user avatar
  • 17.6k
19 votes
1 answer
608 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 ...
user avatar
  • 1,019
0 votes
1 answer
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) ...
user avatar
7 votes
3 answers
508 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 ...
user avatar
  • 6,902
5 votes
1 answer
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 ...
user avatar
  • 530
9 votes
1 answer
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 ...
user avatar
  • 224k
2 votes
0 answers
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 ...
user avatar
6 votes
2 answers
335 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 ...
user avatar
  • 1,363
1 vote
0 answers
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 ...
user avatar
  • 387
0 votes
1 answer
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 ...
user avatar
  • 101
2 votes
0 answers
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 ...
user avatar
  • 5,559
4 votes
3 answers
226 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: ...
user avatar
  • 5,559
3 votes
1 answer
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: ...
user avatar
  • 923
1 vote
0 answers
46 views

Possible bug with Testing Notebook & messages x::y where x has an OwnValue

I think this should be considered a bug (or at least an inconvenience) and should be reported: Say you have some code generating the $RecursionLimit::reclim2 ...
user avatar
  • 5,559
7 votes
1 answer
198 views

Testing Framework applications in the FrontEnd area

I understand that user interaction with GUI can't be tested automatically but some things can be tested using low-level notebook programming functions. Are there any guidelines or limitations of using ...
user avatar
  • 132k
8 votes
2 answers
186 views

Syntactic Sugar for TestReports

Seems to me that VerificationTests are a bit verbose: ...
user avatar
  • 30.3k
5 votes
1 answer
736 views

Mathematica 10.X benchmark report for high-end surface pro 4/surface book?

Recently, I am seriously considering purchasing the high-end surface device (with intel i7 and maximal RAM). Mathematica will be one of the main applications. Since it is not a full or traditional ...
user avatar
  • 4,006
6 votes
0 answers
117 views

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 ...
user avatar
4 votes
0 answers
270 views

Debugging Test files generates exception in Workbench 2 and 3

I'm having trouble running the "test file" example given in the video here http://www.wolfram.com/broadcast/screencasts/workbench/WorkbenchTesterDemo/ in "Debug As...". RUNning the test file "test....
user avatar
  • 111
3 votes
1 answer
169 views

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: ...
user avatar
  • 30.3k
1 vote
1 answer
130 views

How to freeze and test a list of programs?

I have a list of problems for my students and I'm trying to use the new v10 feature TestResults like so: ...
user avatar
  • 30.3k
1 vote
0 answers
128 views

Software Testing (Dynamic, Manipulate, DynamicModule) Interfaces

The main Testing Framework (in both the frontend and Wolfram Workbench) supports unit testing for command-line invocations. Is there a natural way of co-opting this, or perhaps there already exist ...
user avatar
1 vote
1 answer
77 views

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 ...
user avatar
  • 3,302
6 votes
2 answers
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 ...
user avatar
  • 30.3k
11 votes
2 answers
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 ...
user avatar