Borrar filtros
Borrar filtros

Error while running the script based Unit Tests

2 visualizaciones (últimos 30 días)
Dipesh  Mudatkar
Dipesh Mudatkar el 17 de Abr. de 2018
Editada: Andy Campbell el 17 de Abr. de 2018
The example given on MathWorks website (on the link given below) is not working.
Following error occurred after running
>> result = runtests('rightTriTest'); % (In Matlab Version R2014b)
Error using matlab.unittest.TestSuite.fromFile (line 163)
The "rightTriTest" test script is incorrectly formed. When using code sections (%%) to delineate tests, there
can be no code defined above the first test.
Error in runtests>createSuite (line 93)
suite = TestSuite.fromFile(file, selector);
Error in runtests>@(test)createSuite(test,selector,logical(parser.Results.Recursively)) (line 71)
suites = cellfun(@(test)createSuite(test, selector, logical(parser.Results.Recursively)), ...
Error in runtests (line 71)
suites = cellfun(@(test)createSuite(test, selector, logical(parser.Results.Recursively)), ...
Does anybody have any idea about this?

Respuesta aceptada

Andy Campbell
Andy Campbell el 17 de Abr. de 2018
Editada: Andy Campbell el 17 de Abr. de 2018

Hi Dipesh,

The example you are referring to applies to more recent versions of MATLAB. R2014b was the first release in MATLAB that supported script-based unit tests, but the "shared variable section" was not supported until R2015a .

Here is the link to the R2014b documentation for writing script based unit tests.

Hope that helps! Andy

Más respuestas (0)

Categorías

Más información sobre Write Unit Tests en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by