Early exit possible?

Help
Xin Sun
2012-02-24
2013-01-25
  • Xin Sun

    Xin Sun - 2012-02-24

    One thing I like about oval is that it tries to check all the constraints before it returns.

    But sometimes, if one constraint is violated, we don't want it to continue and just to return all the existing error. Is this possible? how do i configure it in xml?

     
  • Xin Sun

    Xin Sun - 2012-02-25
    <class type="A">
      <method name="getC" isInvariant="true"> 
        <returnValue> 
          <notNull/>
          <assertConstrainSet id="Scenario1" when="groovy:_this.getC().getName()=='Berlin'"> 
          <assertConstrainSet id="Scenario2" when="groovy:_this.getC().getName()=='New York'"> 
        </returnValue> 
      </method> 
    </class>
    

    for the above example, the getC returns null, i don't want to continue with the validation of this return value anymore (I might wanna continue with other validations if there are any), what do i need to do?

     
  • seb

    seb - 2012-03-03

    We currently do not have a solution for fast failing in OVal.

    This topic has also been discussed here https://sourceforge.net/projects/oval/forums/forum/488109/topic/4657065

    To have something working right now, you can do:

    <class type="A">
      <method name="getC" isInvariant="true"> 
          <returnValue> 
                <notNull/>
                <assertConstrainSet id="Scenario1" when="groovy:_value!=null && _this.getC().getName()=='Berlin'">
                <assertConstrainSet id="Scenario2" when="groovy:_value!=null && _this.getC().getName()=='New York'">
         </returnValue>
       </method>
    </class>
    
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks