Openbravo Issue Tracking System - Openbravo ERP |
| View Issue Details |
|
| ID | Project | Category | View Status | Date Submitted | Last Update |
| 0032275 | Openbravo ERP | A. Platform | public | 2016-02-18 14:50 | 2016-03-17 10:56 |
|
| Reporter | alostale | |
| Assigned To | alostale | |
| Priority | normal | Severity | minor | Reproducibility | N/A |
| Status | closed | Resolution | fixed | |
| Platform | | OS | 5 | OS Version | |
| Product Version | | |
| Target Version | | Fixed in Version | 3.0PR16Q2 | |
| Merge Request Status | |
| Review Assigned To | caristu |
| OBNetwork customer | No |
| Web browser | |
| Modules | Core |
| Support ticket | |
| Regression level | |
| Regression date | |
| Regression introduced in release | |
| Regression introduced by commit | |
| Triggers an Emergency Pack | No |
|
| Summary | 0032275: jUnit: add capability to assert on logs |
| Description | In some occasions, it is useful to create test cases to assert a concrete message is logged. Though this can be implemented by test, currently there is no a common API infrastructure to consume in order to achieve it. |
| Steps To Reproduce | Suppose you want to test that some warn message is logged after doing some process. Ideally the test would look like:
@Test
public void unbalancedAdminModeShouldLogWarn() {
setTestLogAppenderLevel(Level.WARN);
OBContext.setAdminMode(true);
OBContext.restorePreviousMode();
OBContext.restorePreviousMode(); // second restore is unbalanced
assertThat(getTestLogAppender().getMessages(Level.WARN),
hasItem(containsString("Unbalanced calls to setAdminMode")));
}
Where 1st line sets the threshold for which messages are going to be tracked and the asset gets messages tracked since that point and checks there is a concrete one. |
| Proposed Solution | |
| Additional Information | |
| Tags | No tags attached. |
| Relationships | |
| Attached Files | |
|
| Issue History |
| Date Modified | Username | Field | Change |
| 2016-02-18 14:50 | alostale | New Issue | |
| 2016-02-18 14:50 | alostale | Assigned To | => alostale |
| 2016-02-18 14:50 | alostale | OBNetwork customer | => No |
| 2016-02-18 14:50 | alostale | Modules | => Core |
| 2016-02-18 14:50 | alostale | Triggers an Emergency Pack | => No |
| 2016-02-18 14:51 | alostale | Steps to Reproduce Updated | bug_revision_view_page.php?rev_id=11165#r11165 |
| 2016-02-18 14:51 | alostale | Review Assigned To | => caristu |
| 2016-02-18 14:55 | hgbot | Checkin | |
| 2016-02-18 14:55 | hgbot | Note Added: 0084323 | |
| 2016-02-18 14:55 | hgbot | Status | new => resolved |
| 2016-02-18 14:55 | hgbot | Resolution | open => fixed |
| 2016-02-18 14:55 | hgbot | Fixed in SCM revision | => http://code.openbravo.com/erp/devel/pi/rev/06cd9c11c84e319330f31d8113426169b6da3e78 [^] |
| 2016-02-19 08:53 | hgbot | Checkin | |
| 2016-02-19 08:53 | hgbot | Note Added: 0084342 | |
| 2016-02-19 09:02 | caristu | Note Added: 0084343 | |
| 2016-02-19 09:02 | caristu | Status | resolved => closed |
| 2016-02-19 09:02 | caristu | Fixed in Version | => 3.0PR16Q2 |
| 2016-03-17 10:56 | hudsonbot | Checkin | |
| 2016-03-17 10:56 | hudsonbot | Note Added: 0085149 | |
| 2016-03-17 10:56 | hudsonbot | Checkin | |
| 2016-03-17 10:56 | hudsonbot | Note Added: 0085150 | |
|
Notes |
|
|
(0084323)
|
|
hgbot
|
|
2016-02-18 14:55
|
|
Repository: erp/devel/pi
Changeset: 06cd9c11c84e319330f31d8113426169b6da3e78
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Thu Feb 18 14:54:19 2016 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/06cd9c11c84e319330f31d8113426169b6da3e78 [^]
fixed issue 32275: jUnit: add capability to assert on logs
TestLogAppender can be used in test cases extending OBBaseTest to perform
assertions on what is logged.
---
M src-test/src/org/openbravo/test/base/OBBaseTest.java
A src-test/src/org/openbravo/test/base/TestLogAppender.java
---
|
|
|
|
(0084342)
|
|
hgbot
|
|
2016-02-19 08:53
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|