Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

We currently have two teams. An automation team and also a web testing team. The automation team currently use Selenium and C# to automate tests on our web applications and legacy systems.

As a member of the web testing team, we are now starting to look at writing simple scripts using selenium, however it has been recommended to us that we start to use Python rather than C# to write our scripts.

I would appreciate any advice on the advantages and disadvantages of using C# with Selenium and also Python.

share|improve this question
1  
A big disadvantage to C# is that it's a legacy, frequently Windows-only language, though Selenium might work fine on Mono. Being stuck on Windows might outweigh the training costs, but it might not. –  JaneGoodall Jul 1 at 20:18

4 Answers 4

up vote 1 down vote accepted

To play a devil advocate, if you try Python, you will find that you are substantially more productive because of dynamic typing. Python just works much harder to improve productivity of the programmer, as compared to C# which is focused to create effective code (making programmer to work harder to get it). In testing, it is of little difference if test script is 20 ms faster (in C#), because tests in both languages just call the same libraries anyway. But if you can create test script one day sooner, it does make difference.

Python data structures are more flexible: it is trivial to create a dictionary with tuples as keys and lists as values. In C#, it is not as obvious. Many times Python debugger saved my bacon: fire it in the middle of test where interesting variables are instantiated, and you can interrogate them for properties and methods as they are, not as you think they should be by reading the code (as you do in C#).

Also, yield operator allowed me cool tricks when implementing page object. Not sure how easy is to create a generator returning tuples in C#, but in Python it is trivial.

Full disclosure: I used C# for a desktop application, did not enjoyed it, and changed job to one where Python is main language for both development and testing.

I understand that standardization on a single language is important. But I strongly believe that especially for testing, that language being Python has substantial competitive advantage over C#.

Maybe the person who suggested to try Python alongside C# wants to compare productivity and switch to the more productive platform? And I am pretty sure that Python will be a winner in that competition.

share|improve this answer

First of all: Welcome to SQA.

Apart form the features of C# and Python, your team should also use C#. The web testing team can reuse scripts from the automation team. The teams can support and complement each other. They can talk about problems and challenges and find solutions together.

That Python already have a xUnit framework in the standard library is the only advantage comes into my mind when I compare C# with Python.

share|improve this answer

Adding something to @Twaldigas reply, why / who has recommended that you use python?

It makes perfect sense to me that you use the same language as the development and automation team, this way, if you have some problems, I'm sure they have already solved it in the past.

Plus, if the automation team already has a framework built on top of selenium, maybe you can use it instead of going through all the quirks and difficulties of starting with selenium.

Hope this helps...

share|improve this answer

Disadvantages of using C# in one team and Python in the other include cost of training and cost of learning.

If one team finds issues and wants the assistance of the other there will be challenges with explaining the subtle features of the language used for the test.

New members on either team will need some training. Using two languages will mean two types of training need to be found.

People transferring from one team to the other will need to learn another language.

As your company already uses C# with Selenium it makes sense to reuse that expertise. Perhaps one of the developers can be seconded to the test team to give guidance and training etc. Such a secondment may be good for the developers as they get to learn about the challenges of testing.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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