Java-Based Regression Testing [closed]
Asked Answered
P

3

10

How is regression testing performed in Java? Are there automated regression test frameworks or do you just write (JUnit) unit tests that help ensure against regressions?

Is there a way or set of best practices for coding unit tests so that they also serve the dual purpose of being regression tests, or do you need to keep regression tests separate from your unit tests?

Paisano answered 21/9, 2011 at 15:6 Comment(1)
Might be best on programmers.stackexchange.comInjure
C
1

JUnit is generally aimed for unit tests rather than full-scale functional testing (of which regression testing is an example if one is looking at the system as a whole).

However, it is not uncommon to use a separate test suit to perform "heavy" functional and integration tests that connect to actual backends, etc., and verify results against expectations.

One reason for the use of JUnit here is the ability to go from 'mocked tests' to actual functional tests using dependency injection. You could provide, for example, a mock collaborator in the lighter test, and an actual collaborator instance in the full functional test.

Caren answered 21/9, 2011 at 15:16 Comment(2)
So what are some typical regression/functional testing frameworks for Java if JUnit is not best-suited for this type of testing?Paisano
@Mara - www.spockframework.orgDyna
Y
6

Regression testing has nothing to do with a language. It is a technique that is used to ensure future code changes do not break existing features. In Java you can use junit or testng or anything else. Typically a regression test is a functional test and is not a pure unit test.

Yahrzeit answered 21/9, 2011 at 15:11 Comment(3)
Thinks Woot4Moo. By "function test" do you mean "sequential", meaning that instead of testing one component/unit, it executes (in a script-like fashion) a series of actions to make sure that some invariant is preserved?Paisano
@Mara, that's how all automated testing works. Regression testing is just "testing new code against the old tests", the type of test it is (unit, functional, integration, etc.) doesn't make any difference.Actinopod
Dave - interesting. So, as long as you have maintain a thorough unit testing framework, then doesn't that also take care of regression testing as well, since you never discard an old unit test? This confuses me some, because all the time you hear about regression testing, but by your explanation, it sounds like all you have to do is make sure your unit testing is up to snuff. Am I on track or have I de-railed?Paisano
C
1

JUnit is generally aimed for unit tests rather than full-scale functional testing (of which regression testing is an example if one is looking at the system as a whole).

However, it is not uncommon to use a separate test suit to perform "heavy" functional and integration tests that connect to actual backends, etc., and verify results against expectations.

One reason for the use of JUnit here is the ability to go from 'mocked tests' to actual functional tests using dependency injection. You could provide, for example, a mock collaborator in the lighter test, and an actual collaborator instance in the full functional test.

Caren answered 21/9, 2011 at 15:16 Comment(2)
So what are some typical regression/functional testing frameworks for Java if JUnit is not best-suited for this type of testing?Paisano
@Mara - www.spockframework.orgDyna
A
0

A regression test is any test that catches regressions.

If you want acceptance tests I've heard good things about FitNesse.

Armandinaarmando answered 21/9, 2011 at 15:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.