Approach for Watir-Webdriver coverage on site by many clients

Okay, I need to strengthen this thought process - my brain hurts. I would like your feedback on some of the approaches.

I posed my questions up front, in case I lose your focus during the description below:

  • Do you have a similar product scenario before? How did you approach him?

  • Do any of these approaches stand out as big / terrible for any reason? If so, what?

  • Is there any other approach you find more appropriate?

There is a workflow that I am testing, for the sake of argument, we will call it a shopping cart made up of various text boxes, radio_buttons and select_lists. One company provides this cart for ~ 60 customers, and not all customers use the same exact shapes, but the general process is the same . The general idea is the same between clients (same target functionality), and there are subsets of clients with the same precise workflow, but many are unique. In this case, uniqueness can mean that certain fields are not required while they might be for other clients. Or, some questions / text boxes exist for one client that no one else can use at all.

The purpose of the script at this point is to simply create order through the web interface, rather than checking every single step of the process as a "test". You will have to believe me a little. There are many more general details to be able to run negative / edge cases with an acceptable level of accuracy.

The approaches I see so far:

  • Using the page object template, create a "page" file for each client site and use a different page class depending on which client is being tested. It's tedious, mostly fragile and a lot of work to maintain. However, it would work and I could use the same functions / scripts for everyone as long as their page file was available.

  • Create a method to clear all input elements from the DOM, determine if they are a reserved field where we need to enter the specific input required, or just fill in the information to get the order. It is not DB related, so performance should be better overall.

  • Connect to the DB, gather all the information needed by the particular client used to build their pages, and dynamically create order fields and respond accordingly. This sounds great in theory and will require very little if any maintenance. The DB scraper is simple, the complexity of building fields is not yet known to me ...

Currently I am using: Watir-WebDriver cucumber Pearl pearls continued

+3


source to share


1 answer


I would use a cheezy page-object and include all fields / question that might be included. then I would overload the defaults for each client including only the fields / questions they use. Hope I didn't oversimplify this.

Update: In the page populator, it will combine all the data you send (as a hash) with the default data. In his default post, he shows how to use the default data. I suppose you can create a class validation page

 class CheckoutPage
  include PageObject

  text_field(:name, :id => "order_name")
  text_field(:address, :id => "order_address")
  text_field(:email, :id => "order_email")
  select_list(:pay_type, :id => "order_pay_type")
  button(:place_order, :value => "Place Order")

  PageObject::PageFactory.routes = {
    :default => [[HomePage, :select_puppy],
                 [DetailsPage, :add_to_cart],
                 [ShoppingCartPage, :continue_to_checkout],
                 [CheckoutPage, :complete_order]]
  }

  def complete_order(data = {})
     data = DEFAULT_DATA.merge(data)
     self.name = data['name']
     self.address = data['address']
     self.email = data['email']
     self.pay_type = data['pay_type']
     place_order
   end
 end

      



then reload it for specific vendors using the site and each one has their own default data.

class Nordies < CheckoutPage
      DEFAULT_DATA = {
        ‘name’ => ‘cheezy’,
        ‘address’ => ‘123 Main Street’,
        ‘email’ => ‘cheezy@example.com’,
        ‘pay_type’ => ‘Purchase order’
      }

PageObject::PageFactory.routes = {
  :default => [[HomePage, :select_puppy],
               [DetailsPage, :add_to_cart],
               [ShoppingCartPage, :setup_creditcard],
               [CreditCardPage, :continue_to_checkout],
               [CheckoutPage, :complete_order]]
}
end

      

Then .complete_order will be different for each vendor.

+3


source







All Articles