Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0045839Openbravo ERPA. Platformpublic2021-02-03 16:052022-02-01 14:44
alostale 
Triage Platform Base 
normalminorhave not tried
newopen 
5
 
 
Core
No
0045839: disabled jUnit tests execute @After method but not @Before
When a jUnit test is disabled by config [1], its @After method is executed but not its @Before one. This can be problematic if @After assumes @Before was executed.

The reason is the test is disabled in OBBaseTest @Before method execute assumeTrue(false), which causes the rest of @Before methods in the hierarchy not to be executed, but all @After methods are executed.

[1] http://wiki.openbravo.com/wiki/How_to_create_JUnit_testcases#Skipping_test_cases [^]
Find here [1] a simplified stack that reproduces the problem.

[1] https://gitlab.com/alo-issues/openbravo/-/snippets/2070275 [^]
To be consistent with how tests are disabled programmatically with assumptions, both should be executed.
No tags attached.
related to defect 0045840 new Triage Platform Base Openbravo ERP MisfirePolicyTest fails when it's disabled by configuration 
related to defect 0048493 closed Triage Omni WMS Modules NPE executing tests if OBDOReservationTest is disabled 
Issue History
2021-02-03 16:05alostaleNew Issue
2021-02-03 16:05alostaleAssigned To => platform
2021-02-03 16:05alostaleModules => Core
2021-02-03 16:05alostaleTriggers an Emergency Pack => No
2021-02-03 16:07shuehnerIssue Monitored: shuehner
2021-02-03 16:12alostaleRelationship addedrelated to 0045840
2022-01-25 11:47martinsdanIssue Monitored: martinsdan
2022-01-27 14:57alostaleRelationship addedrelated to 0048493
2022-02-01 08:07alostaleAssigned Toplatform => Triage Platform Base
2022-02-01 14:44hgbotNote Added: 0134712

Notes
(0134712)
hgbot   
2022-02-01 14:44   
Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.warehouse.advancedwarehouseoperations.distributionorders [^]
Changeset: 2bda4a6c6accbebba0f5cd17b33c4fe733bbbfe3
Author: Asier Lostalé <asier.lostale@openbravo.com>
Date: 27-01-2022 15:34:16
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.warehouse.advancedwarehouseoperations.distributionorders/-/commit/2bda4a6c6accbebba0f5cd17b33c4fe733bbbfe3 [^]

fixes BUG-48493: NPE executing tests if OBDOReservationTest is disabled

Because of ISSUE-45839, @AfterClass is executed even if the test is
disabled by configuration. Executing it without having executed the
@Before caused a NPE.

Now even the method is executed in case @Before was not executed, it
does nothing preventing thus the NPE.

---
M src-test/org/openbravo/warehouse/advancedwarehouseoperations/distributionorders/test/OBDOReservationTest.java
---