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
200
votes
15 answers

How to measure test coverage in Go

Has anyone succeeded in generating code coverage for Go unit tests? I can't find a tool for that on the web.
Georgi Atsev
  • 2,775
  • 2
  • 16
  • 18
197
votes
5 answers

ScalaTest in sbt: is there a way to run a single test without tags?

I know that a single test can be ran by running, in sbt, testOnly *class -- -n Tag Is there a way of telling sbt/scalatest to run a single test without tags? For example: testOnly *class -- -X 2 it would mean "run the second test in the class.…
Nacht
  • 10,488
  • 8
  • 31
  • 39
190
votes
10 answers

How can I check if an element exists with Selenium WebDriver?

How can I check if an element exist with web driver? Is using a try-catch really the only possible way? boolean present; try { driver.findElement(By.id("logoutLink")); present = true; } catch (NoSuchElementException e) { present = false; }
Ralph
  • 118,862
  • 56
  • 287
  • 383
189
votes
15 answers

Python unit test with base and sub class

I currently have a few unit tests which share a common set of tests. Here's an example: import unittest class BaseTest(unittest.TestCase): def testCommon(self): print 'Calling BaseTest:testCommon' value = 5 …
Thierry Lam
  • 45,304
  • 42
  • 117
  • 144
188
votes
5 answers

What is the difference between mocking and spying when using Mockito?

What would be a use case for a use of a Mockito spy? It seems to me that every spy use case can be handled with a mock, using callRealMethod. One difference I can see is if you want most method calls to be real, it saves some lines of code to use a…
Victor Grazi
  • 15,563
  • 14
  • 61
  • 94
187
votes
13 answers

How do I install jmeter on a Mac?

We want to use JMeter. I've downloaded the production version as directed in the user manual at http://jmeter.apache.org/usermanual/get-started.html But how do I get started and install the software? I don't know java and I can't find any…
Michael Durrant
  • 93,410
  • 97
  • 333
  • 497
187
votes
10 answers

Spring Test & Security: How to mock authentication?

I was trying to figure out how to unit test if my the URLs of my controllers are properly secured. Just in case someone changes things around and accidentally removes security settings. My controller method looks like…
Martin Becker
  • 3,331
  • 3
  • 22
  • 25
186
votes
5 answers

Skip one test in test file Jest

I'm using Jest framework and have a test suite. I want to turn off/skip one of my tests. Googling documentation doesn't give me answers. Do you know the answer or source of information to check?
Gleichmut
  • 5,953
  • 5
  • 24
  • 32
183
votes
5 answers

How to reset or clear a spy in Jest?

I have a spy that is used in multiple assertions across multiple tests in a suite. How do I clear or reset the spy so that in each test the method that the spy intercepts is considered not to have been invoked? For example, how to make the assertion…
sdgluck
  • 24,894
  • 8
  • 75
  • 90
179
votes
33 answers

Mockito - NullpointerException when stubbing Method

So I started writing tests for our Java-Spring-project. What I use is JUnit and Mockito. It's said, that when I use the when()...thenReturn() option I can mock services, without simulating them or so. So what I want to do is, to…
user5417542
  • 3,146
  • 6
  • 29
  • 50
174
votes
7 answers

Run code before and after each test in py.test?

I want to run additional setup and teardown checks before and after each test in my test suite. I've looked at fixtures but not sure on whether they are the correct approach. I need to run the setup code prior to each test and I need to run the…
edA-qa mort-ora-y
  • 30,295
  • 39
  • 137
  • 267
171
votes
23 answers

Error "Source option 5 is no longer supported. Use 6 or later" on Maven compile

I am getting the following error on $ mvn compile: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Sym360: Compilation failure: Compilation failure: [ERROR] Source option 5 is…
SUPARNA SOMAN
  • 2,311
  • 3
  • 19
  • 35
169
votes
9 answers

Cleaning up sinon stubs easily

Is there a way to easily reset all sinon spys mocks and stubs that will work cleanly with mocha's beforeEach blocks. I see sandboxing is an option but I do not see how you can use a sandbox for this beforeEach -> sinon.stub some, 'method' …
austinbv
  • 9,297
  • 6
  • 50
  • 82
168
votes
7 answers

Why should I use Hamcrest-Matcher and assertThat() instead of traditional assertXXX()-Methods

When I look at the examples in the Assert class JavaDoc assertThat("Help! Integers don't work", 0, is(1)); // fails: // failure message: // Help! Integers don't work // expected: is <1> // got value: <0> assertThat("Zero is one", 0, is(not(1))) //…
Peter Paul
167
votes
11 answers

Difference between acceptance test and functional test?

What is the real difference between acceptance tests and functional tests? What are the highlights or aims of each? Everywhere I read they are ambiguously similar.
JavaRocky
  • 19,203
  • 31
  • 89
  • 110