필터 지우기
필터 지우기

Using Signal Logging for Test Harness to Matlab Workspace

조회 수: 2 (최근 30일)
Tim Proby
Tim Proby 2023년 12월 21일
이동: madhan ravi 2023년 12월 21일
I am using a simple script to run a test case via a test harness within Matlab
%% Clear Workspace
clc
close all
clear
%% Run Test Cas(es)
out = runtests(Name='my test case');
logsouttest = out.logsout;
This errors on line 9
The 'runtests' command does not export like the 'sim' command. But I can't use the 'sim' command since I am using a test harness and need to utilize the 'runtests' command.
I know there has to be a way to get the 'logsout' data, I just cannot figure out the syntax.
Overall goal is to get the logged signal data in the test harness into the Matlab workspace

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2023년 12월 21일
doc matlab.unittest.TestResult
help matlab.unittest.TestResult
TestResult - Result of running a test suite The matlab.unittest.TestResult class holds the information describing the result of running a test suite using the matlab.unittest.TestRunner. It contains information describing whether the test passed, failed, or ran to completion as well as the duration of the tests. TestResult arrays are created and returned by the test runner, and are of the same size as the suite which was run. TestResult properties: Name - The name of the TestSuite for this result Passed - Logical value showing if the test passed Failed - Logical value showing if the test failed Incomplete - Logical value showing if test did not run to completion Duration - Time elapsed running test Details - Structure containing custom data for this result TestResult methods: table - Convert TestResult object to table assertSuccess - Assert test session runs without failure Examples: >> import matlab.unittest.TestSuite; >> % Result display method provides a summary of the results >> suite = TestSuite.fromClass(?SomeTestClass) >> results = run(suite) results = 1x16 TestResult array with properties: Name Passed Failed Incomplete Duration Details Totals: 12 Passed, 4 Failed (rerun), 0 Incomplete. 5.5091 seconds testing time. >> >> % Rerun only the failed tests by clicking the "rerun" hyperlink ans = 1x4 TestResult array with properties: Name Passed Failed Incomplete Duration Details Test Suite Summary: 0 Passed, 4 Failed (rerun), 0 Incomplete. 1.2894 seconds testing time. >> % Make the fix and rerun the failed tests ans = 1x4 TestResult array with properties: Name Passed Failed Incomplete Duration Details Test Suite Summary: 4 Passed, 0 Failed, 0 Incomplete. 1.1607 seconds testing time. See also: TestSuite, TestRunner Documentation for matlab.unittest.TestResult doc matlab.unittest.TestResult
  댓글 수: 2
Tim Proby
Tim Proby 2023년 12월 21일
that gets me the results of the test (e.g. pass or fail) but not the logged signals that are generated during the test
I want to get the signals that are generated (e.g. position, velocity, acceleration) over time
Tim Proby
Tim Proby 2023년 12월 21일
이동: madhan ravi 2023년 12월 21일
To clarify, I want the "Sim Outputs" in my Matlab workspace

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Outputs에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by