New to automation - use a framework from the get go?


(James) #1

Hi All,

I currently following a tutorial on Selenium WebDriver in C# using Visual Studio Community. The tutorial explains the clear benefit to having a test framework, but it does add a layer of complexity when I am new to C# and trying to learn the fundamentals.

Does anybody have any thoughts on the best way to learn - framework from the get go or start jumping in and creating tests then implementing a framework later on?

Interested to hear your thoughts :slight_smile:

sad_muso


(Simon) #2

It sounds like you’re trying to learn a new language and a new framework at the same time. I’d personally take the hit and learn the language to a decent degree (you’ll never know or need to know everything) and then implement on the framework. Otherwise I’d just end up re-implementing tests at a later date, which would probably hack me off.


(Andrew) #3

Although having a framework is not a necessary step to implementing Automation it is probably best advised to have a framework in mind when looking to start with Automation.

If you just add your test scripts and let them run then you may find that further down the line it will be harder to maintain the tests and you aren’t able to scale your efforts.

If you have a testing framework in mind from the start and look to implement within this framework then it would be easier to scale the tests as the product grows and also maintain the tests as new functionality is added to the product.

As you say you are new to C# it might be best getting a good understanding of that first before implementing tests. But when it comes to the automation then try to use a framework. This page gives a bit of understanding and some pro and cons of the different types - http://www.softwaretestinghelp.com/test-automation-frameworks-selenium-tutorial-20/


(Joseph) #4

Are you talking about framework or design pattern?

Personally, I view something to ‘access’ what you’re testing (like Selenium to drive the browser), a way to model your tests (like JUnit for Java or Mocha for JS) and a way of doing assertions (like AssertJ for Java or Chai for JS) as being a framework.

By way of contrast, page object model or screenplay would (by my definition) be a design pattern.

I’d say to stick with whatever framework you are being taught because once you learn one it’s easier to learn another.

As for design pattern, they are a bit more effort to get your head around but I’d suggest at least becoming familiar with page object model as it’s an industry standard in my experience and saves a lot of time.


(Viktoriano) #5

First C#, then the framework. There is no point in learning framework without knowing how to modify (extend, change, improve) it. Okay, you will be able to understand it and even write new tests but it’s like a shot to nowhere.

I’d recommend you to start from C# basics. There are tons of free tutorials worldwide, just follow them. Practice with simple stuff like arrays, strings tasks, then move on to the test frameworks like NUnit, then add more complicated things like collections, generics, etc.


(james) #6

Do you have your heart set on C#?
Personally I have been learning python with a use robot automation framework.
This is due to a lot of people saying python is easier to learn as it’s an object based language.
But as people are saying, learn the language first, it will give you a better base to work from as you will be able to understand how the scripts are running. It will also help when things break and you need to figure out how to get them going again.


(James) #7

Hi everybody, thank you for your replies. I have spoken to one of our senior devs at work today and we agreed that it would make sense for me to go for C#, as all of our devs code in it and therefore will be able to assist me in writing tests/frameworks easier than if I picked a different syntax.

I have just purchased this book which should set me off on the right path, but I don’t think it goes into setting up a framework so I’ll need to find resources that’ll help me with this in due course, preferably tailored to C#.

For the time being I’m taking your suggestions and going through a Pluralsight course on C# fundamentals. I want to do this properly, so one step at a time :slight_smile:


(Carolyn) #8

In my experience, initially you can start with a simple approach to automation where you script out each test. However, over time you begin to see the pattern and where code is repeated. So the first principle worth starting with is to avoid any repetition of code - or at least as far as you can. The Second principle worth starting with is to adequately manage the data that ‘feeds’ your testing. Everything you enter from locator types, locators themselves to the expected results can be stored in a manner that is easy for anyone to update when they change - as they do over time.

Frameworks… Version 1: script each action but have methods for the basic selenium commands. Most of the ‘data’ is hard-coded (No framework)
Version 2: use spreadsheets to repeat tests using different data - framework opens the spreadsheet and repeats for each row and has an expected result. (Data-Driven)
Version 3: use spreadsheets for locators (so non-coding tester user can amend easily). (Data-Driven x2)
Version 4: use XML for everything (Hybrid i.e. Data and ‘Keyword’ driven)