HI both, Currently I work with Gil for a customer site to different process for implement some integration and unit test dedicate to business case.
We will try to share some tips on the following weeks. Nicolas On 20/05/2021 20:46, Carsten Schinzer wrote: > Hello, > > > definitely I am interested and also would like to work against an aligned > standard. For example I found the issue of missing unit tests when > refactoring some simple methods to groovy (I promise to finish and submit > my started jira tickets in the upcoming Community Days). And I also asked > myself the same questions as you do. For the time being I have just guessed > where to place them, but yet a better approach would be to document > practice with this somewhere and track improvements in Jira. > > I also would support unit testing from integration testing, which comes > along with a definition of unit of course. I prefer the definition of a > class method as a unit over the class itself as a unit, but I am open to > arguments. > > My 2 cents. > Warm regards > > > Carsten > > Am Do., 20. Mai 2021 um 15:51 Uhr schrieb Erwin Penner < > erwin.pen...@mindbit.de>: > >> Hello everybody, >> >> I would like to create unit and integration tests for my custom modules in >> OFBiz. >> Unfortunately, information on this subject is sparse. >> For this reason, I checked how it is currently solved in the OFBiz modules. >> I'll explain what it's about first. At the end of the mail I have some >> questions. >> >> Using the example of the base or common modules in the OFBiz framework, >> simple unit tests can be found in a separate test source folder. >> src/test/java >> >> There are also test classes (presumably integration tests) in >> base/src/main/java/org/apach /ofbiz/base/test >> common/src/main/java/org/apache/ofbiz/common/test >> >> In the base module there are further test classes in >> base/src/main/java/org/apache/ofbiz/base/util/string/test >> >> So, I thought simple unit tests should be in the separate test source >> folder and integration tests under src/main/java/.../test >> >> Additionally, I found this (old) Confluence entry and was a bit confused: >> >> https://cwiki.apache.org/confluence/display/OFBIZ/Code+and+test+separation+for+Apache+OFBiz >> >> My questions are: >> - Which test classes belong where? >> - Is the current directory structure for tests the final solution or an >> incomplete refactoring? >> - Could/Should all tests (unit and integration tests) be maintained in >> /src/test/? >> - Which test classes must be described in the xml-definition under >> /testdef ? (My impression so far is that the OFBiz modules only list >> classes for integration tests.) >> - Should I use the ext-test-reader in my custom ofbiz-component.xml to >> load data for integration tests? >> - Can I define a different data source for the test delegator than for the >> default delegator? >> Because a comment in the entityengine.xml says "Be sure that your default >> delegator (or the one you use) uses the same datasource for test." >> >> Thanks in advance! I look forward to your answer/s! :-) >> >> Erwin >>