msjit / testcasedb

TestCaseDB - Web based test case management
MIT License
40 stars 18 forks source link

[Feature Request] Ability to upload screenshots to results and have them displayed #60

Closed agramian closed 9 years ago

agramian commented 9 years ago

This feature will be extremely helpful for web, mobile, and gui testing. The idea is to allow images to be uploaded via the web interface as well as the web api.

Eventually it will be nice to have this feature for all item types (test cases, plans, assignments, devices, etc. ) but the priority should be for results.

When the result is viewed through the web interface, the screenshots should be displayed in the results' show pages. If there are multiple screenshots, a simple gallery with arrows should allow moving through them. Then if an issue is found with any screenshot, a comment can be added to the result and the test case can be marked pass/fail accordingly.

kiranfractal commented 9 years ago

The image upload is most of the time done at bug reporting tool rather at testcase management software.

agramian commented 9 years ago

When you are managing test cases you may have reference images and it is appropriate to have these with the test plan in the management software.

The test management tool stores the results of each case in a test run. If the test is for comparing screenshots, or verifying a view based on a screenshot then it is appropriate to have images associated with the test result.

A bug reporting tool is for tracking issues mostly associated with failed tests. The bug reporting tool is not judging if a test has passed or failed. If a test is for verifying a screenshot and is subjective it will need to manually be checked by a person through the test management software and marked as pass or fail.

@kiranfractal do you suggest against having this feature and if yes is there a more specific reason besides the fact that it may also be done in the bug reporting tool?

kiranfractal commented 9 years ago

Dear @agramian, I agree with you. In case we are validating the screenshots it is a valid feature to be added.

I am not against having this feature but I never uploaded a screenshot to testcase management, so my previous answer came from my earlier limited experience only :).

joffems commented 9 years ago

@agramian This will definitely be added in the near future.

kirantpatil commented 9 years ago

One more scenario where upload image is very essential.

BUI/GUI automated test fails, then screenshot needs to be taken and uploaded for failed test result.

I am planning to use it and it makes very handy when we run BUI/GUI testing on a product with 100s of feature testcases.

So, very essential feature +1

joffems commented 9 years ago

@kirantpatil @agramian I've updated the results page to use drag and drop image uploads with a larger preview. Please check it out.

My next step is to clean up the code so it can be used on any model.

joffems commented 9 years ago

@kirantpatil @agramian I've now re-written the upload model. The model has been updated to use a polymorphic association. The remaining code has been written to take advantage of this. Details are in the commit https://github.com/msjit/testcasedb/commit/081d5b61004c56cfc9552a094abdbc4f44b8ce62

agramian commented 9 years ago

@joffems i'm having problems getting testcasedb to even run now. I'm not sure if it is a result of these changes, or if I need to upgrade ruby or rails. Can we collectively prioritize setup instructions and issues #55 and #56 ?

joffems commented 9 years ago

We can definitely prioritize that.

Do you want to send me the logs for the issue, "getting testcasedb to even run now".

Also after pulling the latest code did you run the following commands (assuming you're in a production environment).

bundle

bundle exec rake db:migrate RAILS_ENV=production

bundle exec rake assets:precompile RAILS_ENV=production
agramian commented 9 years ago

yes i'm getting

rake aborted!
Sprockets::FileNotFound: couldn't find file 'jquery.ui.all'
  (in /home/testcasedb/app/assets/javascripts/application.js:6)
agramian commented 9 years ago

I changed the import from 'jquery.ui.all' to 'jquery-ui' and it starts running but then a ton of warnings are generated.

Warning. Error encountered while saving cache /home/testcasedb/tmp/cache/sass/653ee03a9207e858399c417e02bb9c11f0ec8fbd/user_sessions.css.scssc: can't dump anonymous class #<Class:0x00000004246428>
agramian commented 9 years ago

Ok it seems to work despite the warnings however the execute page accessed from the assignment overview page (ex: https://testcasedb.com/results/1/edit) does not render for me and just shows a 500 internal server error in the log. I had to manually set the result of the assignment case to 'Passed' in the database to get the view to render.

After it rendered I experimented with the screenshot upload and preview feature. This is definitely a great start. Eventually it would be nice to show it in a gallery with arrow buttons and perhaps a grid view with thumbnails but that is low priority for now.

A more immediate necessary addition is the ability to go to the next and previous test result. Currently there is no link from the result view page to the next or previous result. You must go back to the assignment overview then click on another test case.

joffems commented 9 years ago

@agramian Interesting that you had to change that import. The files should import from the gem.

Can you please let me know which version of Rails and jquery-ui-rails you have installed. You can use the command, "gem list rails" to find these two items.

agramian commented 9 years ago

@joffems I am using ruby 2.2 and rails 3.2.21 i believe.

Rails 3 is no longer supported by the way. We should upgrade TestCaseDB to rails 4 and make it compatible with ruby 2.2.

agramian commented 9 years ago

@joffems I receive the same errors using ruby 2.0

gem versions

jquery-ui-rails (5.0.3)
rails (3.2.21)

ruby version

ruby 2.0.0p598 (2014-11-13 revision 48408) [x86_64-linux]

The results/edit view problem is related to the following line in app/views/results/_form.html.erb

<% if @result.test_case.steps.empty? %>

Running the .empty? method on the object is raising some sort of exception. If I remove that section the page renders.

joffems commented 9 years ago

Thanks for the feedback. Do you have a result not associated with a test case or a test case without steps. I assume it is the former and will add the appropriate checks.

agramian commented 9 years ago

I have test case without steps

joffems commented 9 years ago

Chaning

<% if @result.test_case.steps.empty? %>

to

<% if @result.test_case.steps %>

should work.

agramian commented 9 years ago

My mistake that's not the issue. The issue is with the upload form and the edit page.

If I remove the following line from app/views/results/edit.html.erb the page renders

<%= render 'uploads' %>

This only occurs when accessing the result edit page when the result is not yet set (it is NULL in the database before the first run). If i manually set the result to something in the database then the edit page renders.

joffems commented 9 years ago

Ah, I missed that item. I need to do a global query for that. In the meantime can you change

<%= render 'uploads' %>

to

<%= render 'uploads/uploads', uploadable_item: @result %>

This assumes that we have @result available. I don't have the code open to check right now.

agramian commented 9 years ago

That worked.

agramian commented 9 years ago

@joffems One of the recent commits possibly 4314c4185fc9a5708c835a94991617e8038c7023 reverted the ability to edit the result after it has been set. Was this intended? I would like to change results manually if necessary.

joffems commented 9 years ago

@agramian There was one other line which had the same issue. Both locations are now fixed.

joffems commented 9 years ago

@agramian Can this be closed?

agramian commented 9 years ago

@joffems Yes this can be closed. Screenshot upload works and we can open improvement tickets later if necessary after other higher priority issues are addressed.

agramian commented 9 years ago

@joffems we never addressed the issue from my comment https://github.com/msjit/testcasedb/issues/60#issuecomment-72702391 regarding the require statement for jquery-ui and the warnings generated during the rake asset recompilation.