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
349
votes
11 answers

What is code coverage and how do YOU measure it?

What is code coverage and how do YOU measure it? I was asked this question regarding our automating testing code coverage. It seems to be that, outside of automated tools, it is more art than science. Are there any real-world examples of how to use…
Brian G
  • 53,704
  • 58
  • 125
  • 140
333
votes
19 answers

Gradle: How to Display Test Results in the Console in Real Time?

I would like to see test results ( system.out/err, log messages from components being tested ) as they run in the same console I run: gradle test And not wait until tests are done to look at the test reports ( that are only generated when tests are…
tolitius
  • 22,149
  • 6
  • 70
  • 81
322
votes
15 answers

How do you run a single test/spec file in RSpec?

I want to be able to run a single spec file's tests — for the one file I'm editing, for example. rake spec executes all the specs. My project is not a Rails project, so rake spec:doc doesn't work. Don't know if this matters, but here is my…
Jonathan Tran
  • 15,214
  • 9
  • 60
  • 67
318
votes
5 answers

Kotlin and new ActivityTestRule : The @Rule must be public

I'm trying to make UI test for my android app in Kotlin. Since the new system using ActivityTestRule, I can't make it work: it compiles correctly, and at runtime, I get: java.lang.Exception: The @Rule 'mActivityRule' must be public. at…
Geob-o-matic
  • 5,940
  • 4
  • 35
  • 41
311
votes
7 answers

New to unit testing, how to write great tests?

I'm fairly new to the unit testing world, and I just decided to add test coverage for my existing app this week. This is a huge task, mostly because of the number of classes to test but also because writing tests is all new to me. I've already…
pixelastic
  • 5,138
  • 6
  • 24
  • 29
300
votes
17 answers

Test process.env with Jest

I have an application that depends on environmental variables like: const APP_PORT = process.env.APP_PORT || 8080; And I would like to test that for example: APP_PORT can be set by a Node.js environment variable. or that an Express.js application…
Tomasz Mularczyk
  • 34,501
  • 19
  • 112
  • 166
284
votes
5 answers

How to check if a string array contains one string in JavaScript?

I have a string array and one string. I'd like to test this string against the array values and apply a condition the result - if the array contains the string do "A", else do "B". How can I do that?
gtludwig
  • 5,411
  • 10
  • 64
  • 90
281
votes
3 answers

How to `go test` all tests in my project?

The go test command covers *_test.go files in only one dir. I want to go test the whole project, which means the test should cover all *_test.go files in the dir ./ and every children tree dir under the dir ./. What's the command to do this?
hardPass
  • 19,033
  • 19
  • 40
  • 42
278
votes
6 answers

Rspec: "array.should == another_array" but without concern for order

I often want to compare arrays and make sure that they contain the same elements, in any order. Is there a concise way to do this in RSpec? Here are methods that aren't acceptable: #to_set For example: expect(array.to_set).to eq…
nicholaides
  • 19,211
  • 12
  • 66
  • 82
277
votes
9 answers

Testing HTML email rendering

Are there any good tools to easily test how HTML email will look across different email clients? I prefer something with instant feed back rather than a submit and wait service like http://litmusapp.com Or at the very least a way to test the Outlook…
ejunker
  • 10,816
  • 11
  • 41
  • 41
268
votes
13 answers

Stopping an Android app from console

Is it possible to stop an Android app from the console? Something like: adb stop com.my.app.package It would speed up our testing process so much. Right now we uninstall/install the app each time to make sure the manual test cases start with a…
hpique
  • 119,096
  • 131
  • 338
  • 476
265
votes
8 answers

How do you print in a Go test using the "testing" package?

I'm running a test in Go with a statement to print something (i.e. for debugging of tests) but it's not printing anything. func TestPrintSomething(t *testing.T) { fmt.Println("Say hi") } When I run go test on this file, this is the output: ok …
platwp
  • 3,025
  • 4
  • 15
  • 10
262
votes
19 answers

Making the Android emulator run faster

The Android emulator is a bit sluggish. For some devices, like the Motorola Droid and the Nexus One, the app runs faster in the actual device than the emulator. This is a problem when testing games and visual effects. How do you make the emulator…
hpique
  • 119,096
  • 131
  • 338
  • 476
258
votes
10 answers

How to configure "Shorten command line" method for whole project in IntelliJ

When I run tests I get the error "Command line is too long". It works if I set the "Shorten command line" method in the Run/Debug configuration to "JAR manifest" for the specific method or class, but how do I set it for the whole project or is…
momo
  • 2,723
  • 2
  • 11
  • 10
256
votes
5 answers

toBe(true) vs toBeTruthy() vs toBeTrue()

What is the difference between expect(something).toBe(true), expect(something).toBeTruthy() and expect(something).toBeTrue()? Note that toBeTrue() is a custom matcher introduced in jasmine-matchers among other useful and handy matchers like…
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195