1

I am developing a framework for the popular e-commerce trading website platform (Amazon) – from scratch. I will be starting a new automation testing role, and, I need to get more practice before I start. Hence, the need to develop the framework.

I have done some research. A Simple Google search for any previous “Conquistadors” - that had done this before was fruitful. Sample code for their previous exploration on GitHub.

There was also a website with more details.

In addition, I got some websites that I got more information from:

  1. CodeProject (check here)

  2. Stephen's Guide To Selenium

  3. The TrainLine. I intend to use the Page Object Model – for obvious reasons.

Does anyone have any advice regarding how I can approach this task? Also, if you have any code – from a previous project that I can glean some ideas from, that will be great.

My plan is to write manual tests 1st (using different test techniques including +ve & -ve tests, state transition tests, Boundary Value Analysis, etc). Afterward, I will select easy, straightforward tests & use them as my “smoke” tests (e.g login feature), then add more complex tests to build my framework.

Your ideas are welcome. Thank you.

  • What language? What is your experience as developer? How many years, how many languages, how many projects? – Peter M. - stands for Monica Aug 10 '17 at 15:20
  • 1
    I'm missing the actual question here. It sounds like you want code and an explanation how to program a framework, but you mentioned you already found this in your searches. You also mention your exact selected approach and then ask for opinions...not sure what you are looking for here as an exact question. Please clarify what the exact question is. – mutt Aug 15 '17 at 3:51
  • @PeterMasiar - I am using C#. I have minimal experiance with development. Having said that, I have done some courses in C#, and, I have experience of writing code to add, subtract numbers, create classes and methods, etc. I am working on a mini-project to create an accounting package as part of a book by Jamie Chan - Learn C# Fast. I hope this helps. Thanks. – OA345 Aug 19 '17 at 13:30
  • @mutt - I require pointers on how best to approach to create the automation testing framework, please. Seeing that I will be using the POM frmwk, it is a bit more complicated than the others. In a nutshell, from your previous experience (at work), how best would you go about creating the POM framework; considering that you know how the different functionalities work & the manual test cases have been signed off. Thank you. – OA345 Aug 19 '17 at 13:38
2

You don't mention how much experience you have with coding. I would suggest that if you don't have at least a junior developer skill set, you should start by working through one of the many free online C# courses so you can get familiar with object oriented code principles, along with DRY (Don't Repeat Yourself), SOLID, DAMP (Descriptive And Meaningful Phrases) etc.

I would also recommend taking one or more online tutorials in Linq syntax since this is possibly the cleanest way to search for a specific element if you lack a unique HTML ID.

That done, your next step is to look at the page structure for your target site. Are there elements that are present on every page or almost every page? These become part of your base page object which is then inherited by all your other page objects. Always look for common features that can be used in an inheritance structure. (e.g. if you were coding animals, you would have a base animal object with common methods like breathe(), eat(), sleep(). Your mammal class would inherit from animal, and add methods like liveBirth(). Then cow inherits from mammal and adds methods like isDairy() and so on).

From that basis, you can start building a series of page methods that will handle your assertions and your actions. Each action should return the next page object in your sequence, so you can build your tests as a series of actions ending with an assertion, along the lines of:

assert.True(
  LoginToSite(username, password)
  .SelectProduct(productName)
  .AddProductToCart(quantity)
  .CheckOut()
  .CheckOutScreenShowsCorrectQuantityOfProduct(productName, quantity));
  • Thanks very much for your advice. I have minimal experiance with development. Having said that, I have done some courses in C#, and, I have experience of writing code to add, subtract numbers, create classes and methods, etc. I am working on a mini-project to create an accounting package as part of a book by Jamie Chan - Learn C# Fast. I am starting some tutorials on LINQ statements. Thanks very much. – OA345 Aug 20 '17 at 9:54
0

From the fact you are "developing a framework for the popular e-commerce trading website platform" I can assume you do not have lots of experience. This is OK, everybody started will less experience and adds experience as you complete your projects.

You should be developing a test suite for a platform (not a framework), possibly using existing (or new) test framework. The whole point of a framework is that it is reusable for multiple projects. You don't start with framework, especially if you do not have vast experience in developing test suites. If you don't have existing framework, you can build it over multiple projects, as you gain experience.

So develop your test suite, and abstract (refactor out) the helper functions which are generic and not dependent on the platform into a "framework". Likely you will need to refactor your tests (and your framework) multiple times as you learn more about problem areas and learn better ways to solve problems. This is normal.

Then, on your next project, try to use parts of the framework for it. You will likely find out that frameworks needs more changes you haven't foreseen first time around. Refactor some more - this is normal.

Learn also from others - read source code of other frameworks, see how they solve problems you are trying to solve, how their approaches are similar (if they are) or different, and why.

After 3-5 projects, your frameworks (parts you refactored out out your test suites) will become truly generic and usable. But you don't start with inventing a framework, because if you do, you will invent functions you think you may need but you don't. You start with solving real problems, and refactoring reusable parts to solve next problem.

One important design principle is YAGNI - You Ain't Gonna Need It: don't add functionality until you need it.

  • @ Peter Masiar - Thank you very much for your advice. Taken on board!! – OA345 Aug 20 '17 at 9:58

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.