-1

Currently we are in the process of finalizing which language out of Java, Python should be used for Automation using selenium webdriver and a suitable unit testing frameworks. I have made use of Junit, TestNG and webdriver while using with Java and have designed frameworks without much fuss before. I am new to python though I came across pyhton's unit testing frameworks like unittest, pyunit, nose e.t.c but I have doubts if they would be as successful as testNG or Java. I would like to analyze point by point when used with selenium webdriver as below:

1)I have read that as Python is an interpreted language hence it's execution is slower, so say if I have to run 1000 test cases which take about 6 hours to run in Java, would python take considerably longer time for the same test cases like 8 hours?

2)Can the Python unit testing framework be as flexible as a Java unit testing framework like testNG in terms or Grouping the tests, parallel execution, skipping test. e.t.c

3)Also one point that I think of is that Python with selenium webdriver doeasn't have as big or learned community as we have for Java with webdriver, say if I run into trouble with something I am more likely to find an answer for Java as compared to python?

4)Somewhat related to point 3, is it safe to rely on tools, plugins or even webderiver's python's binding as a continuously well maintained?

5)One major drawback as I see while using python's unit testing framework is lack of boilerplate code or libraries for nicely illustrative HTML reports preferably historical reports with Pie charts, bar graphs and timelines as we have in case of Java like Allure, TestNG's default reports, reportNG or Junit reports with the help of ANT as shown below

Allure reports: enter image description here

Historical Junit Reports: enter image description here

Also I would like to emphasize on the fact if there is a way for one to write the framework in java nd make libraries or utilities according to out application in webdriver which can easily be called or integrated in with python code or modules? That would actually solve the problem for us as the client would be able to use the code we write in Java and make use of the same or call it from their python modules?

Anirudh
  • 2,286
  • 4
  • 38
  • 64
  • Given that you appear to have nothing in the positive column for Python, why don't you just use Java? – jonrsharpe Aug 20 '14 at 09:38
  • Well if I had my way I would use Java Hands down btw would you mind sharing any positives in the context in favor or python for a good reason to use python? as the client seems to be suggesting python – Anirudh Aug 20 '14 at 09:41
  • 1
    @jonrsharpe http://meta.stackoverflow.com/questions/268622/when-recommend-an-appropriate-site-for-off-topic-question/268722#comment78299_268722 – gnat Aug 20 '14 at 10:06
  • 1
    @gnat interesting point, thanks. – jonrsharpe Aug 20 '14 at 10:09

2 Answers2

1

I don't think that decision is that important you think it is. You can go either way, what you feel more comfortable with. Here's why in my opinion:

1) If you're tests are running 6 or 8 hours your tests are slow. It's not the language that makes them slow but what they do. Neither java nor python will magically make the tests run faster or slower (on this scale). If there is a performance impact from the choice of your languages, I would suspect it to be like +- 1 minute...

2) Sorry, I can't answer. I don't know pythons test frameworks. (But the whole rest of the answer doesn't rely on that)

3) Regarding WebDriver, do you know how it works? It's an extension in the webbrowser. You talk to it via a JSON protocol in your code. Your test code is just a client, generating that JSON commands and sending it to the browser. The webdriver core doesn't care if the JSON is generated by python or java. The sole thing that can go wrong is the client code and I would suspect both to be stable and well used.

4) See answer 3. It is only the client part you switch here, but yes, it is well maintained in my opinion.

5) Isn't that the job of the container (e.g. Jenkins / Hudson). All the test frameworks do is normally generate a report of the failed / passed tests. Most likely in ANT / JUnit XML Format. For details see this question. That may depend on the plugin you're using to generate the diagrams though. But not on the test framework generating the resulting report.

If you feel more comfortable with Java just use it. In favor of python is the shorter syntax. You can write the tests a bit shorter with less boilerplate code. But that wouldn't let me learn python just for the sake of shorter (in the sense of source code) tests.

Community
  • 1
  • 1
tilois
  • 682
  • 5
  • 15
1

Dont trust random people on the internet to make critical business decisions!

As to 2) nose has nice test grouping and parralel execution.

jb.
  • 23,300
  • 18
  • 98
  • 136