I myself have no idea of how to code, so am I able to perform unit testing?
Want answer in detail because I want to know how testers do unit testing.
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It only takes a minute to sign up.
Sign up to join this communityThe short answer - Usually they don't. Developers write unit tests and ideally run them every time the software builds.
The longer version - Unit tests are intended to test a single unit of code. This means that they are not testing through the application user interface, but are running directly against the single unit they are testing and using stub/mock data to simulate the unit's dependencies.
Because of this, no, someone with no coding knowledge can't write unit tests.
Unit Testing is in my personal opinion the most difficult and important code a developer writes.
Unit Testing in it's core is breaking down the application into small pieces and ensuring that each piece is functional on it's own. It is an extremely cheap and easy way to ensure that sections are functional.
There is several different principles to Unit Testing. My personal favorite is Property Based Testing and BDD Tests.
As for can you write unit tests, no. You can't actually write them. You could review over the code, try and understand it and attempt to determine what should be tested and how. You could work with a developer and try and give them ideas for more unit tests. Writing them yourself as a QA is extremely difficult especially if you do not have write access to the AUT. And if the application is not currently being hit by unit tests it likely was not written with testing in mind which makes it 1000x harder to implement unit tests.
All of that being said one area where I feel QA should have more understanding is reviewing unit tests. A strong unit testing foundation drastically improves the timeline of the development process and results in a stronger project. It makes it easier and quicker for new developers to learn the application and requires developers to think about what they are implementing. Learn unit testing, study it and try and push your team to implement as many of them as makes sense to implement.
No, Unit testing only perform by the developers.
A unit is the smallest testable part of an application like functions, classes, procedures, interfaces. Unit testing is a method by which individual units of source code are tested to determine if they are fit for use.
Unit tests are basically written and executed by software developers to make sure that code meets its design and requirements behaves as expected.
Unit test are just small programs which call small units of code being developed and test if the call returns expected values (or makes expected changes).
Unit testing is performed by program (which runs unit tests: test runner), not by a human.
So answer to your question is: no, someone with no programming skills by definition is not able to write unit test.
It also does not make sense for anyone else than a developer to write unit tests. To write them, you have to be extremely familiar with the minute details of the code, how code works from the inside. Only developers have such detailed knowledge (usually only of some parts of the whole system).
QA testers do not require such detailed knowledge of the code deep insides. They are focused on how different parts of the code fit together, and how they perform actions which user wants. It is very useful to perform such testing by someone who did not write the code, to flush out some unsaid assumptions.
Of course it is beneficial for a tester to have some knowledge of the system insides, so tester can better develop test strategies to test parts of the system which were not directly changed by a code path tested, but can be affected by the changes. But such knowledge is in more general terms, not on level of the detailed function calls and parameters passed.
There are some benefits of Unit Tests:
As you can see, testers instead of developers running Unit Tests gets rid of these benefits. To make it worse, giving testers control of Unit Tests introduces a rigid structure around the code that must be changed along with the code, but that the people in charge of the code have no control over.
Unit tests are run in 2 ways:
This is not an either/or. If a tester gets a build, the Unit Tests have already passed.
I think testers should not test classes/modules/functions. testers should do functional testing and automate it. why? because programmers use their favorite language, tools, methodology. and those tools can change pretty frequently. code is constantly evolving and unit tests also have to evolve. programmers know how to correctly implement and refactor unit-tests to make their maintenance least expensive. programmers know which part of code is a public contract of their modules and which is only implementation detail (that usually should not be tested). programmers know on what parts of the system should be tested as a whole and which should be tested individually
to sum it up: maintenance of tests costs. in a healthy system there should be the biggest number of unit tests (rule of a thumb: up to 2x more lines of tests than production code). only programmers know how to make the maintenance cheap
however if you test system that suppose to talk with other system (rest, soap, etc) then it can be pretty close to unit-testing
Testers do not perform unit tests at all and I do not know any software development methodology, according which testers should do that. Only way, how the Tester, resp. a Test manager meets Unit testing could be (but does not have to), is to gather and report unit test results.
Some examples how methodologies consider Unit testing:
For example according to RUP (Rational unified process) unit testing first of the "Testing levels" which is "the explicit role of the implementer who ... carries out the activities of Implement Test Components and Subsystems and Perform Unit Tests" (read something about here: http://www.ibm.com/developerworks/rational/library/dec04/koomen/)
According to ISTQB definition, "Unit tests are basically written and executed by software developers" (read something about it here: http://istqbexamcertification.com/what-is-unit-testing/)
There could be a pressure to testing team to develop automated unit tests, but this is not generally supported and recommended by methodologies. I can imagine various problems which are on the way (as tester is not aware of the incoming changes, unit test are failing unless they are repaired, build never completely success because of deffered tests, etc.).
Some example of things, where somebody could think Unit tests belongs to testers:
Yes, but you will have to learn to code :) Programming is an awesome skill. Also a pretty helpful tool in your tester tool-kit.
If you want to learn unit-testing I would advice to start learning Test-Driven Development after you gathered basic coding knowledge.
Without having a lot of programming knowledge you could do pair-programming and assist in unit-testing then. Your pair can be the programming guru and you the test guru :)
There are four different roles in software development who do (unit)-testing:
Writes a lot of test code including test driven design and unit tests.
A developer role except their focus is on testability. They review designs and look closely at code quality and risk. They refactor code to make it more testable. SETs write unit testing frameworks and automation.
It is a a role that puts testing first and development second. Many Google TEs spend a good deal of their time writing code in the form of automation scripts and code that drives usage scenarios and even mimics a user.
Sources: