-
Notifications
You must be signed in to change notification settings - Fork 66
Command line unit test (ml local test) fails with 404 not found error #324
Comments
Roxy Unit Testing depends on a particular set of files that need to be uploaded to the modules database. Unfortunately, when creating a new Roxy project with app-type 'rest', those files are left out. You need to copy all files within https://github.com/marklogic/roxy/tree/master/src/test, either by cloning Roxy manually elsewhere, or by creating another Roxy project with app-type 'hybrid' or 'mvc', and copying the folder src/test/ over. Follow with a deploy modules. That will at least allow you to run http://localhost:8042/test/, but ml local test will still fail. That is because it is expecting the Roxy MVC/Hybrid rewriter, and that is not installed for the REST type projects.. Alternatively, you could re-create your Roxy project, but then with app-type hybrid. That might be easiest for the time being.. |
Dave goes through a bunch of these details, also for REST type, in this tutorial video on Roxy Unit Testing: |
@dmcassel / @paxtonhare: I do think this needs some attention. Running ml local test could detect its missing src/test/, and it could help download and deploy that code. Also, we need to make a different call (e.g. not to /test/run) to make ml local test actually work. I had the impression it should be something like /test/default.xqy?func=run. That seems to get you further, but then you come across the tests that are included by default, and those seem to depend on other modules, like /roxy/lib/cpf.xqy. It stopped running after not finding that? |
I did change testing a while ago so that it should work with app-type=rest, but it does still require manually copying over. Also yes, the provided tests are testing the MVC code, which isn't normally there. When using unit testing with an app-type=rest, the provided tests should be looked at as examples only. Maybe as part of "ml new", we should prompt for whether unit testing is desired and copy the appropriate files over. Alternatively, when you run "ml {env} test", we could see that the directory pointed to by "xquery-test.dir" is empty/non-existent and offer to initialize it. That would require pulling down some code from GitHub, but would be the most flexible option. I'll write up a wiki to describe the current state of things. |
Just wrote up a wiki on unit testing REST applications. Reviews welcome. With that written up, I propose closing this ticket. @venuiyengar, has your question been answered? |
Sounds good to get the unit tests on demand depending upon the user's preference. However, the existing command line option should be removed or will it work once the files are copied over? In my case the tests did work by running through the url http://localhost:8042/test Please clarify - Thanks |
…epend on the mvc/hybrid rewriter
#324 fixing command-line test so that it doesn't depend on the mvc/hybri...
@venuiyengar, the dev branch was just updated with a fix such that "ml {env} test" will work with REST applications. |
I had some issue while deploying module related to xcc connectivity and I was getting
Roxy::Http : request failure count: 1, exception: #<Errno::ECONNABORTED: An established connection was aborted by the software in your host machine.>
I tried to run unit test from command line after un-commenting test related attributes in build.properties. The unit test uses port 8042 and apparently you can run the test from the browser http://loccalhost:8042/test. However when you run "ml local test" it gives an error related to name space. I get the same 404 error while accessing http://marklogic.com/rest-api through the browser
The text was updated successfully, but these errors were encountered: