integration-testing

How can I allow one package access to another package's unexported data only when testing?

核能气质少年 提交于 2019-12-13 07:00:47
问题 In The Go Programming Language , section 11.2.4, there is an example of of an external test accessing fmt.isSpace() via a declaration of IsSpace in fmt 's export_test.go file. That seemed like the perfect solution, so that's what I did: a/a.go : package a var x int func Set(v int) { x = v } a/a_test.go : package a import "testing" func TestSet(t *testing.T) { Set(42) if x != 42 { t.Errorf("x == %d (expected 42)", x) } } func Get() int { return x } (Running go test in a/ works fine.) b/b.go :

Rails 3 app works, integration test fails: how to fix cookie issue?

寵の児 提交于 2019-12-13 05:44:58
问题 I have a simple Rails 3 app: no models, one view and one controller with a single index method which produces static content. It works fine: when I manually browse to '/' I see my static content. Then I added an integration test: # myproj/test/integration/routes_test.rb class RoutesTest < ActionController::IntegrationTest test 'default_route' do get '/' assert_response :success, @response.body end end When running this test via rake , it tells me that GET '/' is responding with 500.

Rails Minitest integration test broken: Expected at least 1 element matching “div.pagination”, found 0

强颜欢笑 提交于 2019-12-13 05:27:11
问题 We are using Michael Hartl's Rails Tutorial as an inspiration to build a completely different RoR app. However, we stumbled upon an issue that may be of help to other people following the tutorial. Here is our user_index_test.rb file: test "index as admin including pagination and delete links" do log_in_as(@admin) get users_path assert_select 'div.pagination' first_page_of_users = User.paginate(page: 1) first_page_of_users.each do |user| assert_select 'a[href=?]', user_path(user), text: user

When does LocalDB unlock the mdf file?

不问归期 提交于 2019-12-13 05:14:10
问题 Question: I create a copy of an mdf file with a random name. I inject that name into the connect string used by an EF6 DbContext. It opens fine, I run queries, etc, then I dispose of the context. At this point if I attempt to delete the temp mdf file from the file system I cannot delete it; I get a "file is in use by another process" error. Does anyone know if it's possible to force the connection to drop the lock on the mdf file when the connection closes? Or when the SqlExpress engines

How do I do Automating Ember testing with Dalek (setup/teardown of specific Ember components)

自作多情 提交于 2019-12-13 04:34:34
问题 My TLDR; version of my question is "Is there a way I can integrate with qunit such that Dalek can get the correct context when it needs it, or conversely, can I get Dalek to run setup/teardown asset-pipeline-compiled Ember javascript to build a context for it to run tests on?" Firstup Dalek look awesome ! All my tests are currently written in qunit. I'm having some problems automating tests around a component I'm building in Ember. The component is a kind of WYSIWYG textarea. (BTW, my qunit

How come I get a “must have accepted TOS” error for test users with app installed?

孤人 提交于 2019-12-13 04:16:55
问题 I'm writing integration tests and programatically creating and registering some test users for my app in my test by using the graph API to create the users with the installed flag set to true. This should create a user that is an app user, therefore I assume the test user has agreed to the TOS already. Is I switch to the test users then the app is listed in the users history in the app center. However when I try and send an app request to this user from another test user then I get the TOS

How to change a class's metaClass per test

余生长醉 提交于 2019-12-13 03:05:13
问题 I'm using the ExpandoMetaClass to make a service always return success in an integration test but I would like to have one test that actually fails. Example use of ExpandoMetaClass: static { ExpandoMetaClass someService = new ExpandoMetaClass(Object, false) someService.accessAnotherSystem = { return 'success' } someService.initialize() SomeService.metaClass = someService } Note: currently the service isn't defined for the controller but since it's a spring bean referencing the class named

Grails Spock integration test redirectedUrl different between localhost test-app and build server test-app

余生长醉 提交于 2019-12-13 00:56:27
问题 I have a Spock integration test that looks something like this: class PriceTierControllerIntegrationSpec extends IntegrationSpec { PriceTierController controller def setup() { controller = new PriceTierController() } def "applyDiscount() method will redirect user to success view"() { when: controller.applyDiscount() then: controller.response.redirectedUrl == '/priceTier/success' } Then in the controller, the logic is simply: class PriceTierController { def applyDiscount() { redirect action:

Creating dynamic cucumber_steps to check for links on a page

不打扰是莪最后的温柔 提交于 2019-12-13 00:51:56
问题 Basically I want the scenario outline to loop through all of the various combinations so that I don't have to write a bunch of scenarios. I want to have it visit the starting page and then check to see if the links are there however I've hit a barrier. Cucumber feature Scenario Outline: As a user I need links in order to navigate the site Given I am a '<user>' When I am at the <page> page Then I should see a link to '<link>' Scenarios: As a user that is not logged in | user | page | link | |

Integration Test Best Practice

雨燕双飞 提交于 2019-12-13 00:24:42
问题 When creating integration tests, what is the best approach to introduce data? Should sql scripts be used to create the data in the setup of the test or would it be better to use the actual business objects to generate data which can then be used by the tests. Any help would be greatly appreciated. 回答1: When creating test data for automated test there are a few rules I try to stick to and I find these rules help me achieve reliable tests that have a lower maintenance overhead: Avoid making the