1

My company is in the process of setting up a white label website, in which there are slightly different user journeys. These journeys, for the most part, use the same functionality but I'm wondering how I go about setting up automated testing for them.

I'm using selenium with C# in visual studio, now do I create completely separate solutions for each website and create nuGet packages for the common areas or do I create one solution with multiple projects referencing common areas based on environment variables?

1

It depends

There are several factors that determine how you handle this. Depending on how the white labeling works, you may be able to get away with one solution that can handle all the websites via a configuration setting that defines the base URL for each site.

Some things you can consider:

  • Use IDs wherever possible - particularly if the white labeling involves different CSS class names, using something static to identify the elements you're interacting with means you can reuse a lot of the code.
  • Have common library functions to identify elements - Even if the IDs and CSS class names differ, you can create a library that will identify an element by some distinct identifier and return the element object. That means you can identify your fields no matter what differences the white labeling generates.
  • Data drive your tests wherever possible - This can include your user journeys as part of a test, by passing in whatever data the test requires.
  • DRY and SOLID - Keep your test code as free from copy/paste and near identical code as possible, and follow SOLID coding principles as much as possible.

Beyond that, try structuring your test code different ways and see which work best for you. My preference is to have the code generic enough to have a single solution with the different sites handled by data and configuration, but that may not work as well for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.