earldouglas / swagger-test

Specification-driven REST API testing
MIT License
113 stars 19 forks source link

Error: describe('test generation with inference', function () { ^ ReferenceError: describe is not defined #8

Closed ujjwal08 closed 7 years ago

ujjwal08 commented 7 years ago

I downloaded this project and tried to run it, It is showing error that-

describe('test generation with inference', function () { ^ ReferenceError: describe is not defined

Below is the screeshot of my console output:

selection_007

how to resolve this error?

earldouglas commented 7 years ago

The describe function comes from Mocha, which is included in the module's "development" dependencies. You can use npm to both install them and bring them in scope for testing:

[james@X200s:~/code/swagger-test]$ npm install

Here, you should see a bunch of output from downloading and building each dependency. The results end up in the ./node_modules directory:

[james@X200s:~/code/swagger-test]$ ls node_modules/
chai  coveralls  istanbul  mocha  mocha-lcov-reporter  preq  url-template

With the dependencies installed, you can use npm to run the tests with Mocha in scope:

[james@X200s:~/code/swagger-test]$ npm test

> swagger-test@0.5.1 test /home/james/code/swagger-test
> mocha

  test generation with inference
    ✓ should contain three test cases 
    ✓ should first test GET /pets 
    ✓ should next test GET /pets/fido4 
    ✓ should next test GET /pets/fido7 

  4 passing (22ms)
ujjwal08 commented 7 years ago

@earldouglas thanks, It worked. :+1:

earldouglas commented 7 years ago

Great!