Batch Job Testing

Ranorex Studio, Spy, Recorder, and Driver.
gary
Posts: 17
Joined: Thu Sep 22, 2016 2:52 pm

Batch Job Testing

Post by gary » Fri Feb 24, 2017 12:25 pm

Hi all

I am relatively new to Ranorex and using the evaluation version 6.1. I'll be primarily relying on record and play option as I am not very familiar with the coding side of things.
A quick overview on what my application under test do :
My application under test has to run a specific batch job. Once the job is kicked off it moves that specific batch job to 'Jobs' tab which displays the batch job name/id and its state (eg: 'running', 'could not start' or 'failed'). Once the job is finished running it moves to 'Finished Jobs' tab where the job state is updated to 'Finished'. Kindly refer to the attached screenshot which will help to understand this better.

Stuff I want Ranorex to do :
I wish to design a test where once the batch job is started
Condition 1 - Ranorex finds that specific job with its job id in 'jobs' tab and checks for its state (eg: 'running', 'could not start' or 'failed').
Condition 2 - If the job state is anything else other than 'running' the test fails
Condition 3 - If the job state is 'running' it waits for while and again looks at that job id and its state
Condition 4 - Condition 3 is a loop unless Ranorex could not find that job id in 'Jobs' tab' and at this stage it will then go to 'Finished Jobs' tab to check for the Job Id. If found, then the test will be Passed

I think the above can be achieved through coding easily but I am not too familiar with codes therefore I was wondering if someone can help me to design this with record and play. Thank you.
You do not have the required permissions to view the files attached to this post.

McTurtle
Posts: 297
Joined: Thu Feb 23, 2017 10:37 am
Location: Benedikt, Slovenia

Re: Batch Job Testing

Post by McTurtle » Fri Feb 24, 2017 3:02 pm

Hello Gary,

I do not have access to your application so I will use some other application where I imagine the structure could be similar.

Your table will probably hold multiple jobs at the same time, some have a valid Job Key and some not? I can give you some directions for only 1 row.

For Condition 1 and Condition 2 you can use a validate action. We first need a repository object. Use the "Track" function of Ranorex spy and click the Job Key (in your case on JQ00240963). Now drag and drop the recognized element from the Ranorex spy into the repository of the Ranorex Studio.
DragAndDrop.png
This will probably be recognized as a cell with your text in the attribute "Text". Something like table[???]//cell[@text='JQ00240963'].

