17

I´ve recently got a job as a automation tester in a company, that basically only have manual testers (except me). The short term plan is to come up with a good test strategy for identifying which of the systems, and what parts where the test should be automated. So I have came up with a pretty good plan for how to tackle the problem, but my main concern is this:

The domain language in the company here is C#/.NET and my strongest programming language skill is Java. Will I encounter any types of problems by writing the tests with Java, and what could that be? Or should I just learn C#? What are the pros and cons for these alternatives?

2
  • 4
    Ask the team who will maintain the result long term. It is probably easier to retrain just you. Jan 9, 2020 at 12:07
  • 1
    If these are unit tests, you should obviously write them in a language that easily interoperates with the system's language (in this case C#, F#, VB.NET, etc.). If these are system-level tests, it shouldn't matter what language you write them in. But if your only argument for Java is that Java is your "strongest programming language skill", then throw it away and expand your skill set. Jan 10, 2020 at 19:46

6 Answers 6

39

One of the biggest mistakes in my career was to pick a different programming language for the test automation than the development team uses.

  • You won't get help from the development team when you have a programming issue
  • Developers will probably not run, nor maintain tests as they change the application, you will be maintaining and analysing test results (e.g. fails) for the rest of your life
  • Developers will not add tests when adding features, so you will lag behind constantly

Mainly because they will not like context switching between languages (or frameworks, toolchain, etc) as it is a hassle.

Now I always write tests in the language of the team and get them to maintain them as soon as possible.

C# and Java are very similar, it was Microsoft's answer to Java, so it has a similar style for easy switching. The standard library syntax is a bit different. I would say just learn C#.

Is the team also heavily using JavaScript? (Most are due to front-end frameworks) This opens options for some modern testing frameworks like Cypress, Protractor and Puppeteer. Consider asking the development team for input aswell!

7
  • 8
    As far as the language goes, any decent C# developer should be able to make sense of Java code. The real problem is in the toolchain. JDK, IDE (Eclipse? IDEA?), different build file structure, different package repositories... Not rocket science, all of that. And any full-stack developer already has to deal with both .NET and node.js ecosystems. But I wouldn't like to have the third to deal with :)
    – IMil
    Jan 9, 2020 at 0:57
  • 1
    How often do developers normally run, add and maintain tests, other than unit tests? I haven't seen that happen before.
    – NotThatGuy
    Jan 9, 2020 at 22:34
  • 1
    @NotThatGuy In my teams all the time. When I get into a team where this is not the case I start with making a failing automated test for each defect I find, then show them how to run it. Coaching Agile Testing also helps. Currently I work in a govermental body, here I see a lot of testers that only define testcases and the developers do all the automation and maintenance. I think being a great software engineer also means being a good tester. Jan 10, 2020 at 8:31
  • @NotThatGuy Dev here, there are other tests besides unit tests? Jan 11, 2020 at 2:13
  • @NotThatGuy lol pretty sure he knew that. He was asking what other types of tests are common other than unit tests?
    – MCMastery
    Jan 11, 2020 at 6:42
14

You can choose any language irrespective of which language is used in development. But it would be better if you go with same programming language which is used in the development, in your case it would be C#/.NET for below reasons:

  • You can leverage existing libraries used by your team.
  • Developers can help you out, As you said you will the only person doing automation.
  • Developers can also maintain the tests/scripts.

Apart from this, try to figure out which automation tools fits best according to the modules or functionalities you want to automate and see which languages those tools support. If possible choose an automation tool which supports C#/.NET so that your team can also adopt it easily.

2
  • 2
    +1 leverage exiting code. In my current team I reuse code for arrangement of test-setups (e.g. testdata, users, config) Jan 9, 2020 at 9:01
  • Good point @NielsvanReijmersdal. Thanks! One can always reuse existing code.
    – JAINAM
    Jan 9, 2020 at 9:12
9

Definetly learn C#. Why?

  1. At Selenium tests level it's basically the same thing as Java 9. With a bit of syntactic sugars. It shouldn't take you more than 2 weeks to get up to speed with C#.
  2. CI/CD and whole infrastructure is set up for dotnet. If you don't want to run this automated tests manually, you will have to either: configure whole infrastructure to use Java (and learn it) or learn C# and use existing.
  3. It's always better to know two languages than one.
  4. Let's assume you need to test API. You already probably have data models, api endpoints and all that stuff written in dotnet. It will be much easier to just copy some of those stuff into your framework.
  5. And when you are stucked, who you gonna call? Your fellow programmers!

