Re: jsunit integration
I just included your code (backported to jsunit 2.1) in my jsUnitMojo to get the expected report. I also requested for upload of the required dependencies on central. 2007/10/22, nicolas de loof <[EMAIL PROTECTED]>: > > I also got no reply to my request. jsunit (2.1) depends on jetty 4.2. I've > asked the jetty guys to upload the requierd jars to there maven repo (will > be sync to central). > > I'll ask to upload the jsunit artifacts as far as all dependencies are > available. > > 2007/10/22, Harlan Iverson <[EMAIL PROTECTED]>: > > > > The recurring issue seems to be getting JSUnit dependencies from Maven. > > Is > > there a dialog open with the JSUnit team about this? > > > > I've made an attempt but heard nothing: > > http://tech.groups.yahoo.com/group/jsunit/message/954 > > > > In my opinion, the ideal solution would be to get JSUnit building with a > > set > > of dependencies are are compatible with that's in Maven central (adding > > some > > more if necessary, like start.jar for jetty5x), and itself deploying > > artifact(s) of its own. > > > > I've myself started working on JSUnit's build.xml and to use Maven > > Antlib > > and created a pom to do just that (I can send it to anyone who's > > interested); I think the only thing it needs missing is start.jar. > > > > Here's relevant threads from the JSUnit list: > > http://tech.groups.yahoo.com/group/jsunit/message/988 > > > > > > I also think that Nico's approach of breaking jsunit-app into its own > > artifact to run inside Jetty, merged with a project's test cases and > > dependencies, is worth looking more at. > > > > Harlan > > > > On 10/22/07, nicolas de loof <[EMAIL PROTECTED]> wrote: > > > > > > FYI I've started a javascript plugin project as part of maven Mojo. It > > > > > allready support running jsunit tests : > > > > > > http://svn.codehaus.org/mojo/trunk/sandbox/javascript-maven-tools > > > > > > You can look at javascript-maven-plugin JsUnitMojo, that runs a > > customized > > > TestCase with a shared jsUnit server to avoid the server-per-test > > issue > > > you > > > noticed. > > > > > > You will not be able to run the plugin as many dependencies are not > > (yet) > > > available in central repo. > > > You can look at the src/it projects on how to configure and use the > > plugin > > > for jsunit tests. > > > > > > Could you give me an example of the test result generated from jsunit > > > result > > > ? This part of the plugin is far perfectible, and I would welcome > > > contribution ;-) > > > > > > Nico. > > > > > > > > > 2007/10/22, Insitu <[EMAIL PROTECTED] >: > > > > > > > > Hello, > > > > I am working on integrating jsunit ( http://www.jsunit.net) into > > > > maven. I would like to share some thoughts and request some advices > > > > avout the best way to do that integration. > > > > > > > > Right now, I have a sample (maven) project that executes jsunit > > tests > > > > from maven and generates reports. What I did is: > > > > - modify jsunit java server test cases to generate JUnit test > > results > > > >from jsunit test results: That way javascript unit tests results > > > >and error gets integrated seamlessly into surefire's reports > > > > - package the java server as an artifact > > > > - encapsulates all tests in a single JUnit tests cases that > > > >configures things and laucn jsunit's StandaloneTest class > > > > > > > > Some problems are: > > > > - test pages contains hardwired and absolute references to > > everything > > > >(ie. scripts and jsunti base directory) which is BAD ! > > > > - you need to install jsunit somewhere locally > > > > - you need to modify and track files by hand outside of the scope of > > > >the project > > > > - test server is started once for each test execution or event each > > > > > >JUnit test class execution which can be a performance bottleneck > > > >for large and/or deep projects > > > > > > > > What I want to do is: > > > > 1. package jsunit runner and support files as a jar or zip > > > > 2. create a plugin tbound to process-test-sources that would unpack > > > > the jsunit site in target/jsunit-runner > > > > 3. configure generically test server/runners to have > > > > target/jsunit-runner as their root site. This implies that > > > > javascript source files, test files and test pages be moved to > > > > this directory too... > > > > > > > > Ideally, I would rather serve everything from a servlet launched > > > > through jetty with the adequate maven plugin but this would require > > > > heavy changes to jsunit java server code. Or may be not... > > > > > > > > Comments and ideas are welcomed, > > > > > > > > regards, > > > > -- > > > > OQube < software engineering \ génie logiciel > > > > > Arnaud Bailly, Dr. > > > > \web> http://www.oqube.com > > > > > > > > > > > > > > - > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail
Re: jsunit integration
Your code is for jsUnit 2.2. My plugin uses jsunit 2.1 that is easier to embedd. I'll consider upgrading to 2.2 when a final version is released and when all jsunit dependencies are resolved. About the hardcoded path, jsUnit needs the executable path to the browser. The exepcted plugin configuration should point the absolute path, but for convenience the shortcut "firefox" and "iexplorer" are converted to the default location of those executables on windows, as they are not include in PATH by default. On unix system we can launch them without absolute path as the PATH may include the expected locations. I plan to look at selenium how they run browsers without full path. Nico 2007/10/22, Insitu <[EMAIL PROTECTED]>: > > "nicolas de loof" <[EMAIL PROTECTED]> writes: > > > FYI I've started a javascript plugin project as part of maven Mojo. It > > allready support running jsunit tests : > > > > http://svn.codehaus.org/mojo/trunk/sandbox/javascript-maven-tools > > > > Ah ah, that's good. I was a bit lost with all those javascript plugins > laying around... I used maven-jstools as a base because I a mostly > interested irght now in jsdoc and jslint, not packing. > > > You can look at javascript-maven-plugin JsUnitMojo, that runs a > customized > > TestCase with a shared jsUnit server to avoid the server-per-test issue > you > > noticed. > > > > You will not be able to run the plugin as many dependencies are not > (yet) > > available in central repo. > > Could'nt you make them available ? Or give directions on how to build > these dependencies ? I assume these are the static files for jsunit > runner. I could build them myself. > > > You can look at the src/it projects on how to configure and use the > plugin > > for jsunit tests. > > > > Could you give me an example of the test result generated from jsunit > result > > ? This part of the plugin is far perfectible, and I would welcome > > contribution ;-) > > > > I just wrote a mapper class that constructs a > TestResult object from the results generated by jsunit: > > public class BrowseResultToJUnitResult { > > private TestResult testResult; > > public BrowseResultToJUnitResult(TestResult tr) { > this.testResult = tr; > } > > /** > * Add all the testcases found in the given test result to >this junit > * TestResult. > * > * @param res > *a BrowserResult instance. > */ > public void addBrowserResult(BrowserResult res) { > for (final TestCaseResult tcr : > res.getTestCaseResults()) { > Test t = new Test() { > > public void run(TestResult arg0) { > } > > public int countTestCases() { > return 1; > } > > public String toString() { > return tcr.getName(); > } > }; > testResult.startTest(t); > if (!tcr.wasSuccessful()) { > ResultType type = tcr.getResultType(); > if (type == ResultType.ERROR) { > testResult.addError(t, new > Exception(tcr.getError())); > } else if (type == ResultType.FAILURE) > { > testResult.addFailure(t, new > AssertionFailedError(tcr > .getFailure())); > } > } > testResult.endTest(t); > } > } > } > > and here are the tests: > > public class MapAcceptorToTestResultTest extends TestCase { > > public void testLoadResultFileAndCreateTestResult() throws > IOException { > String xml = "acceptor-sample.xml"; > String value = xmlAsString(xml); > BrowserResultBuilder builder = new > BrowserResultBuilder( > new DummyBrowserSource("toto", 1)); > BrowserResult res = builder.build(value); > TestResult tr = new TestResult(); > BrowseResultToJUnitResult jres = new > BrowseResultToJUnitResult(tr); > jres.addBrowserResult(res); > assertEquals(8, tr.runCount()); > assertEquals(0, tr.errorCount()); > } > > public void testLoadResultWithFailuresAndCreateTestResult() > throws IOException { > String xml = "acceptor-sample2.xml"; > String value = xmlAsString(xml); > BrowserRe
Re: jsunit integration
I also got no reply to my request. jsunit (2.1) depends on jetty 4.2. I've asked the jetty guys to upload the requierd jars to there maven repo (will be sync to central). I'll ask to upload the jsunit artifacts as far as all dependencies are available. 2007/10/22, Harlan Iverson <[EMAIL PROTECTED]>: > > The recurring issue seems to be getting JSUnit dependencies from Maven. Is > there a dialog open with the JSUnit team about this? > > I've made an attempt but heard nothing: > http://tech.groups.yahoo.com/group/jsunit/message/954 > > In my opinion, the ideal solution would be to get JSUnit building with a > set > of dependencies are are compatible with that's in Maven central (adding > some > more if necessary, like start.jar for jetty5x), and itself deploying > artifact(s) of its own. > > I've myself started working on JSUnit's build.xml and to use Maven Antlib > and created a pom to do just that (I can send it to anyone who's > interested); I think the only thing it needs missing is start.jar. > > Here's relevant threads from the JSUnit list: > http://tech.groups.yahoo.com/group/jsunit/message/988 > > > I also think that Nico's approach of breaking jsunit-app into its own > artifact to run inside Jetty, merged with a project's test cases and > dependencies, is worth looking more at. > > Harlan > > On 10/22/07, nicolas de loof <[EMAIL PROTECTED]> wrote: > > > > FYI I've started a javascript plugin project as part of maven Mojo. It > > allready support running jsunit tests : > > > > http://svn.codehaus.org/mojo/trunk/sandbox/javascript-maven-tools > > > > You can look at javascript-maven-plugin JsUnitMojo, that runs a > customized > > TestCase with a shared jsUnit server to avoid the server-per-test issue > > you > > noticed. > > > > You will not be able to run the plugin as many dependencies are not > (yet) > > available in central repo. > > You can look at the src/it projects on how to configure and use the > plugin > > for jsunit tests. > > > > Could you give me an example of the test result generated from jsunit > > result > > ? This part of the plugin is far perfectible, and I would welcome > > contribution ;-) > > > > Nico. > > > > > > 2007/10/22, Insitu <[EMAIL PROTECTED]>: > > > > > > Hello, > > > I am working on integrating jsunit ( http://www.jsunit.net) into > > > maven. I would like to share some thoughts and request some advices > > > avout the best way to do that integration. > > > > > > Right now, I have a sample (maven) project that executes jsunit tests > > > from maven and generates reports. What I did is: > > > - modify jsunit java server test cases to generate JUnit test results > > >from jsunit test results: That way javascript unit tests results > > >and error gets integrated seamlessly into surefire's reports > > > - package the java server as an artifact > > > - encapsulates all tests in a single JUnit tests cases that > > >configures things and laucn jsunit's StandaloneTest class > > > > > > Some problems are: > > > - test pages contains hardwired and absolute references to everything > > >(ie. scripts and jsunti base directory) which is BAD ! > > > - you need to install jsunit somewhere locally > > > - you need to modify and track files by hand outside of the scope of > > >the project > > > - test server is started once for each test execution or event each > > >JUnit test class execution which can be a performance bottleneck > > >for large and/or deep projects > > > > > > What I want to do is: > > > 1. package jsunit runner and support files as a jar or zip > > > 2. create a plugin tbound to process-test-sources that would unpack > > > the jsunit site in target/jsunit-runner > > > 3. configure generically test server/runners to have > > > target/jsunit-runner as their root site. This implies that > > > javascript source files, test files and test pages be moved to > > > this directory too... > > > > > > Ideally, I would rather serve everything from a servlet launched > > > through jetty with the adequate maven plugin but this would require > > > heavy changes to jsunit java server code. Or may be not... > > > > > > Comments and ideas are welcomed, > > > > > > regards, > > > -- > > > OQube < software engineering \ génie logiciel > > > > Arnaud Bailly, Dr. > > > \web> http://www.oqube.com > > > > > > > > > - > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > >
Re: jsunit integration
"nicolas de loof" <[EMAIL PROTECTED]> writes: > FYI I've started a javascript plugin project as part of maven Mojo. It > allready support running jsunit tests : > > http://svn.codehaus.org/mojo/trunk/sandbox/javascript-maven-tools > Ah ah, that's good. I was a bit lost with all those javascript plugins laying around... I used maven-jstools as a base because I a mostly interested irght now in jsdoc and jslint, not packing. > You can look at javascript-maven-plugin JsUnitMojo, that runs a customized > TestCase with a shared jsUnit server to avoid the server-per-test issue you > noticed. > > You will not be able to run the plugin as many dependencies are not (yet) > available in central repo. Could'nt you make them available ? Or give directions on how to build these dependencies ? I assume these are the static files for jsunit runner. I could build them myself. > You can look at the src/it projects on how to configure and use the plugin > for jsunit tests. > > Could you give me an example of the test result generated from jsunit result > ? This part of the plugin is far perfectible, and I would welcome > contribution ;-) > I just wrote a mapper class that constructs a TestResult object from the results generated by jsunit: public class BrowseResultToJUnitResult { private TestResult testResult; public BrowseResultToJUnitResult(TestResult tr) { this.testResult = tr; } /** * Add all the testcases found in the given test result to this junit * TestResult. * * @param res *a BrowserResult instance. */ public void addBrowserResult(BrowserResult res) { for (final TestCaseResult tcr : res.getTestCaseResults()) { Test t = new Test() { public void run(TestResult arg0) { } public int countTestCases() { return 1; } public String toString() { return tcr.getName(); } }; testResult.startTest(t); if (!tcr.wasSuccessful()) { ResultType type = tcr.getResultType(); if (type == ResultType.ERROR) { testResult.addError(t, new Exception(tcr.getError())); } else if (type == ResultType.FAILURE) { testResult.addFailure(t, new AssertionFailedError(tcr .getFailure())); } } testResult.endTest(t); } } } and here are the tests: public class MapAcceptorToTestResultTest extends TestCase { public void testLoadResultFileAndCreateTestResult() throws IOException { String xml = "acceptor-sample.xml"; String value = xmlAsString(xml); BrowserResultBuilder builder = new BrowserResultBuilder( new DummyBrowserSource("toto", 1)); BrowserResult res = builder.build(value); TestResult tr = new TestResult(); BrowseResultToJUnitResult jres = new BrowseResultToJUnitResult(tr); jres.addBrowserResult(res); assertEquals(8, tr.runCount()); assertEquals(0, tr.errorCount()); } public void testLoadResultWithFailuresAndCreateTestResult() throws IOException { String xml = "acceptor-sample2.xml"; String value = xmlAsString(xml); BrowserResultBuilder builder = new BrowserResultBuilder( new DummyBrowserSource("toto", 1)); BrowserResult res = builder.build(value); TestResult tr = new TestResult(); BrowseResultToJUnitResult jres = new BrowseResultToJUnitResult(tr); jres.addBrowserResult(res); assertEquals(8, tr.runCount()); assertEquals(0, tr.errorCount()); assertEquals(1, tr.failureCount()); } private String xmlAsString(String xml) throws IOException { String value; InputStream is = getClass().getResourceAsStream(xml); ByteArrayOutputStream bos = new ByteArrayOutputStream(); byte[] data = new byte[1024]; int ln = 0; while ((ln = is.read(data, 0, 1024)) != -1) {
Re: jsunit integration
The recurring issue seems to be getting JSUnit dependencies from Maven. Is there a dialog open with the JSUnit team about this? I've made an attempt but heard nothing: http://tech.groups.yahoo.com/group/jsunit/message/954 In my opinion, the ideal solution would be to get JSUnit building with a set of dependencies are are compatible with that's in Maven central (adding some more if necessary, like start.jar for jetty5x), and itself deploying artifact(s) of its own. I've myself started working on JSUnit's build.xml and to use Maven Antlib and created a pom to do just that (I can send it to anyone who's interested); I think the only thing it needs missing is start.jar. Here's relevant threads from the JSUnit list: http://tech.groups.yahoo.com/group/jsunit/message/988 I also think that Nico's approach of breaking jsunit-app into its own artifact to run inside Jetty, merged with a project's test cases and dependencies, is worth looking more at. Harlan On 10/22/07, nicolas de loof <[EMAIL PROTECTED]> wrote: > > FYI I've started a javascript plugin project as part of maven Mojo. It > allready support running jsunit tests : > > http://svn.codehaus.org/mojo/trunk/sandbox/javascript-maven-tools > > You can look at javascript-maven-plugin JsUnitMojo, that runs a customized > TestCase with a shared jsUnit server to avoid the server-per-test issue > you > noticed. > > You will not be able to run the plugin as many dependencies are not (yet) > available in central repo. > You can look at the src/it projects on how to configure and use the plugin > for jsunit tests. > > Could you give me an example of the test result generated from jsunit > result > ? This part of the plugin is far perfectible, and I would welcome > contribution ;-) > > Nico. > > > 2007/10/22, Insitu <[EMAIL PROTECTED]>: > > > > Hello, > > I am working on integrating jsunit ( http://www.jsunit.net) into > > maven. I would like to share some thoughts and request some advices > > avout the best way to do that integration. > > > > Right now, I have a sample (maven) project that executes jsunit tests > > from maven and generates reports. What I did is: > > - modify jsunit java server test cases to generate JUnit test results > >from jsunit test results: That way javascript unit tests results > >and error gets integrated seamlessly into surefire's reports > > - package the java server as an artifact > > - encapsulates all tests in a single JUnit tests cases that > >configures things and laucn jsunit's StandaloneTest class > > > > Some problems are: > > - test pages contains hardwired and absolute references to everything > >(ie. scripts and jsunti base directory) which is BAD ! > > - you need to install jsunit somewhere locally > > - you need to modify and track files by hand outside of the scope of > >the project > > - test server is started once for each test execution or event each > >JUnit test class execution which can be a performance bottleneck > >for large and/or deep projects > > > > What I want to do is: > > 1. package jsunit runner and support files as a jar or zip > > 2. create a plugin tbound to process-test-sources that would unpack > > the jsunit site in target/jsunit-runner > > 3. configure generically test server/runners to have > > target/jsunit-runner as their root site. This implies that > > javascript source files, test files and test pages be moved to > > this directory too... > > > > Ideally, I would rather serve everything from a servlet launched > > through jetty with the adequate maven plugin but this would require > > heavy changes to jsunit java server code. Or may be not... > > > > Comments and ideas are welcomed, > > > > regards, > > -- > > OQube < software engineering \ génie logiciel > > > Arnaud Bailly, Dr. > > \web> http://www.oqube.com > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > >
Re: jsunit integration
FYI I've started a javascript plugin project as part of maven Mojo. It allready support running jsunit tests : http://svn.codehaus.org/mojo/trunk/sandbox/javascript-maven-tools You can look at javascript-maven-plugin JsUnitMojo, that runs a customized TestCase with a shared jsUnit server to avoid the server-per-test issue you noticed. You will not be able to run the plugin as many dependencies are not (yet) available in central repo. You can look at the src/it projects on how to configure and use the plugin for jsunit tests. Could you give me an example of the test result generated from jsunit result ? This part of the plugin is far perfectible, and I would welcome contribution ;-) Nico. 2007/10/22, Insitu <[EMAIL PROTECTED]>: > > Hello, > I am working on integrating jsunit (http://www.jsunit.net) into > maven. I would like to share some thoughts and request some advices > avout the best way to do that integration. > > Right now, I have a sample (maven) project that executes jsunit tests > from maven and generates reports. What I did is: > - modify jsunit java server test cases to generate JUnit test results >from jsunit test results: That way javascript unit tests results >and error gets integrated seamlessly into surefire's reports > - package the java server as an artifact > - encapsulates all tests in a single JUnit tests cases that >configures things and laucn jsunit's StandaloneTest class > > Some problems are: > - test pages contains hardwired and absolute references to everything >(ie. scripts and jsunti base directory) which is BAD ! > - you need to install jsunit somewhere locally > - you need to modify and track files by hand outside of the scope of >the project > - test server is started once for each test execution or event each >JUnit test class execution which can be a performance bottleneck >for large and/or deep projects > > What I want to do is: > 1. package jsunit runner and support files as a jar or zip > 2. create a plugin tbound to process-test-sources that would unpack > the jsunit site in target/jsunit-runner > 3. configure generically test server/runners to have > target/jsunit-runner as their root site. This implies that > javascript source files, test files and test pages be moved to > this directory too... > > Ideally, I would rather serve everything from a servlet launched > through jetty with the adequate maven plugin but this would require > heavy changes to jsunit java server code. Or may be not... > > Comments and ideas are welcomed, > > regards, > -- > OQube < software engineering \ génie logiciel > > Arnaud Bailly, Dr. > \web> http://www.oqube.com > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >