testing

Testing vim scripts

时光怂恿深爱的人放手 提交于 2020-03-03 07:38:07
问题 I'm exploring options for testing vim scripts. I'm wondering if I need a tool like Vader or if I can just roll my own using vim from the command line. I'm using Perl (but it could be any language), and I can do this: `$path_to_vi -c "normal iLink" -c "normal \r" -c wq ~/vimwiki/output.md`; Then I can just inspect the contents of output.md with an appropriate test. Thanks for any tips and advice. 回答1: You can use built in functions such as :h assert_true() to test scripts. Every time you call

Have my Spring test slice scan a single class instead of the whole package

放肆的年华 提交于 2020-03-01 15:31:13
问题 I was asked to create integration tests for an existing SpringBoot project, whose organisation is not as modular as I would prefer. For example, there is a package yielding all repositories associated with all services. This became a problem for me when I was attempting to create a @WebMvcTest test slice, because when I use @ComponentScan , @EnableJpaRepositories , @EntityScan to read my target classes it ends up scanning all other unnecessary ones that share the same package. Since changing

How to test single application (not project) in Django?

放肆的年华 提交于 2020-02-29 10:13:28
问题 I would like to test my small application, that I keep in a separate package. Right now I created a "test_project" directory, created a test project there and I am using the project's manage.py to run tests. But I keep wondering - is there a better method? Is it possible to launch a single app's tests, perhaps with some default configuration (like, sqlite database)? 回答1: It is possible to run a single app's tests standalone, without creating a Django test project for that purpose. One way of

How to Intentionally Create a Long-Running MySQL Query

爷,独闯天下 提交于 2020-02-27 04:37:55
问题 I know this is an odd question to ask, but I'd like to find out if there is a MySQL query I can create without already having millions of rows in my database that will consume resources and run for a long time. My ultimate goal is to test my application in cases of resource contention and make sure that my methods for handling failure (specifically server timeout) are correct. If there another way I can test this without creating and executing a high-resource query, I'd appreciate hearing

How to Intentionally Create a Long-Running MySQL Query

一曲冷凌霜 提交于 2020-02-27 04:36:23
问题 I know this is an odd question to ask, but I'd like to find out if there is a MySQL query I can create without already having millions of rows in my database that will consume resources and run for a long time. My ultimate goal is to test my application in cases of resource contention and make sure that my methods for handling failure (specifically server timeout) are correct. If there another way I can test this without creating and executing a high-resource query, I'd appreciate hearing

Is it possible to do strict mocks with Mockito?

折月煮酒 提交于 2020-02-26 11:36:26
问题 I'd like to use strict mocks, at least when developing for the first time some tests against old code, so any methods invoked on my mock will throw an exception if I didn't specifically define expectations. From what I've come to see, Mockito if I didn't define any expectations will just return null, which will later on cause a NullPointerException in some other place. Is it possible to do that? If yes, how? 回答1: What do you want it to do? You can set it to RETURN_SMART_NULLS, which avoids

Is it possible to do strict mocks with Mockito?

人盡茶涼 提交于 2020-02-26 11:35:28
问题 I'd like to use strict mocks, at least when developing for the first time some tests against old code, so any methods invoked on my mock will throw an exception if I didn't specifically define expectations. From what I've come to see, Mockito if I didn't define any expectations will just return null, which will later on cause a NullPointerException in some other place. Is it possible to do that? If yes, how? 回答1: What do you want it to do? You can set it to RETURN_SMART_NULLS, which avoids

Rails fragment cache testing with RSpec

浪尽此生 提交于 2020-02-26 07:21:26
问题 I feel like this is a not-so-much documented topic, at least I've had a lot of trouble finding our about the best practices here. I'm fragment caching in the view using a cache_key: %tbody - @employees.each do |employee| - cache employee do %tr[employee] %td= employee.name %td= employee.current_positions %td= employee.home_base %td= employee.job_classes Now I can add :touch => true on the :belongs_to side of my has_many associations and this will do everything I need to keep this fragment

Rails fragment cache testing with RSpec

强颜欢笑 提交于 2020-02-26 07:21:04
问题 I feel like this is a not-so-much documented topic, at least I've had a lot of trouble finding our about the best practices here. I'm fragment caching in the view using a cache_key: %tbody - @employees.each do |employee| - cache employee do %tr[employee] %td= employee.name %td= employee.current_positions %td= employee.home_base %td= employee.job_classes Now I can add :touch => true on the :belongs_to side of my has_many associations and this will do everything I need to keep this fragment

TypeError [ERR_UNESCAPED_CHARACTERS] when running nightwatchjs test

こ雲淡風輕ζ 提交于 2020-02-25 06:05:18
问题 I just updated my chromedriver from version 74.x.x to 76.x.x and received the following error: Error while running .isElementDisplayed() protocol action: TypeError [ERR_UNESCAPED_CHARACTERS]: Error while trying to create HTTP request for "/wd/hub/session/676ee244a59ce7cba8601d00582bbe13/element/[object Object]/displayed": Request path contains unescaped characters at new ClientRequest (_http_client.js:115:13) at Object.request (http.js:42:10) at HttpRequest.createHttpRequest (/Users