I need an xray test as precondition for another test

Jürgen Wagner June 3, 2022

I have written a lot of tests with the new parameter feature ${parameter}

However, I have a lot of tests where I need the results of another tests to make further test steps.

I can include a complete test with all those test steps in my test, but that means that I have test with sometimes almost 100 teststeps. And 90% of these steps are already done in another test.

So I need to add a precondition. But in the precondition I cannot use a ${parameter}

For example:

 

I want to test if a person can be the head of a department. 

So I need to create a person

I need to create a department

I need to check if the relation is possible

I need to test this for different persons and different departments

The creation of a person is a seperate test and the creation of a department is a seperate test.

During all the testing I have already created lots of persons and lots of departments. So I just need to have a precondition, that a specific person and a specific department already exist.

If I add the test to create a person and the test to create an apartment to my test, I get looots of teststeps whiche are already done.

 

So I need to add a test with parameters as precondition or I need to use parameters in the already existing precondition field.

Is this possible?

3 answers

3 votes
Jürgen Wagner June 17, 2022

Thank you for your replies,

but maybe I was not clear enough.

I know that I can add a precondition. But I cannot use parametrs in preconditions.

For example:

The test says, add "Mr. Miller" to the department "Sales".

Now I have to have a precondition, make sure "Mr. Miller" exists. And I need a precondition which says, make sure the department "Sales" exists.

Since I have parameters, "Mr. Miller" and "Sales" is different in each iteration. But the precondition cannot use these parameters.

 

If I add a complete test as my first step, it will look like this

1. Create a person "Mr. Miller"

2. Create a department "Sales"

3. Add "Mr. Miller" to the department "Sales"

In the iterations, the first two tests will be expanded to about 25 teststeps each. And my testers have performend these steps a lot of times before. This makes the actual important teststeps somehow vanish.

Of course I can use my thre tes steps above without expanding the first two steps in comlpete tests. But if I have a new tester, which has not already performed these steps, he will not know how to create a person.

So I will either need parameters in preconditions, to I need the possibility to expand a test stept to a complete test only if needed, otherwise mark the complete test 1. or 2. as passed.

 

I know this is not possible right now. But wouldn't that be useful?

 

Greetings,

 

Jürgen 

0 votes
Andreas Morgner _ DEMICON June 16, 2022

Hi @Jürgen Wagner 

as Xray has the feature to call Tests from within other Tests, you can define your "Precondition" as a separate Xray-Test.

Once the "precondition Test" is created, you can add a step to the actual Test, that "calls" the precondition Test. 

Even if the nomenclature is wrong, this is a very common way. Also, this gives you the possibility to mark a precondition as failed or blocked, because is's a Test. 

Re. the parameter, I assume you got it already, if it's a Test, the data driven feature of parameter works here as well. But you should keep in mind the data sets have to be defined within your "precondition Test" and the actual Test. 

 

best regards

Andreas

0 votes
Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 8, 2022

Hi @Jürgen Wagner ,

a test case in jira xray is "just" a documentation of steps that need to be taken in order to test the SUT. As far as I got your requirement right the test case should discover if a precondition is already met. How should the test case know from the System under test? even if the precondition was done once it could be that the system under test changed or was set up new.

In my point of view it´s plausible as it works:
The procondition is telling you what needs to be there in order to process the test steps. That doesn´t mean the precondition needs to be processed everytime a test case is executed. It just tells you: Please make sure that this pre-condition exists!

If the precondition exists it can be checked without any action and the test steps can be executed.

Hope I got your requirement right and this was helpful.

 

Best
Stefan

Suggest an answer

Log in or Sign up to answer