# Adding test cases through command line

**URL:** <https://forum.katalon.com/t/adding-test-cases-through-command-line/38623>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [January 14, 2020, 1:20pm UTC](https://forum.katalon.com/t/adding-test-cases-through-command-line/38623 "2020-01-14T13:20:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![libra.soumya17](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/libra.soumya17/32/11959_2.png) [@libra.soumya17](https://forum.katalon.com/u/libra.soumya17)\
**Post date:** [January 14, 2020, 1:20pm UTC](https://forum.katalon.com/t/adding-test-cases-through-command-line/38623/1 "2020-01-14T13:20:37Z")

</div>

Hi,

Is there a way that I can create a test suite and add test cases to it through command?  
What i want is that whatever test cases are failed in my CI-CD pipeline, I want to re-execute them (only failed tests). I want to create a test suite, add those failed TCs in it and re-execute the stage. All in CI-CD so Im looking for such command.

Regards  
Soumya

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [January 14, 2020, 1:55pm UTC](https://forum.katalon.com/t/adding-test-cases-through-command-line/38623/2 "2020-01-14T13:55:22Z")

</div>

> [@libra.soumya17](#):
>
> whatever test cases are failed in my CI-CD pipeline, I want to re-execute them (only failed tests).

I am sure there is no such build-in automatic functionality in Katalon Studio.

* * *

In a definition of a Test Suite, each Test Case is marked with attribute “Run” with value On/Off. You can manually select which test case to run.

 ![スクリーンショット 2020-01-14 22.33.53](https://europe1.discourse-cdn.com/katalon/original/2X/b/b6f7cad1c1b28a735e4e4325e5068d5a4e1e36a0.png)

* * *

In a Katalon project there are files `<projectDir>/Test Suites/folder name/<test case name>.ts` which has such code snipet:

```auto
    <testCaseLink>¶                                                                                                              
       <guid>cbec7f36-1c4f-4ede-ae10-35dbfc07d946</guid>¶                                                                        
       <isReuseDriver>false</isReuseDriver>¶                                                                                     
       <isRun>true</isRun>¶                                                                                                      
       <testCaseId>Test Cases/CURA/restorePreviousScreenshots</testCaseId>¶                                                      
    </testCaseLink>¶       

```

I believe that the `<isRun>` here denotes On/Off value you check for the `Run` attribute in the GUI.

If you want to, you can write and run a script that modifies the `<isRun>` value in the \*.ts file,

* * *

How do you determin which test case to turn On/Off for `<isRun>`?

In the `<projectDir>/Reports/yyyyMMdd_hhmmss/folders/<test suite name>/yyyyMMdd_hhmmss/JUnit_Report.xml`. In the file you can find such code fragments:

```auto
 <testsuites name="chronos_capture" time="51" tests="2" failures="1" errors="0">¶                                                
    <testsuite name="chronos_capture" tests="2" failures="1" errors="0" time="51" timestamp="2019-10-10 22:43:08" id="Test Suites/CURA/chronos_capture">¶                                                                   
    ....   
        <testcase name="Test Cases/CURA/restorePreviousScreenshots" status="FAILED">¶          

```

If you develop a script to read the JUnit\_Report.xml file, then you can find which test cases of which test case failed so that you want to run again later.

---

<div class="post-metadata">

**Author:** ![Russ\_Thomas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/russ_thomas/32/11884_2.png) [@Russ\_Thomas](https://forum.katalon.com/u/Russ_Thomas)\
**Post date:** [January 14, 2020, 5:43pm UTC](https://forum.katalon.com/t/adding-test-cases-through-command-line/38623/3 "2020-01-14T17:43:26Z")

</div>

Good answer, Kaz.

This requirement has been mentioned before - build a test suite programmatically (with and easy way to take fails form one suite and pass them to a retest-suite).

---

<div class="post-metadata">

**Author:** ![anon46315158](https://avatars.discourse-cdn.com/v4/letter/a/73ab20/32.png) [@anon46315158](https://forum.katalon.com/u/anon46315158)\
**Post date:** [January 14, 2020, 6:01pm UTC](https://forum.katalon.com/t/adding-test-cases-through-command-line/38623/4 "2020-01-14T18:01:50Z")

</div>

> [@Russ\_Thomas](#):
>
> This requirement has been mentioned before - build a test suite programmatically (with and easy way to take fails form one suite and pass them to a retest-suite).

‘Love’ this solution.  
With the amendment … this will only confuse the main scope of automated tests, relevancy.  
Unless fuzz testing is desired.

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [January 14, 2020, 9:44pm UTC](https://forum.katalon.com/t/adding-test-cases-through-command-line/38623/5 "2020-01-14T21:44:03Z")

</div>

> [@anon46315158](#):
>
> this will only confuse the main scope of automated tests, relevancy.

I agree with @anon46315158.

I would not mind repeating all test cases, regardless passed or failed in the previous run, every time I run a test suite. Especially in a CI/CD process, I would not mind the burden of redoing already-passed tests because my machine takes it and I can be away from the redo.
