Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 355409 - JUnit: Use @Before and @After framework instead of relying on super calls from subclasses in setUp()/tearDown() for lifecycle
Summary: JUnit: Use @Before and @After framework instead of relying on super calls fro...
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-22 11:49 EDT by Michael OBrien CLA
Modified: 2022-06-09 10:23 EDT (History)
0 users

See Also:


Attachments
JUnit framework change to use @Before @After example (2.65 KB, patch)
2011-08-22 11:51 EDT, Michael OBrien CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael OBrien CLA 2011-08-22 11:49:59 EDT
>Issue: We currently rely on subclasses to properly call super.setUp() first and super.tearDown() last in their own code.
The superclass methods are empty, but in the future if general setup and teardown functionality is added we may leak test configuration between subsequently running suites.

>Fix: Use @Before and @After to manage setup/teardown lifecycle.
The superclass @Before and @After will encompas any subclass @Before and @After as expected - without the use of super calls.
Make the superclass setup/tearDown final and rename them so that the framework general lifecycle events will always get run.
Do not defer to an abstract setup/teardown implemented by subclass - the JUnit framework will do this for us via proper use of annotations.
Comment 1 Michael OBrien CLA 2011-08-22 11:51:50 EDT
Created attachment 201934 [details]
JUnit framework change to use @Before @After example
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:17:11 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:23:34 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink