How to write tests for bad input, e.g. to check its proper handling
    3 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Ilya
      
 el 2 de En. de 2016
  
    
    
    
    
    Comentada: Ilya
      
 el 3 de En. de 2016
            To be more concrete: It's clear how to write tests that validate some expected outputs (testCase.validateEqual() etc.).
However, how do I validate that e.g. some exception was properly thrown as a response to e.g. some bad input data? Usually if an exception occurs in the function-under-test, the corresponding test function is marked as both "failed" and "incomplete".
0 comentarios
Respuesta aceptada
  Steven Lord
    
      
 el 2 de En. de 2016
        Use testCase.verifyError. The first input should be a function handle that will throw the error when evaluated, and the second should be the error identifier.
Más respuestas (0)
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

