# It is possible to skip test in runtime?

**URL:** <https://forum.katalon.com/t/it-is-possible-to-skip-test-in-runtime/10329>\
**Category:** Feature Request\
**Tags:** feature-request, katalon-studio\
**Created:** [April 17, 2018, 3:02pm UTC](https://forum.katalon.com/t/it-is-possible-to-skip-test-in-runtime/10329 "2018-04-17T15:02:59Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dmitry](https://avatars.discourse-cdn.com/v4/letter/d/0ea827/32.png) [@Dmitry](https://forum.katalon.com/u/Dmitry)\
**Post date:** [April 17, 2018, 3:02pm UTC](https://forum.katalon.com/t/it-is-possible-to-skip-test-in-runtime/10329/1 "2018-04-17T15:02:59Z")

</div>

We have TestSuites with TestCases on the TestRail.  
After creating TestSuite with TC, I know TestSuite ID only.  
In Katalon i am configured @BeforeTestSuite Listener to get TestSuite ID from file. Then Katalon connects to the TestRail, gets TestCase IDs from TestSuite and puts IDs into Collection. In Katalon i’m adding IDs to TestCase into Variable. Via @BeforeTestCase Listener i get TestCase ID from TestCase context. If Collection of IDs contains TestCase ID - test runs. Else - the test shouldn’t run. Maybe someone knows how to skip the test?

```auto
As a temporary solution i add flag into Global variable. And in the Else block i set flag to false and on tests i check this flag and use markErrorAndStop. But i think this is not good solution.

```

---

<div class="post-metadata">

**Author:** ![Rudra](https://avatars.discourse-cdn.com/v4/letter/r/47e85d/32.png) [@Rudra](https://forum.katalon.com/u/Rudra)\
**Post date:** [August 24, 2018, 4:48am UTC](https://forum.katalon.com/t/it-is-possible-to-skip-test-in-runtime/10329/2 "2018-08-24T04:48:22Z")

</div>

Agreed Dmitry, We need \_markSkippedAndStop or \__markBlockedAndStop keyword_

---

<div class="post-metadata">

**Author:** ![MaKatalon](https://avatars.discourse-cdn.com/v4/letter/m/b4bc9f/32.png) [@MaKatalon](https://forum.katalon.com/u/MaKatalon)\
**Post date:** [September 27, 2018, 2:23pm UTC](https://forum.katalon.com/t/it-is-possible-to-skip-test-in-runtime/10329/3 "2018-09-27T14:23:12Z")

</div>

Agree, we would also want a keyword markSkippedAndNext, markBlockedAndNext to jump to nxt iteration.

---

<div class="post-metadata">

**Author:** ![Trong\_Bui](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/trong_bui/32/374_2.png) [@Trong\_Bui](https://forum.katalon.com/u/Trong_Bui)\
**Post date:** [September 28, 2018, 4:30am UTC](https://forum.katalon.com/t/it-is-possible-to-skip-test-in-runtime/10329/4 "2018-09-28T04:30:44Z")

</div>

well noted! Thank you so much for the suggestion

---

<div class="post-metadata">

**Author:** ![MaKatalon](https://avatars.discourse-cdn.com/v4/letter/m/b4bc9f/32.png) [@MaKatalon](https://forum.katalon.com/u/MaKatalon)\
**Post date:** [November 14, 2018, 10:36pm UTC](https://forum.katalon.com/t/it-is-possible-to-skip-test-in-runtime/10329/5 "2018-11-14T22:36:45Z")

</div>

Hi, any news on this feature

---

<div class="post-metadata">

**Author:** ![Rudra](https://avatars.discourse-cdn.com/v4/letter/r/47e85d/32.png) [@Rudra](https://forum.katalon.com/u/Rudra)\
**Post date:** [February 10, 2019, 6:40pm UTC](https://forum.katalon.com/t/it-is-possible-to-skip-test-in-runtime/10329/6 "2019-02-10T18:40:08Z")

</div>

Yes, there is implementation on this in the listener class

```
@BeforeTestCase
def sampleBeforeTestCase(TestCaseContext testCaseContext) {
			testCaseContext.skipThisTestCase()
		}

```

This will skip all tests, You will need to add condition

---

<div class="post-metadata">

**Author:** ![umair\_aslam](https://avatars.discourse-cdn.com/v4/letter/u/8dc957/32.png) [@umair\_aslam](https://forum.katalon.com/u/umair_aslam)\
**Post date:** [February 10, 2019, 11:28pm UTC](https://forum.katalon.com/t/it-is-possible-to-skip-test-in-runtime/10329/7 "2019-02-10T23:28:33Z")

</div>

Thanks, but just as Idea:  
It still would be good to have such ability maybe supply skip function as third parameter:

it(‘should skip if not fit’, function(done, skip){  
if (fit) done() else (skip())  
}

or maybe do it with done function by supplying some paramenters done({skip: true}), by the way done(‘some message’) output is huge and like error out, I wonder why?  
[source](https://mirchmasalatv.com/)

---

<div class="post-metadata">

**Author:** ![devalex88](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/devalex88/32/336_2.png) [@devalex88](https://forum.katalon.com/u/devalex88)\
**Post date:** [March 12, 2019, 10:04am UTC](https://forum.katalon.com/t/it-is-possible-to-skip-test-in-runtime/10329/8 "2019-03-12T10:04:06Z")

</div>

Just FYI - we’ve built a TestRail integration plugin for Katalon Studio. If you have any feedback or suggestions we are happy to hear from you.

[https://store.katalon.com/product/13/TestRail-Integration](https://store.katalon.com/product/13/TestRail-Integration)

---

<div class="post-metadata">

**Author:** ![rchomicki](https://avatars.discourse-cdn.com/v4/letter/r/47e85d/32.png) [@rchomicki](https://forum.katalon.com/u/rchomicki)\
**Post date:** [January 30, 2020, 1:08pm UTC](https://forum.katalon.com/t/it-is-possible-to-skip-test-in-runtime/10329/9 "2020-01-30T13:08:12Z")

</div>

It doesn’t acctually skip the test it just marked it as passed and run the whole execution but only doesn’t care about the result, which is pretty dummy.

I expect from the method like that to not run the test at all and to not include it in the report.

---

<div class="post-metadata">

**Author:** ![ThanhTo](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/thanhto/32/697_2.png) [@ThanhTo](https://forum.katalon.com/u/ThanhTo)\
**Post date:** [January 30, 2020, 1:17pm UTC](https://forum.katalon.com/t/it-is-possible-to-skip-test-in-runtime/10329/10 "2020-01-30T13:17:30Z")

</div>

Hi @rchomicki

> [@Rudra](#):
>
> @BeforeTestCase def sampleBeforeTestCase(TestCaseContext testCaseContext) { testCaseContext.skipThisTestCase() }

This method isn’t supposed to execute the test case. Does it not work for you ?

---

<div class="post-metadata">

**Author:** ![rchomicki](https://avatars.discourse-cdn.com/v4/letter/r/47e85d/32.png) [@rchomicki](https://forum.katalon.com/u/rchomicki)\
**Post date:** [January 30, 2020, 1:32pm UTC](https://forum.katalon.com/t/it-is-possible-to-skip-test-in-runtime/10329/11 "2020-01-30T13:32:46Z")

</div>

Hi, thanks for your replay.

It works only partially for me I wanted to marked some of the tests as smoke, to not divide the data table in my DDT test suite.  
So it looks like it triggers the rest test execution, Listener example above:

> @BeforeTestCase  
> def sampleBeforeTestCase(TestCaseContext testCaseContext) {

```
	Map<String, Object> map = testCaseContext.getTestCaseVariables()
	
	
	if (GlobalVariable.smokeSuite) {
		if (!map.get("smoke")) {
			testCaseContext.skipThisTestCase()				
		}
	}		
					
	// Ignore test case create a message in log failing tests
	if (map.get('ignore')) {
		GlobalVariable.FailedTestsList += GlobalVariable.testNumber + ": " + map.get('testName') + ": IGNORED.\n\n"
		testCaseContext.skipThisTestCase(true)
		
	}
	
	// Reset counters if resetCounters variable is set on true
	if (map.get('resetCounters')) {
		WebUI.callTestCase(findTestCase('GenericTestCases/ResetCountersForUID'), [("uid"): map.get('uid')], FailureHandling.CONTINUE_ON_FAILURE)
	}
	
	// Get last known counter value and refer it to the variable
	if (map.get('cornerCondition').equals('checkCounter')) {
		GlobalVariable.lastCounterValue = WebUI.callTestCase(findTestCase('GenericTestCases/GetDataForUID'), [('uid') : map.get('uid')], FailureHandling.CONTINUE_ON_FAILURE).get('nfcCounter')
	}		
}

```

I do expect from it to stop from this moment on if the test is not marked as smoke, but it seems to go further with the rest of variables, counters reset etc which is a time consuming.  
Of course I can put the rest into the else block, but why does it happen?

Also I would like to have the information about the number of skipped tests, not passed in the report or even to not execute and include them in the test report at all.

 ![image](https://europe1.discourse-cdn.com/katalon/original/2X/9/93a57334a3630411cbb0d1393028767c2e8109e2.png)

Please let me know if I missed something.

Remi

---

<div class="post-metadata">

**Author:** ![ThanhTo](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/thanhto/32/697_2.png) [@ThanhTo](https://forum.katalon.com/u/ThanhTo)\
**Post date:** [January 30, 2020, 1:37pm UTC](https://forum.katalon.com/t/it-is-possible-to-skip-test-in-runtime/10329/12 "2020-01-30T13:37:10Z")

</div>

Regarding this:

> [@rchomicki](#):
>
> // Ignore test case create a message in log failing tests if (map.get(‘ignore’)) { GlobalVariable.FailedTestsList += GlobalVariable.testNumber + ": " + map.get(‘testName’) + “: IGNORED.\n\n” testCaseContext.skipThisTestCase(true) }

If you want the code to stop after `skipThisTestCase` is set, then you just need to add

```auto
return;

```

after it and the execution flow should be handed over to the next test listener or test case.

Regarding this:

> [@rchomicki](#):
>
> Also I would like to have the information about the number of skipped tests

I think it is a reasonable requirement, I will escalate this to the team. Thanks !

---

<div class="post-metadata">

**Author:** ![rchomicki](https://avatars.discourse-cdn.com/v4/letter/r/47e85d/32.png) [@rchomicki](https://forum.katalon.com/u/rchomicki)\
**Post date:** [January 30, 2020, 1:48pm UTC](https://forum.katalon.com/t/it-is-possible-to-skip-test-in-runtime/10329/13 "2020-01-30T13:48:01Z")

</div>

Great thanks for your advice. I though that was handled by the method itself.

---

<div class="post-metadata">

**Author:** ![Jass](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/jass/32/9588_2.png) [@Jass](https://forum.katalon.com/u/Jass)\
**Post date:** [March 13, 2020, 4:57am UTC](https://forum.katalon.com/t/it-is-possible-to-skip-test-in-runtime/10329/14 "2020-03-13T04:57:38Z")

</div>

Closed on March 13, 2020, 4:57am UTC


