Not sure if it is Maven class path problem. I remembered that I run the test code inside IntelliJ IDEA and the configuration file was loaded successfully from the resources directory, i.e., class path. But if I run "mvn test" in the command line, seems it cannot find the file. Really strange. I will look deeper tonight.
Thanks, Jian On Mon, Apr 26, 2010 at 4:20 AM, Jonathan Share <[email protected]> wrote: > That was the confusing thing, my test does use JUnit 4 annotations. > > On 26 April 2010 02:32, Jian Fang <[email protected]> wrote: > > Thanks. I will look into the problem. > > > > For regular JUnit, It is hard to tell when the static block will get > > running. But for > > JUnit 4 annotations, the static block should run before the @BeforeClass > > method, > > which is what we want to exploit. > > > > Thanks, > > > > Jian > > > > On Sun, Apr 25, 2010 at 8:06 PM, Jonathan Share <[email protected]> > wrote: > >> > >> I've created a sample project that you can find here > >> > >> http://bitbucket.org/sharebear/telluriumconfigfilebug > >> > >> The details of the meaning of each test is defined in the README file > >> at the root of the project. > >> > >> One other issue I've just noticed is that when using the regular JUnit > >> runner the static initializer doesn't get run early enough to change > >> the filename. > >> > >> On 23 April 2010 15:45, Jian Fang <[email protected]> wrote: > >> > That is really wired. Could you create a sample project accordingly to > >> > your > >> > current > >> > project structure and send to us so that we can run and reproduce the > >> > problem? > >> > > >> > BTW, if you need to use difference configurations for different > >> > sub-projects, you could > >> > use a JSON string to represent the configuration (but not sure if this > >> > is > >> > what you > >> > want). For example, use a base test case to load the configuration > JSON > >> > string and all > >> > other test cases extend the base test case. > >> > > >> > More details on JSON configuration are here: > >> > > >> > > >> > > http://code.google.com/p/aost/wiki/Tellurium070Update#Tellurium_Configuration > >> > > >> > Thanks, > >> > > >> > Jian > >> > > >> > On Fri, Apr 23, 2010 at 9:21 AM, Jonathan Share <[email protected]> > >> > wrote: > >> >> > >> >> Actually sorry the problem isn't that I can't find the firefox > >> >> profile, it's that Tellurium is not able to load the config file. I > >> >> get the following error message when I run my test > >> >> > >> >> Cannot open configuration file > >> >> > >> >> > >> >> > C:\Source\test\trunk.svn\FunctionalTests\structured-data-tests\TelluriumConfig.groovy > >> >> (The system cannot find the file specified) > >> >> > >> >> This is the message given out by line 60 of the > TelluriumConfigParser, > >> >> which means that either getSystemResource() is returning an incorrect > >> >> URL instance or ConfigSlurper is not reading from the URL correctly > >> >> (I'm wondering if getText() on the URL object is the cause of the > >> >> problem here). The really confusing thing here is that the file > exists > >> >> in \structured-data-tests\src\test\resources\ > >> >> > >> >> Another interesting fact, if I try and run the test from the > >> >> sub-project structured-data-tests instead of the parent > >> >> FunctionalTests > >> >> "Cannot find configuration file: TelluriumConfig.groovy, use default > >> >> values" > >> >> > >> >> I have now worked around my issue by having another copy of > >> >> TelluriumConfig and changing the configFileName parameter in a static > >> >> initialiser, although this isn't exactly bug free. It seems as > though, > >> >> when I'm running tests from the parent project. A file must exist > with > >> >> the correct name at the root of the parent project but the config > file > >> >> is actually read in from the root of the child project. For now I > just > >> >> have a copy of the config files both places. > >> >> > >> >> Regards, > >> >> > >> >> Jonathan > >> >> > >> >> On 23 April 2010 10:07, Jonathan Share <[email protected]> wrote: > >> >> > Before I made the move I was using a path relative to the parent > >> >> > project directory. However this stopped working after moving > >> >> > TelluriumConfig.groovy to the src/test/resources directory. I > really > >> >> > don't want to go down the route of absolute paths, especially as I > >> >> > personally run these tests from windows (at work), linux (build > >> >> > server) and OS X (when working from home). > >> >> > > >> >> > On 22 April 2010 17:16, Jian Fang <[email protected]> > wrote: > >> >> >> If I remember correctly, the profile should be an absolute path, > >> >> >> have > >> >> >> you > >> >> >> tried that? > >> >> >> > >> >> >> Thanks, > >> >> >> > >> >> >> Jian > >> >> >> > >> >> >> On Thu, Apr 22, 2010 at 11:04 AM, Jonathan Share > >> >> >> <[email protected]> > >> >> >> wrote: > >> >> >>> > >> >> >>> I've just tried moving TelluriumConfig.groovy into > >> >> >>> src/test/resources > >> >> >>> however now firefox is unable to find my custom profile. What > path > >> >> >>> is > >> >> >>> the telluriumserver.embeddedserver.profile setting relative to > when > >> >> >>> TellurimConfig.groovy is in src/test/resources and I'm running > >> >> >>> maven > >> >> >>> from the parent project? > >> >> >>> > >> >> >>> On 26 March 2010 19:23, Jian Fang <[email protected]> > wrote: > >> >> >>> > Ok, I changed the configuration parser to load the > configuration > >> >> >>> > file > >> >> >>> > from > >> >> >>> > the class path instead of from the project root. > >> >> >>> > > >> >> >>> > Please get the new core artifact from the following url, > >> >> >>> > > >> >> >>> > > >> >> >>> > > >> >> >>> > > >> >> >>> > > http://maven.kungfuters.org/content/repositories/snapshots/org/telluriumsource/tellurium-core/0.7.0-SNAPSHOT/tellurium-core-0.7.0-20100326.172032-112.jar > >> >> >>> > > >> >> >>> > or use Maven to pull it down. > >> >> >>> > > >> >> >>> > Now, you can move telluriumconfig.groovy to src/test/resources > >> >> >>> > directory. > >> >> >>> > > >> >> >>> > Thanks, > >> >> >>> > > >> >> >>> > Jian > >> >> >>> > > >> >> >>> > On Fri, Mar 26, 2010 at 11:58 AM, Jian Fang > >> >> >>> > <[email protected]> > >> >> >>> > wrote: > >> >> >>> >> > >> >> >>> >> Good question. I will take a look to see if we can load the > >> >> >>> >> configuration > >> >> >>> >> file from the class path. > >> >> >>> >> But be aware that the first one may always win if you have > >> >> >>> >> multiple > >> >> >>> >> files > >> >> >>> >> on the class path. > >> >> >>> >> > >> >> >>> >> Optionally, I thought of using a JSON string to represent the > >> >> >>> >> configuration so that you can pass in > >> >> >>> >> different configurations to your tests very easily. > >> >> >>> >> > >> >> >>> >> Thanks, > >> >> >>> >> > >> >> >>> >> Jian > >> >> >>> >> > >> >> >>> >> On Fri, Mar 26, 2010 at 11:40 AM, Jonathan Share > >> >> >>> >> <[email protected]> > >> >> >>> >> wrote: > >> >> >>> >>> > >> >> >>> >>> Hi, > >> >> >>> >>> > >> >> >>> >>> Is there a method of defining where tellurium will look for > the > >> >> >>> >>> TelluriumConfig file? Or even better can you read it in from > >> >> >>> >>> the > >> >> >>> >>> classpath (then we could drop it in src/test/resources)? > >> >> >>> >>> > >> >> >>> >>> The reason that I'm asking is that I'm using tellurium in a > >> >> >>> >>> maven > >> >> >>> >>> multi-module project with the following structure; > >> >> >>> >>> > >> >> >>> >>> parent-project > >> >> >>> >>> \- commmon-tellurium-modules > >> >> >>> >>> \- smoke-tests > >> >> >>> >>> \- TelluriumConfig.groovy > >> >> >>> >>> \- excel-tests > >> >> >>> >>> \- TelluriumConfig.groovy > >> >> >>> >>> > >> >> >>> >>> In order to keep things as simple as possible for those > running > >> >> >>> >>> the > >> >> >>> >>> tests I want to allow them to run the tests in the following > >> >> >>> >>> manner; > >> >> >>> >>> $ mvn clean test -Psmoke > >> >> >>> >>> or > >> >> >>> >>> $ mvn clean test -Pexcel > >> >> >>> >>> > >> >> >>> >>> where the build profile defines which test project gets > pulled > >> >> >>> >>> into > >> >> >>> >>> the build, however tellurium always tries to read the file > from > >> >> >>> >>> the > >> >> >>> >>> current working directory which fails when I'm standing in > the > >> >> >>> >>> parent-project. > >> >> >>> >>> > >> >> >>> >>> Regards, > >> >> >>> >>> > >> >> >>> >>> Jonathan > >> >> >>> >>> > >> >> >>> >>> -- > >> >> >>> >>> You received this message because you are subscribed to the > >> >> >>> >>> Google > >> >> >>> >>> Groups > >> >> >>> >>> "tellurium-users" group. > >> >> >>> >>> To post to this group, send email to > >> >> >>> >>> [email protected]. > >> >> >>> >>> To unsubscribe from this group, send email to > >> >> >>> >>> [email protected]<tellurium-users%[email protected]> > . > >> >> >>> >>> For more options, visit this group at > >> >> >>> >>> http://groups.google.com/group/tellurium-users?hl=en. > >> >> >>> >>> > >> >> >>> >> > >> >> >>> > > >> >> >>> > -- > >> >> >>> > You received this message because you are subscribed to the > >> >> >>> > Google > >> >> >>> > Groups > >> >> >>> > "tellurium-users" group. > >> >> >>> > To post to this group, send email to > >> >> >>> > [email protected]. > >> >> >>> > To unsubscribe from this group, send email to > >> >> >>> > [email protected]<tellurium-users%[email protected]> > . > >> >> >>> > For more options, visit this group at > >> >> >>> > http://groups.google.com/group/tellurium-users?hl=en. > >> >> >>> > > >> >> >>> > >> >> >>> -- > >> >> >>> You received this message because you are subscribed to the > Google > >> >> >>> Groups > >> >> >>> "tellurium-users" group. > >> >> >>> To post to this group, send email to > >> >> >>> [email protected]. > >> >> >>> To unsubscribe from this group, send email to > >> >> >>> [email protected]<tellurium-users%[email protected]> > . > >> >> >>> For more options, visit this group at > >> >> >>> http://groups.google.com/group/tellurium-users?hl=en. > >> >> >>> > >> >> >> > >> >> >> -- > >> >> >> You received this message because you are subscribed to the Google > >> >> >> Groups > >> >> >> "tellurium-users" group. > >> >> >> To post to this group, send email to > >> >> >> [email protected]. > >> >> >> To unsubscribe from this group, send email to > >> >> >> [email protected]<tellurium-users%[email protected]> > . > >> >> >> For more options, visit this group at > >> >> >> http://groups.google.com/group/tellurium-users?hl=en. > >> >> >> > >> >> > > >> >> > >> >> -- > >> >> You received this message because you are subscribed to the Google > >> >> Groups > >> >> "tellurium-users" group. > >> >> To post to this group, send email to > [email protected]. > >> >> To unsubscribe from this group, send email to > >> >> [email protected]<tellurium-users%[email protected]> > . > >> >> For more options, visit this group at > >> >> http://groups.google.com/group/tellurium-users?hl=en. > >> >> > >> > > >> > -- > >> > You received this message because you are subscribed to the Google > >> > Groups > >> > "tellurium-users" group. > >> > To post to this group, send email to [email protected] > . > >> > To unsubscribe from this group, send email to > >> > [email protected]<tellurium-users%[email protected]> > . > >> > For more options, visit this group at > >> > http://groups.google.com/group/tellurium-users?hl=en. > >> > > >> > >> -- > >> You received this message because you are subscribed to the Google > Groups > >> "tellurium-users" group. > >> To post to this group, send email to [email protected]. > >> To unsubscribe from this group, send email to > >> [email protected]<tellurium-users%[email protected]> > . > >> For more options, visit this group at > >> http://groups.google.com/group/tellurium-users?hl=en. > >> > > > > -- > > You received this message because you are subscribed to the Google Groups > > "tellurium-users" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]<tellurium-users%[email protected]> > . > > For more options, visit this group at > > http://groups.google.com/group/tellurium-users?hl=en. > > > > -- > You received this message because you are subscribed to the Google Groups > "tellurium-users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<tellurium-users%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/tellurium-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "tellurium-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/tellurium-users?hl=en.
