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.
61
questions
0
votes
0
answers
35
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 ...
0
votes
0
answers
46
views
How to merge the frame?
I just write the code following :
...
-1
votes
1
answer
75
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 ...
0
votes
2
answers
108
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 ...
1
vote
0
answers
61
views
How to take a derivative of a function with respect to another function inside the function?
I have these two equations:
...
2
votes
2
answers
117
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 ...
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.
3
votes
1
answer
140
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 (...
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 ...
9
votes
3
answers
510
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
...
8
votes
1
answer
93
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, ...
2
votes
2
answers
130
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
...
12
votes
0
answers
250
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 ...
4
votes
1
answer
179
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-...
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:
<...
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 ...
3
votes
1
answer
202
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
...
3
votes
1
answer
324
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 ...
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 ...
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 ...
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 ...
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 ...
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:
...
2
votes
1
answer
153
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 ...
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:
...
41
votes
5
answers
2k
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
votes
2
answers
132
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?
4
votes
1
answer
111
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 ...
20
votes
1
answer
727
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 ...
0
votes
1
answer
156
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)
...
7
votes
3
answers
574
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
votes
1
answer
583
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 ...
13
votes
1
answer
366
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 ...
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 ...
6
votes
2
answers
346
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 ...
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 ...
0
votes
1
answer
215
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
...
2
votes
0
answers
223
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 ...
4
votes
3
answers
258
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: ...
3
votes
1
answer
120
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:
...
1
vote
0
answers
53
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 ...
8
votes
1
answer
211
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 ...
8
votes
2
answers
190
views
Syntactic Sugar for TestReports
Seems to me that VerificationTests are a bit verbose:
...
5
votes
1
answer
750
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 ...
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 ...
4
votes
0
answers
273
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....
3
votes
1
answer
173
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:
...
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:
...
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 ...
1
vote
1
answer
80
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 ...