I don't see any downside to learn new programming language. It will just take a bit of time. In that case I would say about the same as you would spent on learning differences between Java 6 and Java 12 ;)

1
  • Good point about the CI/CD. Probably a .Net stack uses TFS/AzureDevOps. Probably you could integrate Java steps, but I think firing dotnet tests will be so much easier. Jan 9, 2020 at 9:03
4

I would say no. My current project has the QA testing using tests in Python while I code in Java. It is using black-box testing. You may also use JMeter for automated testing, which is coincidentally written in Java.

If you want to use TDD to created automated build tests, then you would have to know C# to be able to integrate the tests into the source code.

If you use straight black box testing then you do not need to be concerned with the language. There may be slightly more confusion because the stack traces and debug output may look unfamiliar to the developers and testers.

It's your choice based on your objectives and priorities.

1
  • TDD is not white box testing , you don't need to integrate anything to source code. It depends on what test level you are talking about. TDD in unit test , system test , integration ? other than that unit test everything else is usually blackbox even in TDD
    – PDHide
    Jan 9, 2020 at 14:06
4

Such situations should be addressed both from technical and management perspective, few of the things that needs to addressed are :

1. Does the team consist of only single QA ?

If the team consist of just single QA who would be responsible for the entire automation, then choosing a programming language that is alien to current team will create a dependency.

If any unforeseen situation comes up then the effort require to maintain the framework would be pretty huge. The organisation need to find a replacement and cannot use in-house resource to fill this position.

2. Does development team writes automation scripts ?

If the process involves dev team pitching in to help automation team then it is recommended to use the same language among dev and test.

But if it is not the case, then you should evaluate whether it really worth putting effort in learning a new language and slowing down the process.

3. What is the expected time period ?

Does the project need to be released quickly , then the focus should be on having an effective regression test framework than programming language.

4. Is there any plan to scale the automation team?

If there is a plan to extent the automation team then you could avoid the situation in "Question 1" . You could avoid creating dependency by hiring more java test automation experts and up skill any in-house resources. So you could start working on an effective java framework that would be easy to be maintained by future test engineers.

5. What is the future plans of the team?

Is there any plans to move into angular based stuffs infuture, are the project going to come up something new? . Ask more of such questions and choose the tools and languages accordingly.

For instance, if team is planning for angular website try developing javascript based framework using protractor , cypress etc than sticking on to c# or Java

1

If I may be devils advocate, I would suggest sticking with java. If you are the lone automation tester, you can use whatever you want.

Advantages to using java:

  1. Don't need Visual Studio license
  2. Lots more support for Java online
  3. Running into an issue with java ? Chances are, someone else posted a solution online
  4. Most Selenium users code in Java. Then JavaScript. Then everything else.
  5. Some of the developers probably know java (and secretly prefer using it over C#)
6
  • 5
    1) You do not need a VS license to write C#, VSCode is free and open-source and reasonably viable, and there are other alternative IDEs (such as Rider) if you disapprove of VS specifically; 2) In my experience there is an equivalent amount of support in both languages, if not better in C# since you don't have to wade through twenty years of homework assignments; 3) Literally same as 2; 4) That varies widely by field, and both languages are supported by Selenium so eh; 5) That's projecting based on your preference. The same thing could be said by any other developer about any language.
    – Kroltan
    Jan 9, 2020 at 1:11
  • 1
    "If you are lone automation tester". That is part of a problem: You are supposed to be part of a team. There is no use for tests that are not being used. You need the developers to work with you together.
    – Ole Albers
    Jan 9, 2020 at 7:50
  • 1
    Automated test suites are not a "write it once and forget it" job though. Whilst the OP may be the one initially writing them, the developers should be expected to maintain them as they make changes. (Unless you're doing something like safety-related which requires independence of development and test; in which case you need more test engineers to cross-review with.) If this is a C# shop, you write it in C#.
    – Graham
    Jan 9, 2020 at 15:03
  • None of those advantages are really advantages. I doubt anybody has quantified if there really is more support for Java online than C#. I have no idea why you'd use selenium to test a C# backend and the last point is more than dubious: Every SO developer survey consistently shows people prefering C# over Java by a wide margin.
    – Voo
    Jan 10, 2020 at 9:06
  • This is what I get for being devils advocate. I have been writing test automation for 20 years and use both Java and C#, it depends on what is best for the project. Kudos to Graham for "the developers should be expected to maintain them as they make changes" thats a good one lol
    – ToastMan
    Jan 10, 2020 at 16:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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