svanoort / pyresttest

Python Rest Testing
Apache License 2.0
1.15k stars 326 forks source link

Unable to run pyresttest #136

Closed VikramBPurohit closed 8 years ago

VikramBPurohit commented 8 years ago

Hi There,

I never used python but this project is really interesting. I am trying to test services written in express.js I am able to access Yaml file from browser URL but when I am trying to access using --URL and --test Somehow resttest.py is not able to find yaml file.

Any help on understanding how resttest.py is trying to find a file would be greatly appreciated.

help_wanted

svanoort-jenkins commented 8 years ago

Hi, The file is relative to the current folder, there's nothing special done with paths. Cary you provide the folder structure, command and output?

Also it would be helpful to know if symbolic links are used.

Thanks! Sam On Dec 29, 2015 12:26 PM, "Vikram Purohit" notifications@github.com wrote:

Hi There,

I never used python but this project is really interesting I am trying to test services written in expressjs I am able to access Yaml file from browser URL but when I am trying to access using --URL and --test Somehow resttestpy is not able to find yaml file

Any help on understanding how resttestpy is trying to find a file would be greatly appreciated

— Reply to this email directly or view it on GitHub https://github.com/svanoort/pyresttest/issues/136.

VikramBPurohit commented 8 years ago

Hi Sam (@svanoort-jenkins),

Thanks for your response!

I have created a sample express application for you to review. Yaml file is inside public/test folder.

https://github.com/VikramBPurohit/pyresttest-express.git

To run below project you have to -

npm install node app.js

Below is the error I am getting when trying to run pyresttest -

image

Thanks in Advance.

--Vikram

svanoort commented 8 years ago

@VikramBPurohit When I try to run your test, I can't reproduce it on python 2.6, 2.7 or 3.4.3, I'm wondering what your current folder is? Tests (and extensions) are loaded relative to the current working directory, it's a straight python file open.

My steps:

# Clone pyresttest, go into the pyresttest folder
docker run --rm -it -v $(pwd):/pyresttest -w /pyresttest python:3.4.3 /bin/bash
# Now inside container
python setup.py install
cd /tmp
git clone https://github.com/VikramBPurohit/pyresttest-express.git
cd pyresttest-express 
pyresttest http://localhost:3000 public/test/test.yaml

What it will show is an error ending with:

found unexpected ':'
  in "<unicode string>", line 22, column 73:
     ... , comparator: contains, expected:'json'}

This is because it isn't valid YAML: you need a space between keys and values in a YAML dictionary, or quotes around it.

VikramBPurohit commented 8 years ago

Thanks Sam for your respone! @svanoort @svanoort-jenkins

I have 2 linux boxes.

Box 1 - Installed PyRestTest Box 2 - Installed nodejs service which I uploaded (https://github.com/VikramBPurohit/pyresttest-express.git)

When I am doing CURL from Box 1 to URL, I can see the YAML file. Service is hosted on 9061 in this case.

image

But when I am running pyresttest http://10.206.150.98:9061 public/test/test.yaml

image

In above error message, I am printing which is relative - "public/test/test.yaml" which can't be open from remote machine..

image

image

VikramBPurohit commented 8 years ago

Hi @svanoort Please ignore this. I just realize the path is actually of local machine not remote machine where service has been deployed. From last 2 days, I was under impression that yaml file will be available with service but it is with pyresttest :)

Thanks again for help and Happy new year in advance!

svanoort commented 8 years ago

@VikramBPurohit Sounds good -- I thought it sounded a little odd what you described! Glad you're sorted out, and happy new year and happy PyRestTesting to you too! :)