Now drag and drop the object from the repository into the action table and select "As new variable" under the Match Value as in the screenshot below.
Validate.png
Now create a new variable. This variable you will later have to connect to a data source, something that will include all the possible JobIDs for which you want your test to continue. For more info on data-binding read the User Guide, Lesson 3: Data-driven Testing (Sorry, not lazy, just can't paste links, Forum Policy).

You should now validate the Job State in the same row using an xpath expression which at its end will have /?/?/row/cell[@text='variableJobID']/../cell[@text='running'].

The above need a little bit of explanation and I think is key to your test working. What it does:

1. /?/?/row/cell[@text='variableJobID'] will find the row with your Job Key
2. /../ will go one step back in the tree
3. cell[@text='running'] will branch off to the column with Job State

For Condition 3 we should use the "Wait For"->Exists action. Simply make a copy of your repository object, the path of the object should be changed a bit. /?/?/row/cell[@text='variableJobID']/../cell[@text='running'] -> /?/?/row/cell[@text='variableJobID']/../cell[@text='Finished'].

If you do not use a status for finished projects in the "Jobs" view, but, let's say, they just disappear and go to "Finished Jobs". You can use "Wait For"->NotExists on the object with the RanorexPath in "Jobs" /?/?/row/cell[@text='variableJobID']/../cell[@text='running']. Now it will wait for the job to disappear and then you simply use a mouse click to the next tab and have a validate action for /?/?/row/cell[@text='variableJobID']/../cell[@text='Finished'] there in order to fulfill condition 4.

Now I am not sure if you will be able to build this for your application. It would be good if we had a snapshot of your application, we would sure be able to provide you with more exact instructions.

Google "How to create a Ranorex Snapshot" and paste a snapshot. Again, sorry, not lazy, just can't place links.


Regards,
McTurtle
You do not have the required permissions to view the files attached to this post.

gary
Posts: 17
Joined: Thu Sep 22, 2016 2:52 pm

Re: Batch Job Testing

Post by gary » Mon Feb 27, 2017 9:46 am

McTurtle wrote:Hello Gary,

I do not have access to your application so I will use some other application where I imagine the structure could be similar.

Your table will probably hold multiple jobs at the same time, some have a valid Job Key and some not? I can give you some directions for only 1 row.

For Condition 1 and Condition 2 you can use a validate action. We first need a repository object. Use the "Track" function of Ranorex spy and click the Job Key (in your case on JQ00240963). Now drag and drop the recognized element from the Ranorex spy into the repository of the Ranorex Studio.
DragAndDrop.png
This will probably be recognized as a cell with your text in the attribute "Text". Something like table[???]//cell[@text='JQ00240963'].

Now drag and drop the object from the repository into the action table and select "As new variable" under the Match Value as in the screenshot below.
Validate.png
Now create a new variable. This variable you will later have to connect to a data source, something that will include all the possible JobIDs for which you want your test to continue. For more info on data-binding read the User Guide, Lesson 3: Data-driven Testing (Sorry, not lazy, just can't paste links, Forum Policy).

You should now validate the Job State in the same row using an xpath expression which at its end will have /?/?/row/cell[@text='variableJobID']/../cell[@text='running'].

The above need a little bit of explanation and I think is key to your test working. What it does:

1. /?/?/row/cell[@text='variableJobID'] will find the row with your Job Key
2. /../ will go one step back in the tree
3. cell[@text='running'] will branch off to the column with Job State

For Condition 3 we should use the "Wait For"->Exists action. Simply make a copy of your repository object, the path of the object should be changed a bit. /?/?/row/cell[@text='variableJobID']/../cell[@text='running'] -> /?/?/row/cell[@text='variableJobID']/../cell[@text='Finished'].

If you do not use a status for finished projects in the "Jobs" view, but, let's say, they just disappear and go to "Finished Jobs". You can use "Wait For"->NotExists on the object with the RanorexPath in "Jobs" /?/?/row/cell[@text='variableJobID']/../cell[@text='running']. Now it will wait for the job to disappear and then you simply use a mouse click to the next tab and have a validate action for /?/?/row/cell[@text='variableJobID']/../cell[@text='Finished'] there in order to fulfill condition 4.

Now I am not sure if you will be able to build this for your application. It would be good if we had a snapshot of your application, we would sure be able to provide you with more exact instructions.

Google "How to create a Ranorex Snapshot" and paste a snapshot. Again, sorry, not lazy, just can't place links.


Regards,
McTurtle
Hi McTurtle

Firstly, thank you for taking the time out and providing the detail description on how to automate this. Appreciate your time and help.

You are correct, the table will hold multiple jobs at the same time, however all of them will have a valid job key which is unique everytime a batch job is run. Under no circumstances a job key will be invalid.

I'll spend some time to automate this based on your instructions and see how far I can go. I'll give you a shout with snapshot if I stuck somewhere.

Thanks again.

Regards
G

gary
Posts: 17
Joined: Thu Sep 22, 2016 2:52 pm

Re: Batch Job Testing

Post by gary » Mon Feb 27, 2017 1:18 pm

gary wrote:
McTurtle wrote:Hello Gary,

I do not have access to your application so I will use some other application where I imagine the structure could be similar.

Your table will probably hold multiple jobs at the same time, some have a valid Job Key and some not? I can give you some directions for only 1 row.

For Condition 1 and Condition 2 you can use a validate action. We first need a repository object. Use the "Track" function of Ranorex spy and click the Job Key (in your case on JQ00240963). Now drag and drop the recognized element from the Ranorex spy into the repository of the Ranorex Studio.
DragAndDrop.png
This will probably be recognized as a cell with your text in the attribute "Text". Something like table[???]//cell[@text='JQ00240963'].

Now drag and drop the object from the repository into the action table and select "As new variable" under the Match Value as in the screenshot below.
Validate.png
Now create a new variable. This variable you will later have to connect to a data source, something that will include all the possible JobIDs for which you want your test to continue. For more info on data-binding read the User Guide, Lesson 3: Data-driven Testing (Sorry, not lazy, just can't paste links, Forum Policy).

You should now validate the Job State in the same row using an xpath expression which at its end will have /?/?/row/cell[@text='variableJobID']/../cell[@text='running'].

The above need a little bit of explanation and I think is key to your test working. What it does:

1. /?/?/row/cell[@text='variableJobID'] will find the row with your Job Key
2. /../ will go one step back in the tree
3. cell[@text='running'] will branch off to the column with Job State

For Condition 3 we should use the "Wait For"->Exists action. Simply make a copy of your repository object, the path of the object should be changed a bit. /?/?/row/cell[@text='variableJobID']/../cell[@text='running'] -> /?/?/row/cell[@text='variableJobID']/../cell[@text='Finished'].

If you do not use a status for finished projects in the "Jobs" view, but, let's say, they just disappear and go to "Finished Jobs". You can use "Wait For"->NotExists on the object with the RanorexPath in "Jobs" /?/?/row/cell[@text='variableJobID']/../cell[@text='running']. Now it will wait for the job to disappear and then you simply use a mouse click to the next tab and have a validate action for /?/?/row/cell[@text='variableJobID']/../cell[@text='Finished'] there in order to fulfill condition 4.

Now I am not sure if you will be able to build this for your application. It would be good if we had a snapshot of your application, we would sure be able to provide you with more exact instructions.

Google "How to create a Ranorex Snapshot" and paste a snapshot. Again, sorry, not lazy, just can't place links.


Regards,
McTurtle
Hi McTurtle

Firstly, thank you for taking the time out and providing the detail description on how to automate this. Appreciate your time and help.

You are correct, the table will hold multiple jobs at the same time, however all of them will have a valid job key which is unique everytime a batch job is run. Under no circumstances a job key will be invalid.

I'll spend some time to automate this based on your instructions and see how far I can go. I'll give you a shout with snapshot if I stuck somewhere.

Thanks again.

Regards
G
Hi McTurtle

Frankly, I struggled to built this for my application :)

I have attached a snapshot of my SUT. Let me know if the snapshot is not very helpful and I'll try to recreate another one. Thanks


Regards
G
You do not have the required permissions to view the files attached to this post.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Batch Job Testing

Post by odklizec » Mon Feb 27, 2017 1:47 pm

Hi,

At first, the snapshot you posted revealed that you are using Ranorex 6.1.1, which is too old and no longer supported. Please update to latest 6.2.1.

At next, the table you are working with is apparently not fully recognized by Ranorex. The only cells it recognized is the one with Job Code in selected table row.

Are you able to track the individual table cells? If not, your only hope is most probably a GDI Capture and RAW texts. Unfortunately, working with RAW texts is complicated and not always satisfying, especially with complicated tables, so it may not be easy to achieve what you want.

If I'm not mistaken, the table in question is DevExpress-based? What you can try is to play a bit with the Ranorex settings, particularly the WPF settings in Plugins section. Try to enable "Realize Items in Virtualizing Containers" and "Show All Elements", eventually, play a bit with "WPF Legacy/UIA Interaction" options.

If nothing of these helps, then I'm afraid, GDI Capture is your only hope (aside implementing proper accessibility support in your 3rd party table control).

BTW, check also these WPF-related posts for some more suggestions:
http://www.ranorex.com/search.html?q=devexpress
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

gary
Posts: 17
Joined: Thu Sep 22, 2016 2:52 pm

Re: Batch Job Testing

Post by gary » Thu Mar 02, 2017 3:11 pm

odklizec wrote:Hi,

At first, the snapshot you posted revealed that you are using Ranorex 6.1.1, which is too old and no longer supported. Please update to latest 6.2.1.

At next, the table you are working with is apparently not fully recognized by Ranorex. The only cells it recognized is the one with Job Code in selected table row.

Are you able to track the individual table cells? If not, your only hope is most probably a GDI Capture and RAW texts. Unfortunately, working with RAW texts is complicated and not always satisfying, especially with complicated tables, so it may not be easy to achieve what you want.

If I'm not mistaken, the table in question is DevExpress-based? What you can try is to play a bit with the Ranorex settings, particularly the WPF settings in Plugins section. Try to enable "Realize Items in Virtualizing Containers" and "Show All Elements", eventually, play a bit with "WPF Legacy/UIA Interaction" options.

If nothing of these helps, then I'm afraid, GDI Capture is your only hope (aside implementing proper accessibility support in your 3rd party table control).

BTW, check also these WPF-related posts for some more suggestions:
http://www.ranorex.com/search.html?q=devexpress
Hi Odklizek

Hi

Yes I am able to track the individual cell itself for eg: If the value in cell is 500 it recognizes the cell as text (if this is what you mean by identifying the cell)
I don't really know what you mean by the table in question is DevExpress-based.....sorry can't answer this.
I played around with your recommended setting but not much of a help. Now I really don't know how to use GDI capture ?
Also my concern here is validation. After validating a cell when I run the test it fails as Ranorex tries to validate the cell of a different row. For eg; I validated a cell in row D but when I execute my test it tries to validate the cell in row C and the test fails.
I have attached the snapshot for your reference in which I was trying to validate a cell with text 'Purchase' but when I run my test it looks for a cell above and tries to validate a cell with text 'Sale' which fails my test.
You do not have the required permissions to view the files attached to this post.

gary
Posts: 17
Joined: Thu Sep 22, 2016 2:52 pm

Re: Batch Job Testing

Post by gary » Thu Mar 02, 2017 3:41 pm

gary wrote:
odklizec wrote:Hi,

At first, the snapshot you posted revealed that you are using Ranorex 6.1.1, which is too old and no longer supported. Please update to latest 6.2.1.

At next, the table you are working with is apparently not fully recognized by Ranorex. The only cells it recognized is the one with Job Code in selected table row.

Are you able to track the individual table cells? If not, your only hope is most probably a GDI Capture and RAW texts. Unfortunately, working with RAW texts is complicated and not always satisfying, especially with complicated tables, so it may not be easy to achieve what you want.

If I'm not mistaken, the table in question is DevExpress-based? What you can try is to play a bit with the Ranorex settings, particularly the WPF settings in Plugins section. Try to enable "Realize Items in Virtualizing Containers" and "Show All Elements", eventually, play a bit with "WPF Legacy/UIA Interaction" options.

If nothing of these helps, then I'm afraid, GDI Capture is your only hope (aside implementing proper accessibility support in your 3rd party table control).

BTW, check also these WPF-related posts for some more suggestions:
http://www.ranorex.com/search.html?q=devexpress
Hi Odklizek

Hi

Yes I am able to track the individual cell itself for eg: If the value in cell is 500 it recognizes the cell as text (if this is what you mean by identifying the cell)
I don't really know what you mean by the table in question is DevExpress-based.....sorry can't answer this.
I played around with your recommended setting but not much of a help. Now I really don't know how to use GDI capture ?
Also my concern here is validation. After validating a cell when I run the test it fails as Ranorex tries to validate the cell of a different row. For eg; I validated a cell in row D but when I execute my test it tries to validate the cell in row C and the test fails.
I have attached the snapshot for your reference in which I was trying to validate a cell with text 'Purchase' but when I run my test it looks for a cell above and tries to validate a cell with text 'Sale' which fails my test.
I would also like to mention that I do not get error reports for failed test anymore. it was alll working fine until yesterday but it all disappeared today.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Batch Job Testing

Post by odklizec » Fri Mar 03, 2017 8:44 am

Hi,

I'm afraid, the snapshot you sent seems does not contain the data for individual grid cells? The snapshot ends at TomGridSite element and there is no way to expand and examine the individual cells in given grid. So I'm not quite sure, how you are able to track the individual cells?

Also, without seeing an example of xpath you are using (to identify and validate a cell) and your actual recording/code module used for validation, there is not much anyone here can do. I would suggest to send an email to [email protected] (Ranorex support forum) and ask them for a remote session, so they may look around your app and try some Ranorex settings adjustments.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration