Suppose you have automation tests (my example uses Selenium) to assert complex business logic for a web site. What is the best way to assert that thousands of different test cases are outputting the correct values in the software? I thought about just copying the business logic that the actual software uses for the values we're expecting, but then wouldn't that just be re-inventing the wheel?
The goal is to assert that shipping is correct for all order scenarios. eCommerce site has 50,000 products (let's suppose). The shipping costs are determined based on the shipping provider and rates for each client, extra handling fees, base shipping rates whether the user is a wholesaler, retailer, might factor in product quantity thresholds depending on types of items ordered, etc..
Should we move this business logic (from our site server code) to our assert business logic in our Selenium code library when the automation test cases run for all products? Or should we hard code the shipping cost for thousands of products given the parameters of those test cases?
Let me rephrase the question...
All of the test cases I've done in the past have been making sure site features don't break when enhancements are made to our software (ie: all pages in a workflow work and don't crash--like placing an order, create a product given a set of values and making sure the product has the same values when editing the product, redirects work properly, etc..). Those test cases are simple to write. However, with what I'm asking in this question, I'd like to assert/validate that shipping costs (essentially output values based on a set of parameters) are correct based on our business logic. What is the best methodology/approach for this validity testing of business logic? Do I simply move the business logic from our server code to our Selenium class library code to make sure shipping is correct for all products? Or should we have a spreadsheet/matrix of what our parameters are and the expected values and hard code in our Selenium test cases? I expect the business logic to get more complex in the future, but we need to make sure the shipping costs are coming out the same for products we don't expect the business logic to change in the future.
Pricing is more complex than shipping (with discounts, etc..) so I'd like to use the same methodology for that as well.