functional-testing

How to run robotium tests in a specific order?

我与影子孤独终老i 提交于 2019-12-24 00:54:18
问题 I have this robotium testproject which has one testclass. The test class contains all the test methods. Right now when I run the test class, the test methods are run in alphabetical order. Since I have some dependencies between the test methods(i know this is not the preferred practice) I want the test methods to run in a specific order. The reason I am having dependencies is that, it allows for less code to be written and makes the whole test class to run faster. Is there any way to run the

How to enable page caching in a functional test in rails?

痞子三分冷 提交于 2019-12-24 00:33:44
问题 Is it possible to turn on page caching for a functional test? The following didn't work: class ArticlesControllerTest < ActionController::TestCase def setup ActionController::Base.public_class_method :page_cache_path ActionController::Base.perform_caching = true end end thanks in advance Deb 回答1: My current workaround is to enable perform_caching then reload the controller: class ProjectsCachingTest < ActionController::IntegrationTest def setup # force the controller to be reloaded when

Uninstall application when testing

时光毁灭记忆、已成空白 提交于 2019-12-23 15:21:17
问题 I'm new to testing in Android with Robotium. How can I programatically uninstall and then install the application before running some of the tests? For example, in order for me to test the login activity, I need to make sure the login credentials are not saved from a prior run of the app. Or is there another way to do this? 回答1: You could use the following piece of code (on the machine you're debugging from) to uninstall your application: Runtime rt = Runtime.getRuntime(); Process pr = rt

Geb tests pass with Chrome, fail with PhantomJS

假装没事ソ 提交于 2019-12-23 10:28:23
问题 I have noticed that some Geb functional tests pass with Chrome but fail with PhantomJS, holding all other variables constant. This happens mostly with pages that have some kind of asynchronous activity - one call to $(selector).click() triggers an event handler that updates the DOM, and the DOM updates need to complete before calling $(anotherSelector).click() . I can make the PhantomJS tests pass again by aggressively using waitFor but I don't understand why this would be required with the

Test bottle app without running bottle server

こ雲淡風輕ζ 提交于 2019-12-23 03:00:13
问题 I am following Recipes of bottle framework. When I try below code #filename: mywebapp.py from bottle import Bottle, run, request app = Bottle() @app.get('/hello') def hello(): return "Hello " + request.get_header('name') if __name__ == '__main__': run(app, host='localhost', port=80) Function testcase with TestApp #filename: test_mywebapp.py from webtest import TestApp import mywebapp def test_functional_hello_world(): app = TestApp(mywebapp.app) assert app.get('/hello').status_code == 200

Assertion fail message for string contains substring [duplicate]

你。 提交于 2019-12-22 18:46:25
问题 This question already has answers here : AssertContains on strings in jUnit (7 answers) Closed 6 years ago . I have done a lot of functional testing on text outputs on text generating software lately, an find myself writing a lot of assertTrue(actualString.contains(wantedString)); However, the message for when this fails is something non-descriptive like Expected [true], but was [false] An alternative is to include a custom fail message as String failMsg = String.format("Wanted string to

auth-hmac functional testing problem

烂漫一生 提交于 2019-12-22 10:54:44
问题 I want to use this gem in my api application https://github.com/seangeo/auth-hmac/ I have a question about creating tests for request authentification. I want to sign request with hmac but rails controller has no http headers after next code def setup #load from fixture @client = clients(:client_2) end def sign_valid_request(request,client) auth_hmac = AuthHMAC.new(client.key => client.secret ) auth_hmac.sign!(request,client.key) request end def test_response_client_xml @request = sign_valid

Functional tests for flash messages after redirect

六月ゝ 毕业季﹏ 提交于 2019-12-22 04:47:39
问题 I'm not sure how to check flash messages with functional tests. My problem has something to do with redirect_to because my test for flash[:error] DOES pass. Here is what my create action looks like: def create @user = User.new(params[:user]) if @user.save redirect_to @user, flash: { success: "Welcome!" } else flash.now[:error] = "Signup failed:" render 'new' end end I have a passing test for flash[:error] that 1) checks that flash[:error] is the correct value, 2) checks the page for the flash

Testing devise with shoulda

為{幸葍}努か 提交于 2019-12-22 01:55:49
问题 I'm having some difficulties in testing devise with shoulda: 2) Error: test: handle :index logged as admin should redirect to Daily page. (Admin::DailyClosesControllerTest): NoMethodError: undefined method `env' for nil:NilClass devise (1.0.6) [v] lib/devise/test_helpers.rb:52:in `setup_controller_for_warden' I have this in my test_helper: include Devise::TestHelpers Thoughts ? Thanks in advance, Cristi 回答1: include Devise::TestHelpers doesn't go in the test_helper.rb file, but rather inside

Rails Functional Test of Arbitrary or Custom URLs

守給你的承諾、 提交于 2019-12-21 09:22:39
问题 I have a RESTful resource in my Rails app called "Photo". I'm using Paperclip to serve different "styles" of my photos (for thumbnails and the like), and I'm using a custom route to RESTfully access those styles: map.connect "photos/:id/style/*style", :controller => "photos", :action => "show" That's working fine, but I want to write a test to make sure it stays that way. I already have a functional test to call the Photo controller's show action (generated by scaffold in fact): test "should