Dependency-based Test Selection
MathWorks | Developer Zone
by Tim Johns
6M ago
This is the final part in my series on MATLAB Test where we’ll look at how to select tests based on files they depend on. Previously, I have covered: An introduction to MATLAB Test and the Test Manager The use of advanced coverage metrics Measuring and monitoring code quality Equivalence testing. In large and complex projects, running the entire test suite every time something changes can be prohibitively expensive in time and/or compute resource. In these instances, just running the tests that are affected by the changes may be preferable. MATLAB Test provides mechanisms for easily doing t ..read more
Visit website
Equivalence Testing
MathWorks | Developer Zone
by Tim Johns
6M ago
This is part 4 in my series on MATLAB Test in which we’ll look at the new equivalence testing functionality it provides for MATLAB code. Previously, I have covered: An introduction to MATLAB Test and the Test Manager The use of advanced coverage metrics Measuring and monitoring code quality. What is equivalence testing and why do I need it? In MATLAB, we can transform MATLAB code to C or C++ using MATLAB Coder, or to .NET assemblies, Java classes, or Python packages using MATLAB Compiler SDK. In such cases, we will often want to verify that the transformed version of our code behaves in exa ..read more
Visit website
Introducing MATLAB Test!
MathWorks | Developer Zone
by Tim Johns
8M ago
MATLAB R2023a was released back in March, and with it was a new product MATLAB Test. In a series of blog posts starting today, I’m going to show you how MATLAB Test can help you improve the quality of your code whether you’re developing a MATLAB Toolbox to share with your colleagues or writing code that will be deployed into a safety critical environment such as for medical devices. Overview There are five key features in the first release of MATAB Test which I’m going to cover. They will be extended and added to over the coming releases: Test Manager – manage your tests and results (today’s ..read more
Visit website
We’ve All Got Issues
MathWorks | Developer Zone
by Andy Campbell
1y ago
Who among us doesn't have issues amirite? Let's just take a moment and acknowledge this fact and I think we can always be a bit more honest and understanding of all of our unique issues and the various idiosyncrasies we exhibit. While we can all offer understanding and grace to each other, some of the issues we face can be important to address quickly, and some we can perhaps choose to work on when the time is right. ...and so it is with our code. Issues, bugs, and other sub-optimal constructs crop up all the time in any serious codebase. Many of you are already aware of the features of the C ..read more
Visit website
Han Solo Revisited
MathWorks | Developer Zone
by Tim Johns
1y ago
A long time ago in a blog post far, far away… Andy wrote about Han Solo Encapsulation – to keep Jabba’s “system working as designed he needed to encapsulate his system behind a rock solid interface”. By a stroke of good fortune, or judicious design choices depending on your perspective, a recent refactoring job that I thought could have far reaching consequences turned into a few changes in a single class, ultimately saving much time. Let’s have a look. My scenario is that I have a DataProvider that accepts a DataRequest and returns some data: classdef DataProvider methods ..read more
Visit website
Building Blocks
MathWorks | Developer Zone
by Andy Campbell
1y ago
My people! Oh how I have missed you. It has been such a long time since we have talked about some developer workflow goodness here on the blog. I have found it hard to sit down and write up more thoughts and musings on these topics, but the silver lining here is a big reason for my lack of time is that we have been hard at work delivering development infrastructure for MATLAB. One of those things is the new build tool for MATLAB that included in R2022b! We are super excited about this tool's rookie release, but even more excited for all the value that will come of it as you begin using it for ..read more
Visit website
Failure is the first step to trying
MathWorks | Developer Zone
by Tim Johns
2y ago
The official guidance on test-driven development is to follow the red-green-refactor cycle: Write a test that fails.Make it pass.Refactor. But what’s the point in starting with a test that fails? To make sure you’ve written the right test! I encountered some unexpected behaviour recently that highlighted this point. Imagine you have a Library that aggregates Items. An Item can be either a Book or a Film, but not both at the same time. If we create a Library in "book mode", it should initially contain an empty Book. If we create it in "film mode", it should initially contain an empty Film. Let ..read more
Visit website
You’ve Got Mail
MathWorks | Developer Zone
by Tim Johns
2y ago
Let’s send some emails! Imagine you write a function that sends an email to a customer. Your initial function call might look like this: sendEmail(emailAddress,firstName,lastName,bodyText) Having 4 inputs to our function is fine, but if we need to add more customer details it becomes difficult to manage. When working on software projects, we find that certain variables tend to be grouped together. In our case, “first name”, “last name”, and “email address” represent a customer. We might also have “name”, “description”, and “price” to represent a product, or “customer”, “product”, and “datetim ..read more
Visit website
Do you feel lucky, punk?
MathWorks | Developer Zone
by Tim Johns
2y ago
I'm part of the MathWorks consulting team based in the UK specialising in software architecture and testing (Andy's posted an article from me before). As part of some recent training I was delivering, I was contemplating this diagram that has been floating around internally for a number of years: Hilarious, I know. The point being made is an obvious one, which got me thinking – if it’s so obvious that writing tests is a good idea, why don’t more people do it? You need a test, so why don't you write one? I came up with some possible reasons as to why people don’t write tests: They don't know h ..read more
Visit website
Coming around full Circle
MathWorks | Developer Zone
by Andy Campbell
2y ago
CI services in the cloud. They are beautiful. All you need to do is drop a little bit o' yaml in your repository and a whole world of automated build and test infrastructure starts creating some good clean fun with your commits. The kind of good clean fun that actually makes your code cleaner. You don't need to set up your machines, you don't need to worry about the power button on your CI server (or your agents for that matter). It's all just done for you and it's lovely. A little while ago we showed how MATLAB, Simulink, and most toolboxes are now supported on a variety of cloud CI services ..read more
Visit website

Follow MathWorks | Developer Zone on FeedSpot

Continue with Google
Continue with Apple
OR