jsnapy icon indicating copy to clipboard operation
jsnapy copied to clipboard

Feature Request: Test ID

Open dmontagner opened this issue 9 years ago • 3 comments

Type: Feature Request Name: Test ID Submitter: Diogo Montagner [email protected] Description:

Each test must have a unique ID. The ID can be a numeric ID, a hash, a string, etc.

dmontagner avatar Feb 27 '16 01:02 dmontagner

@dmontagner : Is this id same as the one used inside test cases. For example:

       test_command_version:
       - command: show interfaces terse lo* 
       - iterate:
         xpath: physical-interface
         id: './name'
         tests:
         - no-diff: oper-status       # element in which test is performed
           err: "Test Failed!! "
           info: " Test Passed"

Or are you suggesting some different id. Can you please give some example and its use case.

Jainpriyal avatar Feb 27 '16 05:02 Jainpriyal

It is a different ID.

It is an ID that uniquely identify a test within a configuration file.

I will send a better example.

Sent from my iPhone

On 27 Feb 2016, at 16:51, Priyal Jain <[email protected]mailto:[email protected]> wrote:

@dmontagnerhttps://github.com/dmontagner : Is this id same as the one used inside test cases. For example:

   test_command_version:
   - command: show interfaces terse lo*
   - iterate:
     xpath: physical-interface
     id: './name'
     tests:
     - no-diff: oper-status       # element in which test is performed
       err: "Test Failed!! "
       info: " Test Passed"

Or are you suggesting some different id. Can you please give some example and its use case.

Reply to this email directly or view it on GitHubhttps://github.com/Juniper/jsnapy/issues/52#issuecomment-189580600.

dmontagner avatar Feb 27 '16 06:02 dmontagner

Hi Priyal,

here is a better explanation. There two options of ID as far as I can see. One is using string and other is using numeric ID.

Using string:

 test_command_version:  <<<<<<<<<<<<<<<<< ID=1
   - command: show interfaces terse lo*
   - iterate:          <<<<<<<<<<<<<<<< ID=1
     xpath: physical-interface
     id: './name'
     tests:
     - no-diff: oper-status       # element in which test is performed <<<<<<<<<<<< ID=1
       err: "Test Failed!! "
       info: " Test Passed”
     - no-diff: admin-status       # element in which test is performed <<<<<<<<<<<< ID=2
       err: "Test Failed!! "
       info: " Test Passed”

   - iterate:          <<<<<<<<<<<<<<<< ID=2
     xpath: logical-interface
     id: './name'
     tests:
     - no-diff: oper-status       # element in which test is performed <<<<<<<<<<<< ID=1
       err: "Test Failed!! "
       info: " Test Passed”
     - no-diff: admin-status       # element in which test is performed <<<<<<<<<<<< ID=2
       err: "Test Failed!! "
       info: " Test Passed”

ID= 1.1.1 = show interface terse lo* iterating on physical-interface with test on no-diff oper-status ID= 1.1.2 = show interface terse lo* iterating on physical-interface with test on no-diff admin-status ID= 1.2.1 = show interface terse lo* iterating on logical-interface with test on no-diff oper-status ID= 1.2.2 = show interface terse lo* iterating on logical-interface with test on no-diff admin-status

Using integer, you could have an unique integer ID for the 4 tests above, say 1,2,3 and 4.

These IDs could either be placed manually and made optional or automatically assigned by the JSNAPy parser according to its order of appearance in the test file.

This will help when extracting the output and storing in the DB. You could say: this is the output of test #123 of the configuration file abc.conf.

Thanks

Diogo Montagner Juniper Networks Mobile: +61 499 075 297 Phone: +61 3 9655 8368 (ext 18368) [email protected] http://www.juniper.net

From: Priyal Jain <[email protected]mailto:[email protected]> Reply-To: Juniper/jsnapy <[email protected]mailto:[email protected]> Date: Saturday, 27 February 2016 16:51 To: Juniper/jsnapy <[email protected]mailto:[email protected]> Cc: Diogo Montagner <[email protected]mailto:[email protected]> Subject: Re: [jsnapy] Feature Request: Test ID (#52)

@dmontagnerhttps://github.com/dmontagner : Is this id same as the one used inside test cases. For example:

   test_command_version:
   - command: show interfaces terse lo*
   - iterate:
     xpath: physical-interface
     id: './name'
     tests:
     - no-diff: oper-status       # element in which test is performed
       err: "Test Failed!! "
       info: " Test Passed"

Or are you suggesting some different id. Can you please give some example and its use case.

— Reply to this email directly or view it on GitHubhttps://github.com/Juniper/jsnapy/issues/52#issuecomment-189580600.

dmontagner avatar Feb 29 '16 19:02 dmontagner