Skip to content

Commit 28c6f26

Browse files
committed
Moving Examples Driven Tester to Github.com
0 parents  commit 28c6f26

36 files changed

+1538
-0
lines changed

.gitattributes

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
*.fig binary
2+
*.mat binary
3+
*.mdl binary diff merge=mlAutoMerge
4+
*.mdlp binary
5+
*.mex* binary
6+
*.mlapp binary
7+
*.mldatx binary
8+
*.mlproj binary
9+
*.mlx binary
10+
*.p binary
11+
*.sfx binary
12+
*.sldd binary
13+
*.slreqx binary merge=mlAutoMerge
14+
*.slmx binary merge=mlAutoMerge
15+
*.sltx binary
16+
*.slxc binary
17+
*.slx binary merge=mlAutoMerge
18+
*.slxp binary
19+
20+
## Other common binary file types
21+
*.docx binary
22+
*.exe binary
23+
*.jpg binary
24+
*.pdf binary
25+
*.png binary
26+
*.xlsx binary

.gitignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Autosave files
2+
*.asv
3+
*.m~
4+
*.autosave
5+
*.slx.r*
6+
*.mdl.r*
7+
8+
# Derived content-obscured files
9+
*.p
10+
11+
# Compiled MEX files
12+
*.mex*
13+
14+
# Packaged app and toolbox files
15+
release/**
16+
*.mlappinstall
17+
*.mltbx
18+
19+
# Deployable archives
20+
*.ctf
21+
22+
# Generated helpsearch folders
23+
helpsearch*/
24+
25+
# Buildtool cache folders
26+
.buildtool/
27+
28+
# Code generation folders
29+
slprj/
30+
sccprj/
31+
codegen/
32+
33+
# Cache files
34+
*.slxc
35+
36+
# Cloud based storage dotfile
37+
.MATLABDriveTag

