Rahul Kumar
Rahul Kumar

Reputation: 148

How to continue the test even though assert fails

@Stepwise
Class TestCaseOne extends Specification{

   def test(){
      expect:
            assert something
   }
   def testValidation(){
      expect:
            assert something
   }
   def test(){}
      expect:
            assert something
   }
   def testValidation(){
      expect:
            assert something
   }

}

I want testing should stop if test method fails but it should continue if testValidation method fails. Please let me know if it is possible.

I am using Groovy and spock.Thanks in advance.

Upvotes: 2

Views: 1806

Answers (2)

kazanaki
kazanaki

Reputation: 8054

What you are asking is not possible.

Either you use @Stepwise and it stops at the first failure. Or your don't use @Stepwise and it runs everything.

There is no way to mark specific methods on what should happen.

Split your test into two where one has the annotation and the other does not.

Upvotes: 0

tomic
tomic

Reputation: 613

According to this 'issue' which covers your question https://github.com/spockframework/spock/issues/456 recommended way if you want to achieve full test execution is to not use @Stepwise annotation.

robfletcher commented Aug 30, 2015 Just don't use @Stepwise then. Execution is sequential nevertheless. This might change in case Spock itself ever gets some parallel execution support, but for now you'll be fine. Reported by pniederw on 2013-10-24 08:47:44

Upvotes: 1

Related Questions