I am new in automation, and my team is going to create an automation testing framework and we selected hybrid framework. We are using C# and Visual Studio. I am looking for selenium tutorials and I always see TestNG or NUnit frameworks to use. My question is do we really need those, or we can customize our own framework instead?

Our plan is to have scripts that are a combination of data driven/keyword driven. I am already thinking about the Page Object Model to use for my scripts. We also would like to have a customized report, our data pool will be coming from excel/csv. What are your thoughts about this?

  • 1
    Can you be more specific than "What are your thoughts about this?" What question do you want answered? – user246 Jun 2 '16 at 21:27

No, technically you do not need a unit-testing framework. You could just execute Selenium steps from a C# program and write the results somewhere for you to monitor, but we use them as a runner of the tests. Since this gives standardized results which can be parsed by a continuous integration server to give you nice feedback.

I would advise you to use a unit-testing framework like NUnit to drive your tests. The development team is probably already using this for their unit-tests. Talk to them.

Page Object Model is currently the best way to structure your Selenium tests to be relatively maintainable. Personally I would not use data coming from Excel, unless you want non-developers to update the data. Else it just adds another layer of complexity. Just store the data in some class.

  • Unfortunately, our development team is not doing unit testing. According to your statement " You could just execute Selenium steps from a C# program and write the results somewhere for you to monitor, but we use them as a runner of the tests." does this mean, I can just move on and not use a unit-testing framework? I am wanting to create functional tests/regression tests..I am not sure if I am getting the unit-testing framework concept – Marj Jun 2 '16 at 21:21
  • Just remove the word UNIT, maybe it is less confusing then. Its a test (running) framework and give you tools to verify situations with Asserts and test-results. Also it has Setup and Clean features for code you want to run for each test. To be honest you just need one, since you don't want write boilerplate code to kick start your own tests, process them and gather results. Also you can now search easier for example when you get stuck. It really boils down-to do not re-invent the wheel. – Niels van Reijmersdal Jun 3 '16 at 7:17
  • Storing data in some class? Eww. – FDM May 24 '17 at 6:24
  • @FDM Just like data structures, but then with fixed data. The nice thing it is versioned and you can use syntax completion in your IDE. Everything is better than putting test-data for your automated tests in Excel. – Niels van Reijmersdal May 24 '17 at 6:56
  • @NielsvanReijmersdal Seems very odd to me; my framework is data-driven so I can run the same code with different datasets. Maybe you have other needs in your organisation. FWIW, I don't use Excel either but XML. – FDM May 24 '17 at 6:58

The idea is that most of what you will end up writing has already been written and packaged up into a framework.

It will provide the infrastructure to group, tag and set run order. It can groups tests into suites. It will provide output and feedback in useful ways that can be customized. It will help handle the setup, execute, teardown steps. It can help you deploy tests to remote servers and Continuous Integration services. All this and much more. What seems like a pain to learn initially when you would rather just 'get coding' will often change if the alternate approach results in a mass of disorganized and repetitive code.

btw I think of the page object as a separate question and issue. I've used them as simple variables in one project. It could be used with/without a test framework.

  • I am hesitant if visual studio, which is the IDE I am using right now, will update, I needed to update the nunit framework, and do I have to update my scripts as well – Marj Jun 3 '16 at 15:04

I just want to add some clarity to the confusion in the first part of the question, as I don't think this will be the answer to it.

I totally understand the first confusion about test frameworks. The problem is, the phrase test framework is used for almost different purpose products and is overloaded. You can easily create your own basic test framework (lots of blogs and examples around) which starts with the ideas of bundling certain requirements of a test framework such as:

  • easily running a subset of your test collection
  • getting a summary result of the subset test run

Then you start adding other requirements that lead to having a more advanced tool, such as getting nice reports, integrating it with your development environment, etc. And they are all called test frameworks (from the simplest, less than 100 lines of code to the most advanced commercial ones).

Please, I have searched for websites/guides for creating the simplest of automation testing frameworks. Please, I would be most grateful if you can nudge me in the right direction.

  • Bharat, I think your edit should be added as a comment here instead of in the message. For the test framework direction, a quick search led me to this link that I haven't seen before but is an example of what I was implying: blogs.msdn.microsoft.com/ddietric/2009/02/24/… – MattAPiroglu May 27 '17 at 22:44

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.