Questions tagged [testing]

Software testing is any activity aimed at evaluating an attribute or capability of a program or system and determining that it meets its required results.

For better answers, any questions about Software Quality Assurance & Testing should be asked on SQA - https://sqa.stackexchange.com/. You can ask only programming related questions on Stack Overflow and that too can be asked on SQA

From Wikipedia:

Software testing is an investigation conducted to provide developers and stakeholders with information about the quality of the product or service under test. Software testing can also provide an objective, independent view of the software to allow the business to appreciate and understand the risks of software implementation.

Test techniques include, but are not limited to, the process of executing a program or application with the intent of finding software bugs (errors or other defects).

Software testing can be stated as the process of validating and verifying that a software program/application/product:

  1. meets the requirements that guided its design and development;
  2. works as expected;
  3. can be implemented with the same characteristics.

There are white-box-tests and black-box-tests.

A white-box test verifies the structure of a software product whereas the block-box test validates the requirements.

Software testing, depending on the testing method employed, can be implemented at any time in the development process. However, most of the test effort occurs after the requirements have been defined and the coding process has been completed. As such, the methodology of the test is governed by the software development methodology adopted.

The following types of tests are commonly used to denote the level of detail the tests are focused on:

Agile and Test Driven Development

Agile development model places added emphasis on testing. Test driven development advocates writing a test for a feature before developing the actual feature. Additional information:

Shift-left testing

Shift-left testing is an approach to software testing and system testing in which testing is performed earlier in the lifecycle (i.e. moved left on the project timeline).

49776 questions
1342
votes
42 answers

What's the difference between a mock & stub?

I've read various articles about mocking vs stubbing in testing, including Martin Fowler's Mocks Aren't Stubs, but still don't understand the difference.
never_had_a_name
  • 90,630
  • 105
  • 267
  • 383
952
votes
31 answers

Unit Testing C Code

I worked on an embedded system this summer written in straight C. It was an existing project that the company I work for had taken over. I have become quite accustomed to writing unit tests in Java using JUnit but was at a loss as to the best way…
Paul Osborne
  • 5,024
  • 6
  • 24
  • 20
842
votes
8 answers

What's the difference between unit, functional, acceptance, and integration tests?

What is the difference between unit, functional, acceptance, and integration testing (and any other types of tests that I failed to mention)?
Andrew
  • 227,796
  • 193
  • 515
  • 708
803
votes
17 answers

What are the differences between unit tests, integration tests, smoke tests, and regression tests?

What are unit tests, integration tests, smoke tests, and regression tests? What are the differences between them and which tools can I use for each of them? For example, I use JUnit and NUnit for unit testing and integration testing. Are there any…
caltuntas
  • 10,747
  • 7
  • 34
  • 39
750
votes
14 answers

How do I properly assert that an exception gets raised in pytest?

Code: # coding=utf-8 import pytest def whatever(): return 9/0 def test_whatever(): try: whatever() except ZeroDivisionError as exc: pytest.fail(exc, pytrace=True) Output: ================================ test session…
Gill Bates
  • 14,330
  • 23
  • 70
  • 138
638
votes
12 answers

How to run only one unit test class using Gradle?

I am new to Gradle. I use Gradle 1.10 and Ubuntu 13. I want to know if there's any command to execute only one unit test class, similar to testOnly in SBT.
bula
  • 8,719
  • 5
  • 27
  • 44
600
votes
12 answers

How can I write a test which expects an 'Error' to be thrown in Jasmine?

I'm trying to write a test for the Jasmine Test Framework which expects an error. At the moment I'm using a Jasmine Node.js integration from GitHub. In my Node.js module I have the following code: throw new Error("Parsing is not possible"); Now I…
echox
  • 9,726
  • 6
  • 33
  • 51
554
votes
7 answers

Writing unit tests in Python: How do I start?

I completed my first proper project in Python and now my task is to write tests for it. Since this is the first time I did a project, this is the first time I would be writing tests for it. The question is, how do I start? I have absolutely no idea.…
user225312
  • 126,773
  • 69
  • 172
  • 181
516
votes
14 answers

How to unit test abstract classes: extend with stubs?

I was wondering how to unit test abstract classes, and classes that extend abstract classes. Should I test the abstract class by extending it, stubbing out the abstract methods, and then test all the concrete methods? Then only test the methods I…
Paul Whelan
  • 16,574
  • 12
  • 50
  • 83
512
votes
36 answers

How to emulate GPS location in the Android Emulator?

I want to get longitude and latitude in Android emulator for testing. Can any one guide me how to achieve this? How do I set the location of the emulator to a test position?
UMAR-MOBITSOLUTIONS
  • 77,236
  • 95
  • 209
  • 278
464
votes
18 answers

How do I run all Python unit tests in a directory?

I have a directory that contains my Python unit tests. Each unit test module is of the form test_*.py. I am attempting to make a file called all_test.py that will, you guessed it, run all files in the aforementioned test form and return the result.…
Stephen Cagle
  • 14,124
  • 16
  • 55
  • 86
462
votes
14 answers

What is the difference between unit tests and functional tests?

What is the difference between unit tests and functional tests? Can a unit test also test a function?
mousey
  • 11,601
  • 16
  • 52
  • 59
408
votes
31 answers

Should I test private methods or only public ones?

I have read this post about how to test private methods. I usually do not test them, because I always thought it's faster to test only public methods that will be called from outside the object. Do you test private methods? Should I always test…
Patrick Desjardins
  • 136,852
  • 88
  • 292
  • 341
390
votes
7 answers

Exact time measurement for performance testing

What is the most exact way of seeing how long something, for example a method call, took in code? The easiest and quickest I would guess is this: DateTime start = DateTime.Now; { // Do some work } TimeSpan timeItTook = DateTime.Now - start; But…
Svish
  • 152,914
  • 173
  • 462
  • 620
387
votes
13 answers

How do I assert my exception message with JUnit Test annotation?

I have written a few JUnit tests with @Test annotation. If my test method throws a checked exception and if I want to assert the message along with the exception, is there a way to do so with JUnit @Test annotation? AFAIK, JUnit 4.7 doesn't provide…
Cshah
  • 5,612
  • 10
  • 33
  • 37
1
2 3
99 100