CONTRIBUTING.MD

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Contributing
2+
3+
>_If you believe you have discovered a security vulnerability, please **do not** open an issue or make a pull request. Follow the instructions in the [SECURITY.MD](SECURITY.MD) file in this repository._
4+
5+
Thank you for your interest in contributing to a MathWorks repository! We encourage contributions large and small to this repository.
6+
7+
**Contributions do not have to be code!** If you see a way to explain things more clearly or a great example of how to use something, please contribute it (or a link to your content). We welcome issues even if you don't code the solution. We also welcome pull requests to resolve issues that we haven't gotten to yet!
8+
9+
## How to contribute
10+
11+
* **Open an issue:** Start by [creating an issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/creating-an-issue) in the repository that you're interested in. That will start a conversation with the maintainer. When you are creating a bug report, please include as many details as possible. Please remember that other people do not have your background or understanding of the issue; make sure you are clear and complete in your description.
12+
* **Work in your own public fork:** If you choose to make a contribution, you should [fork the repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo). This creates an editable copy on GitHub where you can write, test, and refine your changes. We suggest that you keep your changes small and focused on the issue you submitted.
13+
* **Sign a Contributor License Agreement (CLA):** We require that all outside contributors sign a [CLA](https://en.wikipedia.org/wiki/Contributor_License_Agreement) before we can accept your contribution. When you create a pull request (see below), we'll reach out to you if you do not already have one on file. Essentially, the CLA gives us permission to publish your contribution as part of the repository.
14+
* **Make a pull request:** "[Pull Request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests)" is a confusing term, but it means exactly what it says: You're requesting that the maintainers of the repository pull your changes in. If you don't have a CLA on file, we'll reach out to you. Your contribution will be reviewed, and we may ask you to revise your pull request based on our feedback. Once everyone is satisfied, we'll merge your pull request into the repository.
15+
16+
## Guidelines
17+
18+
We don't have best practices for writing MATLAB code, but we do have some recommendations:
19+
20+
* You should not have any warnings or errors in the [code analyzer report](http://www.mathworks.com/help/matlab/matlab_prog/matlab-code-analyzer-report.html)
21+
* [Loren Shure's blog](https://blogs.mathworks.com/loren) has [great advice on improving your MATLAB code](https://blogs.mathworks.com/loren/category/best-practice/)
22+
* Examples should be written as [live scripts](https://www.mathworks.com/help/matlab/matlab_prog/what-is-a-live-script-or-function.html) and then [exported as HTML](https://www.mathworks.com/help/matlab/matlab_prog/share-live-scripts.html).
23+
* We adhere to the [CommonMark](https://commonmark.org/) specification where it does not conflict with GitHub rendering. If you edit your Markdown in Visual Studio Code or a similar editor, it uses [markdownlint](https://github.com/DavidAnson/markdownlint) to highlight issues in your Markdown.
24+
25+
**Again, thanks for contributing, and we look forward to your issues and pull requests!**

ExamplesDrivenTester.prj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<MATLABProject xmlns="http://www.mathworks.com/MATLABProjectFile" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0"/>

README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Examples Driven Tester
2+
3+
[![View <File Exchange Title> on File Exchange](https://www.mathworks.com/matlabcentral/images/matlab-file-exchange.svg)](https://www.mathworks.com/matlabcentral/fileexchange/####-file-exchange-title)
4+
5+
Examples driven tester is a tool for users which uses MATLAB&reg; scripts which are already present in toolbox to provide a preliminary "smoke test" of the toolbox functionality. It runs MATLAB scripts via the [MATLAB Function-Based unit test](https://www.mathworks.com/help/matlab/function-based-unit-tests.html) framework and generates a test and code coverage report. This tool is intended for preliminary qualification or Smoke testing of toolboxes. It is recommended to add unit tests for exhaustive functional testing of your code.
6+
7+
8+
### MathWorks Products [https://www.mathworks.com](https://www.mathworks.com)
9+
* MATLAB R2019b or newer
10+
11+
## Installation
12+
13+
* Launch MATLAB and download Examples driven tester from Add-On Explorer in MATLAB
14+
* Examples driven tester will be downloaded and should be ready to use!
15+
16+
## Usage
17+
18+
```matlab
19+
20+
obj = examplesTester(testFiles);
21+
obj = examplesTester(testFiles, Name, Value)
22+
23+
```
24+
25+
`testFiles` - Can have 2 possible values:
26+
27+
1. An array of folders containing M files
28+
2. A path to json file which contains list of folders containing M files
29+
30+
### Name Value pairs
31+
32+
* **CreateTestReport** - Should test report be generated. ***Possible values:**[true], false*
33+
* **TestReportFormat** - Format of test report. ***Possible values:** "pdf", "docx" , ["html”], “xml”*
34+
* **OutputPath** - Directory where reports will be generated. Default is pwd.
35+
* **CodeCoveragePlugin** - [MATLAB Code Coverage plugin](https://www.mathworks.com/help/matlab/ref/matlab.unittest.plugins.codecoverageplugin-class.html).
36+
37+
***Note:** Values enclosed in square braces are default values.*
38+
39+
### Basic workflows
40+
41+
Run MATLAB scripts from specified folders, for e.g. "doc" and "examples" and generate a test report
42+
43+
```matlab
44+
obj = examplesTester(["examples", "doc"]);
45+
obj.executesTests;
46+
```
47+
48+
Run MATLAB scripts from specified folders, for e.g. "doc" and "examples" but do not generate a test report
49+
50+
```matlab
51+
obj = examplesTester(["examples", "doc"], CreateTestReport = false);
52+
obj.executesTests;
53+
```
54+
55+
Run MATLAB scripts from specified folders, for e.g. "doc" and "examples" and generate a test report in PDF format.
56+
57+
```matlab
58+
obj = examplesTester(["examples", "doc"], TestReportFormat = "PDF");
59+
obj.executesTests;
60+
```
61+
62+
Run MATLAB scripts from specified folders, for e.g. "doc" and "examples" and generate a code coverage report for code placed in "code" folder.
63+
64+
```matlab
65+
reportFormat = matlab.unittest.plugins.codecoverage.CoverageReport('coverage-report');
66+
covPlugin = matlab.unittest.plugins.CodeCoveragePlugin.forFolder("code", "Producing", reportFormat);
67+
obj = examplesTester(["examples", "doc"], CodeCoveragePlugin = covPlugin);
68+
obj.executesTests;
69+
```
70+
71+
## License
72+
73+
The license is available in the [LICENSE.txt](license.txt) file within this repository
74+
75+
## Community Support
76+
77+
[MATLAB Central](https://www.mathworks.com/matlabcentral)
78+
79+
*Copyright 2023 The MathWorks, Inc.*

SECURITY.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Reporting Security Vulnerabilities
2+
3+
If you believe you have discovered a security vulnerability, please report it to
4+
[[email protected]](mailto:[email protected]). Please see
5+
[MathWorks Vulnerability Disclosure Policy for Security Researchers](https://www.mathworks.com/company/aboutus/policies_statements/vulnerability-disclosure-policy.html)
6+
for additional information.

buildfile.m

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
function plan = buildfile
2+
import matlab.buildtool.tasks.CodeIssuesTask
3+
import matlab.buildtool.tasks.TestTask
4+
5+
% Create a plan from task functions
6+
plan = buildplan(localfunctions);
7+
8+
% Add a task to identify code issues
9+
plan("check") = CodeIssuesTask;
10+
11+
plan("test") = TestTask('./tests');
12+
13+
plan.DefaultTasks = "test";
14+
15+
end
16+
17+
function releaseTask(~)
18+
releaseFolderName = "release";
19+
% Create toolbox options
20+
opts = matlab.addons.toolbox.ToolboxOptions("toolboxPackaging.prj");
21+
22+
mltbxFileName = strrep(opts.ToolboxName," ","_") + ".mltbx";
23+
opts.OutputFile = fullfile(releaseFolderName,mltbxFileName);
24+
25+
if ~exist(releaseFolderName,"dir")
26+
mkdir(releaseFolderName)
27+
end
28+
29+
% Package the toolbox
30+
matlab.addons.toolbox.packageToolbox(opts);
31+
end

license.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright (c) 2022, The MathWorks, Inc.
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are
6+
met:
7+
8+
* Redistributions of source code must retain the above copyright
9+
notice, this list of conditions and the following disclaimer.
10+
* Redistributions in binary form must reproduce the above copyright
11+
notice, this list of conditions and the following disclaimer in
12+
the documentation and/or other materials provided with the distribution
13+
* Neither the name of the The MathWorks, Inc. nor the names
14+
of its contributors may be used to endorse or promote products derived
15+
from this software without specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27+
POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)