Coder Social home page Coder Social logo

cm-quiz's People

Contributors

abelperezok avatar aripollak avatar ocowchun avatar wasifhossain avatar

Stargazers

 avatar  avatar

Watchers

 avatar

cm-quiz's Issues

Error message: Can't convert nil into exact number while trying to run GET http://localhost:8080/ideas

I don't have much knowledge related to ruby. But I think the above error is thrown while running cmquiz against my SpringBoot application:

Problem statement:
GET /ideas call is failing in cmquiz with can't convert nil to exact number while the call successfully returns result set via postman as shown below:

postman-results

error encountered while running cmquiz:

cmquiz-ruby-failuretrace

Is there a way to include more details and use a verbose mode to run cmquiz locally? If we could trace HTTP Request/Response Headers at least while running the application, that would be great.

As of now, cmquiz help doesn't have any documentation on running it in verbose mode.

Unexpected token # in JSON at position 0

It happens when I try to run the command:
cm-quiz test --endpoint http://localhost:8080
My API is not done yet, only the /ideas is still left to be implemented. But when I run the command it breaks on the route /me, but when I call that route from Postman it all works fine.
This is the error:

SyntaxError: Unexpected token # in JSON at position 0
    at JSON.parse (<anonymous>)
    at createStrictSyntaxError (/Users/lazarnikolov/projects/private/cm-small-project/node_modules/body-parser/lib/types/json.js:157:10)
    at parse (/Users/lazarnikolov/projects/private/cm-small-project/node_modules/body-parser/lib/types/json.js:83:15)
    at /Users/lazarnikolov/projects/private/cm-small-project/node_modules/body-parser/lib/read.js:121:18
    at invokeCallback (/Users/lazarnikolov/projects/private/cm-small-project/node_modules/raw-body/index.js:224:16)
    at done (/Users/lazarnikolov/projects/private/cm-small-project/node_modules/raw-body/index.js:213:7)
    at IncomingMessage.onEnd (/Users/lazarnikolov/projects/private/cm-small-project/node_modules/raw-body/index.js:273:7)
    at emitNone (events.js:106:13)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1056:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

I'm not sure what's going on on Ruby's side because I have 0 experience with Ruby. I'm doing my project in NodeJS, and as we can see it breaks in the body-parser library. When I debug it on my end, I can see that sometimes I get the body parsed as "null" (actual string).

(GET)/ideas test may erroneously fail if 10+ ideas already exist

The instructions at https://www.codementor.io/@codementorx/draft/ixvyx7tvj?utm_swu=4667 dictate that the ideas be sorted by 'average' in descending order, as opposed to by 'created_at'. That means that as soon as there are enough entries to exceed the prescribed 10 results per page, the newly-created idea from the testing tool might not be visible on the page it's retrieving, and present as a failure. This might be better addressed by adjusting the instructions than the code.

Need to take credentials as input

The tool is not taking credentials or JWT token as input. Without credentials how would the tool will be able to hit the api and test the api server ?

"only generation of JSON objects or arrays allowed (JSON::GeneratorError)"

Hey there!

I'm trying to test against an app running on localhost and getting the following stacktrace:

▸ cm-quiz test --endpoint=localhost:8080
Start test localhost:8080
please wait...
/Users/ursa/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/json/common.rb:286:in `generate': only generation of JSON objects or arrays allowed (JSON::GeneratorError)
	from /Users/ursa/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/json/common.rb:286:in `pretty_generate'
	from /Users/ursa/.rvm/gems/ruby-2.3.0/gems/cm_quiz-0.0.3/lib/cm_quiz/review_quiz.rb:46:in `block in build_message'
	from /Users/ursa/.rvm/gems/ruby-2.3.0/gems/cm_quiz-0.0.3/lib/cm_quiz/review_quiz.rb:31:in `map'
	from /Users/ursa/.rvm/gems/ruby-2.3.0/gems/cm_quiz-0.0.3/lib/cm_quiz/review_quiz.rb:31:in `build_message'
	from /Users/ursa/.rvm/gems/ruby-2.3.0/gems/cm_quiz-0.0.3/lib/cm_quiz/review_quiz.rb:11:in `perform'
	from /Users/ursa/.rvm/gems/ruby-2.3.0/gems/cm_quiz-0.0.3/lib/cm_quiz/cli.rb:19:in `test'
	from /Users/ursa/.rvm/gems/ruby-2.3.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
	from /Users/ursa/.rvm/gems/ruby-2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
	from /Users/ursa/.rvm/gems/ruby-2.3.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
	from /Users/ursa/.rvm/gems/ruby-2.3.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
	from /Users/ursa/.rvm/gems/ruby-2.3.0/gems/cm_quiz-0.0.3/bin/cm-quiz:8:in `<top (required)>'
	from /Users/ursa/.rvm/gems/ruby-2.3.0/bin/cm-quiz:23:in `load'
	from /Users/ursa/.rvm/gems/ruby-2.3.0/bin/cm-quiz:23:in `<main>'
	from /Users/ursa/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
	from /Users/ursa/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'

I've got RVM installed and am using Ruby 2.3.0 and didn't seem to encounter any issues during the installation, so I'm not sure what's going on here. I'm not a Ruby expert but it looks like the test runner is failing to serialize the options variable, and a small amount of debugging on my end suggests that somehow options is set to nil at serialization time.

I'm not sure exactly how that's happening, but it's a little frustrating to work with. My API is anything but compliant at the moment, but ideally the test runner shouldn't die with a stacktrace because the API isn't returning the right results.

Review::DeleteIdea always failing

In ReviewQuiz, I don't see how the Review::DeleteIdea test can be successful, as it expects the database to not contain any Ideas at the very end of the test:

res = send_get_ideas_request(jwt: jwt)
res_hash = JSON.parse(res.body)
expect(res_hash.size).to eq(0)

However, some tests have run earlier and created Ideas in the database without removing them. Here is an example from Review::GetIdeas:

idea_payloads = 3.times.map do |i|
  Factory::Idea.new({
    project_api: @project_api,
    jwt: jwt,
    idea_params: {
      confidence: (3 + i) % 10 + 1
    }
  }).create
end

As a result, since the Review::DeleteIdea test starts while the database contains Ideas, naturally the call to /ideas at the end of Review::DeleteIdea will return some Ideas.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.