Forum Discussion

ericbautista's avatar
ericbautista
New Contributor
3 years ago
Solved

Is there a way to preserve the test case order in which they appear when adding them to test cycle ?

Whenever I create a Test Cycle and add the required Test Cases, all of them appear in a random order. The test case order in which they were created is not respected and it is relevant for test execution. I cannot drag and drop as a I have more than 900 test cases within my test cycle.

 

Any ideas?

  • Hi ericbautista ,

     

    don't know, if this is an option for you, but you can create test cycles using the API. You can then specify the order of the test cases in the JSON body of the POST request for the test cycle creation.

    https://support.smartbear.com/zephyr-scale-server/api-docs/v1/

    The endpoint to use is .../jira/rest/atm/1.0/testrun/ (POST) and the body would look something like this.

    {
      "projectKey": "TESTMNGT",
      "name": "Test Cycle",
      "items": [
        {"testCaseKey": "I017058-T3069"},
        {"testCaseKey": "I017058-T2880"},
        {"testCaseKey": "I017058-T2878"},
        {"testCaseKey": "TFREP-T12"},
        {"testCaseKey": "TFREP-T186"},
        {"testCaseKey": "TFREP-T187"},
        {"testCaseKey": "I017058-T309"},
        {"testCaseKey": "I017058-T313"},
        {"testCaseKey": "I017058-T2640"},
        {"testCaseKey": "I017058-T9057"},
        {"testCaseKey": "I017058-T1360"},
        {"testCaseKey": "I017058-T315"},
        {"testCaseKey": "I017058-T11851"},
        {"testCaseKey": "I017058-T14865"},
        {"testCaseKey": "I017058-T9054"},
        {"testCaseKey": "I017058-T14869"},
        {"testCaseKey": "I017058-T2879"},
        {"testCaseKey": "I017058-T14895"},
        {"testCaseKey": "I017058-T264"},
        {"testCaseKey": "I017058-T11988"},
        {"testCaseKey": "TFREP-T13"},
        {"testCaseKey": "I017058-T16245"},
        {"testCaseKey": "I017058-T4022"},
        {"testCaseKey": "I017058-T1517"},
        {"testCaseKey": "I017058-T6939"}
      ]
    }

    The test cases are then added to the created test cycles in exactly the order they are in the list paased in the JSON body of the POST request. So you could write a script using this endpoint to create your test cycles and ensure the order is exactly as you want it.

     

    Maybe this helps. 🙂

    Cheers

    Josh

4 Replies

  • MisterB's avatar
    MisterB
    Champion Level 3

    The order of the test cases within a cycle is determined by the order in which they are added, with the most recent test case additions being placed at the top.

     

    For example:

    Let's say we have 3 test cases named A, B, C

    I want to execute those cases in the order of A, B, C

    The test cases have the following test keys A=1, B=2, C=3

    The order that of cases within a cycle is determined by 1) their Key, and 2) if I add them in separate batches

    So...

    If I add C & A together and click the Add button to commit, even though I chose a specific order (C, then A), their keys are 3 & 1, and the keys determine the order so they will be displayed as A, then C (not C, then A).

    If I next add B and click the Add button to commit, B will appear at the top of the list

     

    I don't know if this will help with your current problem but I can't think of a way out of that - other than contacting the SmartBear support team to see if they can help.  Or maybe you have access to the underlying database and can script a fix.

     

     

    • josh42's avatar
      josh42
      Community Hero

      Hi ericbautista ,

       

      don't know, if this is an option for you, but you can create test cycles using the API. You can then specify the order of the test cases in the JSON body of the POST request for the test cycle creation.

      https://support.smartbear.com/zephyr-scale-server/api-docs/v1/

      The endpoint to use is .../jira/rest/atm/1.0/testrun/ (POST) and the body would look something like this.

      {
        "projectKey": "TESTMNGT",
        "name": "Test Cycle",
        "items": [
          {"testCaseKey": "I017058-T3069"},
          {"testCaseKey": "I017058-T2880"},
          {"testCaseKey": "I017058-T2878"},
          {"testCaseKey": "TFREP-T12"},
          {"testCaseKey": "TFREP-T186"},
          {"testCaseKey": "TFREP-T187"},
          {"testCaseKey": "I017058-T309"},
          {"testCaseKey": "I017058-T313"},
          {"testCaseKey": "I017058-T2640"},
          {"testCaseKey": "I017058-T9057"},
          {"testCaseKey": "I017058-T1360"},
          {"testCaseKey": "I017058-T315"},
          {"testCaseKey": "I017058-T11851"},
          {"testCaseKey": "I017058-T14865"},
          {"testCaseKey": "I017058-T9054"},
          {"testCaseKey": "I017058-T14869"},
          {"testCaseKey": "I017058-T2879"},
          {"testCaseKey": "I017058-T14895"},
          {"testCaseKey": "I017058-T264"},
          {"testCaseKey": "I017058-T11988"},
          {"testCaseKey": "TFREP-T13"},
          {"testCaseKey": "I017058-T16245"},
          {"testCaseKey": "I017058-T4022"},
          {"testCaseKey": "I017058-T1517"},
          {"testCaseKey": "I017058-T6939"}
        ]
      }

      The test cases are then added to the created test cycles in exactly the order they are in the list paased in the JSON body of the POST request. So you could write a script using this endpoint to create your test cycles and ensure the order is exactly as you want it.

       

      Maybe this helps. 🙂

      Cheers

      Josh