jirajira-xray

How to use preconditions in Jira X-Ray?


Maybe these are dumb questions but i always struggle with this:

  1. If i have tests with the same precondition (login for example), is it better to create a precondition named "login.." or recalling a test issue with the login steps using "call test" feature, like:

enter image description here

  1. I have to run a test but, before running it, i have to login and setup the environment. In the test, should i insert 2 preconditions? one for login and one for environment setup, or just one precondition named "environment setup" which intrinsically also requires login?

Solution

  • A precondition is about assuring that some condition is met before you start executing a test; it is irrelevant how you assure that condition as you're not testing it; it's like the test setup code on test automation code. As an example, you can have a precondition "user is authenticated as manager", or "system without any recorded transactions".

    In the other hand, Xray also allows you have "modular tests", where one test can call another test; this can be useful for more business related flows / user journeys.

    Tests should be isolated, as much as possible though for several reasons; one of them, is that you want to clearly and quickly identify what is broken and the root-cause of it.

    If you aim to make a test for the checkout part of an e-commerce web site, you don't want to test the login process as part of it and go over the details of testing the login process.

    Going to your questions:

    1. I would not recommend calling a "login test" as part of a test, for the reason(s) explained above

    2. How do you manage preconditions, is something that you have to evaluate and see what works best for you and your team. Nevertheless, I would suggest that you avoid having ton of them; you can include several preconditions as part of a Test, by a given order; items to have in mind:

    a) avoid having too much granular preconditions; focus on what's really relevant for the test(s)

    b) are these preconditions reusable, or they specific just to one or two tests? if they're not reusable, then it can become part of a given test