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
0 votes
0 answers
34 views

Why do plots change in dependence on sample order?

I suggest two identical data set dat1 and dat2, save the order of samples is different. After selecting the first or the second data, the SCORE and LOADING plots are different. This seems to be in ...
Victor Volkov's user avatar
0 votes
0 answers
42 views

How to merge the frame?

I just write the code following : ...
Roy Smith's user avatar
-1 votes
1 answer
74 views

How to prevent tests from evaluating with TestCreate? [closed]

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 ...
Peter Burbery's user avatar
0 votes
2 answers
97 views

How to take the derivative with respect to a function with more than one variable?

I have a function that includes another function inside. I want to know the derivative at every point x. I have spent a lot of time trying to figure out how to do this, but I am very lost. I have ...
Victor Nielsen's user avatar
1 vote
0 answers
60 views

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

I have these two equations: ...
Victor Nielsen's user avatar
2 votes
2 answers
111 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 ...
Azzurro94's user avatar
  • 499
24 votes
1 answer
2k 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.
Pavel Perikov's user avatar
3 votes
1 answer
136 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 (...
Nasser's user avatar
  • 137k
0 votes
0 answers
31 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 ...
Thera's user avatar
  • 41
9 votes
3 answers
509 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
92 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, ...
Pavel Perikov's user avatar
2 votes
2 answers
129 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 ...
Avrana's user avatar
  • 297
12 votes
0 answers
244 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 ...
vsht's user avatar
  • 3,487
4 votes
1 answer
162 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-...
Michael E2's user avatar
  • 233k
1 vote
1 answer
60 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: <...
lirtosiast's user avatar
1 vote
1 answer
51 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 ...
Paul B. Slater's user avatar
3 votes
1 answer
200 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 ...
Petro Kolosov's user avatar
3 votes
1 answer
317 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 ...
Picaud Vincent's 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 ...
jhndoe2's user avatar
  • 83
0 votes
0 answers
53 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 ...
H42's user avatar
  • 3,439
1 vote
0 answers
70 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 ...
berniethejet's user avatar
  • 1,407
4 votes
0 answers
62 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 ...
Peeter Joot's user avatar
  • 6,388
5 votes
0 answers
100 views

Problems with Failure in Testing Notebooks

This always fails the test: Failure["General", <|"MessageTemplate" -> "`1`", "MessageParameters" -> {foo}|>] While this passes as expected: ...
Kuba's user avatar
  • 136k
2 votes
1 answer
145 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 ...
Chris Degnen's user avatar
  • 30.8k
5 votes
1 answer
94 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: ...
Kuba's user avatar
  • 136k
41 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 ...
Pinti's user avatar
  • 6,483
6 votes
2 answers
128 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?
Chris K's user avatar
  • 19.5k
4 votes
1 answer
110 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 ...
Chris K's user avatar
  • 19.5k
20 votes
1 answer
710 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 ...
Sean Lynch's user avatar
  • 1,079
0 votes
1 answer
141 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) ...
Emad kareem's user avatar
7 votes
3 answers
561 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 ...
Ruslan's user avatar
  • 7,122
6 votes
1 answer
577 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 ...
grandrew's user avatar
  • 540
13 votes
1 answer
361 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 ...
Szabolcs's user avatar
  • 233k
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 ...
Sliwka Wegierka's user avatar
6 votes
2 answers
343 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 ...
Karsten W.'s user avatar
  • 1,383
2 votes
0 answers
92 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 ...
Rick R's user avatar
  • 407
0 votes
1 answer
212 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 ...
rasx's user avatar
  • 101
2 votes
0 answers
219 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 ...
masterxilo's user avatar
  • 5,689
4 votes
3 answers
255 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: ...
masterxilo's user avatar
  • 5,689
3 votes
1 answer
119 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: ...
AxelF's user avatar
  • 977
1 vote
0 answers
49 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 ...
masterxilo's user avatar
  • 5,689
8 votes
1 answer
208 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 ...
Kuba's user avatar
  • 136k
8 votes
2 answers
190 views

Syntactic Sugar for TestReports

Seems to me that VerificationTests are a bit verbose: ...
M.R.'s user avatar
  • 31.2k
5 votes
1 answer
747 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 ...
xiaohuamao's user avatar
  • 4,698
7 votes
0 answers
125 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 ...
Gustavo Delfino's user avatar
4 votes
0 answers
272 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....
iqchef's user avatar
  • 111
3 votes
1 answer
172 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: ...
M.R.'s user avatar
  • 31.2k
1 vote
1 answer
131 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: ...
M.R.'s user avatar
  • 31.2k
1 vote
0 answers
132 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 ...
Ronald Monson's user avatar
1 vote
1 answer
78 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 ...
vsht's user avatar
  • 3,487