Changes for page Testing-JUnit and TestNG

Last modified by Yana Oksner on 2026/01/08 12:10

From version 11.1
edited by Johann Werner
on 2012/08/06 03:19
Change comment: differentiation between normal and bundle-less builds
To version 14.1
edited by Johann Werner
on 2023/11/13 11:58
Change comment: Renamed from xwiki:documentation.Testing-JUnit and TestNG

Summary

Details

Page properties
Parent
... ... @@ -1,0 +1,1 @@
1 +How-tos
Content
... ... @@ -48,7 +48,7 @@
48 48  * example.com.app.Application myApp = new example.com.app.Application( ) ;
49 49  * ERXApplication.primeApplication(NSBundle.mainBundle().bundlePath(), null, "example.com.app.Application"); ~/~/(Wonder) or
50 50  * WOApplication.primeApplication(NSBundle.mainBundle().bundlePath(), null, "example.com.app.Application"); ~/~/(No Wonder)
51 -* er.extensions.ERXExtensions.initApp(example.com.app.Application.class, new StringWO:0) ;
51 +* er.extensions.ERXExtensions.initApp(example.com.app.Application.class, new String[WO:0]) ;
52 52  
53 53  One of them may work best in your situation. It may be important for your application to find its main bundle properly, and all the goodies bound up in that main bundle.
54 54  
... ... @@ -60,7 +60,7 @@
60 60  
61 61  A //normal// build means that you have checked the build option //Generate bundles// within the WOLips preferences.
62 62  
63 -[[image:bundle_builds.png]]
63 +[[image:attach:bundle_builds.png]]
64 64  
65 65  First in the //"Arguments"// tab, set your working directory to the build product of your project. For example, for a framework project the working directory should be:
66 66  
... ... @@ -70,7 +70,7 @@
70 70  
71 71  {{/noformat}}
72 72  
73 -For an application it should be (using the handy wolips//dir//loc variable)
73 +For an application it should be (using the handy wolips_dir_loc variable)
74 74  
75 75  {{noformat}}
76 76  
... ... @@ -78,28 +78,26 @@
78 78  
79 79  {{/noformat}}
80 80  
81 -[[image:RunConfig1.jpg]]
81 +[[image:attach:RunConfig1.jpg]]
82 82  
83 83  Then, in the classpath tab, select the //"User Entries"// entry and use the //"Advanced..."// button and select the //"Add Folders"// button.
84 -[[image:RunConfig2.jpg]]
84 +[[image:attach:RunConfig2.jpg]]
85 85  
86 86  Select the //"Java"// folder of your build product. Use the //"Up/Down"// buttons to move this folder at the first position of your classpath.
87 -[[image:RunConfig3.jpg]]
87 +[[image:attach:RunConfig3.jpg]]
88 88  
89 89  {{note title="Be Careful"}}
90 -
91 -If during your tests execution you see error messages such as *cannot cast EOGenericRecord to <your object>* please check that the _"Java"_ folder is at first position in your classpath entries.
92 -
90 +If during your tests execution you see error messages such as **cannot cast EOGenericRecord to <your object>** please check that the //"Java"// folder is at first position in your classpath entries.
93 93  {{/note}}
94 94  
95 95  The last step is to add the parameter //-DNSProjectBundleEnabled=true// to your VM parameters.
96 -[[image:vm_arguments.png]]
94 +[[image:attach:vm_arguments.png]]
97 97  
98 98  === Bundle-less builds ===
99 99  
100 100  A //bundle-less// build means that you have unchecked the build option //Generate bundles// within the WOLips preferences.
101 101  
102 -[[image:bundleless_builds.png]]
100 +[[image:attach:bundleless_builds.png]]
103 103  
104 104  That means that there will be no //build// folder in your project. In that case you must set the working directoy to the default:
105 105  
RunConfig1.jpg
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.XWikiGuest
Size
... ... @@ -1,0 +1,1 @@
1 +78.8 KB
Content
RunConfig2.jpg
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.XWikiGuest
Size
... ... @@ -1,0 +1,1 @@
1 +38.8 KB
Content
RunConfig3.jpg
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.XWikiGuest
Size
... ... @@ -1,0 +1,1 @@
1 +18.7 KB
Content
bundle_builds.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.XWikiGuest
Size
... ... @@ -1,0 +1,1 @@
1 +9.4 KB
Content
bundleless_builds.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.XWikiGuest
Size
... ... @@ -1,0 +1,1 @@
1 +9.3 KB
Content
vm_arguments.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.XWikiGuest
Size
... ... @@ -1,0 +1,1 @@
1 +18.0 KB
Content
XWiki.XWikiComments[0]
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.chillatgvc
Comment
... ... @@ -1,0 +1,1 @@
1 +Assuming that you have a Wonder application, you should be able to test bundless-builds by adding -DNSProjectBundleEnabled=true to the VM arguments (yes, VM not Program). This worked for TestNG, I have not tried with JUnit.
Date
... ... @@ -1,0 +1,1 @@
1 +2012-08-01 18:25:38.80
XWiki.XWikiComments[1]
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.jw
Comment
... ... @@ -1,0 +1,1 @@
1 +You are right, with that setting it worked for me too. Though without the build folder when no bundles are generated you have to change the settings a little bit. Updated the wiki page to reflect that.
Date
... ... @@ -1,0 +1,1 @@
1 +2012-08-06 03:26:35.670
Reply To
... ... @@ -1,0 +1,1 @@
1 +0
XWiki.XWikiComments[2]
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.greg
Comment
... ... @@ -1,0 +1,1 @@
1 +hi, when you used your methods how you run your junit test case because a junit test can't run with woApplication and just junit application
Date
... ... @@ -1,0 +1,1 @@
1 +2012-09-05 04:54:46.926
XWiki.XWikiComments[3]
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.greg
Comment
... ... @@ -1,0 +1,1 @@
1 +hi, when you use your methods how you run your junit test case because a junit test can't run with woApplication and just junit application
Date
... ... @@ -1,0 +1,1 @@
1 +2012-09-05 04:54:54.383
XWiki.XWikiComments[4]
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.jw
Comment
... ... @@ -1,0 +1,1 @@
1 +What do you mean with "your methods"? If you need part or complete application/EOF initialization for your tests look just below the code example on this page how to setup your environment (e.g. ERXExtensions.initApp(), ERXExtensions.initEOF(), …).
Date
... ... @@ -1,0 +1,1 @@
1 +2012-09-28 13:35:46.0
Reply To
... ... @@ -1,0 +1,1 @@
1 +2
XWiki.XWikiComments[5]
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.timoteo_ponce
Comment
... ... @@ -1,0 +1,7 @@
1 +Hi. I'm kind of new in WO world, is there an example project where I can check the basic flow for development?
2 +
3 +I mean:
4 +
5 + - working code
6 +
7 + - test units for that code
Date
... ... @@ -1,0 +1,1 @@
1 +2013-01-21 16:03:07.737