| || |
I have a script for an insurance application that will go through and create quotes for multiple states. You can also set up the data table to add up to 8 drivers and 8 vehicles to the policy.
Now what I would like to do but I am not sure how feasible or practicle it is, is to add checkpoints at the final quote page.
The problem is that this page will display differently depending on a variety of factors.
Items displayed on the page are:
The quote price
The coverage amounts for each vehicle (coverages vary from state to state i.e. one state may offer one type of coverage for collision but another state does not) so depending on how many vehicles were added there could be up to 8 columns of coverage information and anywhere from 5 rows of coverage types up to 12 or 13.
The coverage for each driver again can vary from state to state but usually only has one type. Again you could have anywhere from 1 to 8 drivers.
Now is it realistic to think that you could put in checkpoints to ensure that everything is showing up the way it should on the page. In theory there could be at max 8 vehicles listed with 8 drivers or any combination thereof.
If it is possible could anyone point me in the right direction to get started doing it. I know it will take some work if it is feasible so if I could get some sort of starting point I can work the rest out myself over time.
Thanks for the help.
Re: Dynamic checkpoints
What you need is a data-driven framework. Basically, I would start like this:
Create a bunch of parameters (column headers) in the datatable. Parameters like state, driver1, driver2, vehicle1, vehicle2, etc. You would also need parameters for any expected result like quote price, coverage for vehicle1, coverage for user1, etc.
Once you set up your parameters, now you create rows in the datatable. Each row should contain both the data to be entered into the application and the expected values that should result from that data.
Ideally, you have your company's information, probably printed in a book or in some older software package, that you can use to accurately determine the correct expected values. You would not want to determine the expected values using the software you are testing.
Now set up your script to enter the parameters as it goes through the insurance quote process. Soemthing like:
Browser().page().edit("state") = datatable("state")
When it gets to the final screen, use a bunch of .GetROProperty statements to verify what is displayed and compare against expected values in the datatable. Something like:
x = Browser().page().edit("state")
If x = datatable("state") Then '
Note that nowhere in this process do you create a checkpoint - just using variables and datatable parameters.
You can create your datatable in MS Excel then import it into the datatable. You could even leave your data in an .xls file and import it dynamically with a Datatable.GetSheet.Import statement in your script. I like useing Excel because I can copy/paste/autofill to create tons of rows for data very quickly. I could even enter some formulas to automagically calculate expected results.
Once this is done, you simply have to maintain the datatable for future testing - no updating checkpoints.
Another possibility, slightly different from the method above, is to not put any expected values in your datatable. You create code in your script to calculate/derive expected values based on the parameters in the datatable, then compare the final screen to your calculated expectations. Of course, this method assumes that you can write the script to accurately calculate expected values - you will have to QA your own scripts before you can trust the scripts to QA the application. This is a good alternative if the calculations are fairly simple - it saves you from extra work preparing and maintaining your datatable.
Of course, this is a pretty simplified approach. But it's a beginning. Hopefully that should get you started in the right direction.
Re: Dynamic checkpoints
Thank you for the response. I have another question I understand what you said about the data driven test and that is how my test is set up I just need to add more parameters as I go.
My other question is this: I have a tool that can pull the XML which contains all the data for the quote at the end (ie. drivers, vehicles, coverages, birthdays etc. basically every choice and bit of data that was entered or chosen along the way to create the quote in addition to backend data which came from those selections)
Would it be easier to validate all the data using the XML feature than going the route you suggested?
The only thing I'm not too sure on would be how to do it (of course [img]images/icons/smile.gif[/img] ) Lets say in my data sheet I chose to add 3 vehicles to the quote can I pull out the XML tag and validate that against my data sheet? It would require extensive data sheets but that would just be putting in the time to create them.
Thanks again for the help.
Re: Dynamic checkpoints
I am not sure what you mean.
Are you thinking of putting the XML tag into your datatable as the expected value? Or converting the XML tag to a format that matches the format of your datatable parameter?
Not knowing how this tool works, I can only speculate on how to use it best.
Can you automate the XML tool? By that I mean create a script that launches the tool, runs it, then parses the result (whatever data the tool outputs) into something you can use? If it's possible, you can probably just hit record and record yourself using the XML tool. If that's workable, then you can just compare the results of the two scripts (add some lines to the XML Tool script that compares the parsed results to the parameters in your datatable).
I don't know how well this will work. Maybe it's just easier to write the GetROProperty steps.
I don't know if that helps much. Without getting my hands on it, I don't know that I can offer more direct advice.
Re: Dynamic checkpoints
Well it looks like what I can do is instead of creating datasheets I can create a variety of xml documents and use the xml compare function in QTP to compare the values in my test run xml to the expected values that are in my pre-made xml files.
So if I set up a scenario that say has 2 drivers and 2 vehicles when I get to the final page I can pull the xml using my tool and place that into a document. Then I can load in the xml document that has the expected results for that scenario and see if they match.
It will actually (for my purposes) be more accurate as I will be able to ensure that the rules are firing correctly (a lot of them work in the background and would have no affect on how the page the user sees looks)
It is sort of along the same lines as creating datatables but this way I create xml's instead.
Thanks for the responses I guess it helps me to talk these things through and figure out how I want to do something.
So here is the plan in a nutshell.
1) Run script to get to final page (data sheets will set be used to set up vaious scenarios)
2) Get to the final page where the policy quote displays and use my xml tool to display the xml in the browser.
3) Use the GetData method to pull the xml into a data object.
4) ?? Still need to figure this part out need to get the data from the data object to a file. (At least I think I do I am not sure yet if I can do a compare between a data object and a file)
5) Load my expected result xml file and do a compare with the xml I pulled during the script.
6) End if they match great if not you can create a diff file to show what was different.
[ 02-14-2005, 07:19 AM: Message edited by: scottv42 ]