testing

Multi-Context InMemory Database

点点圈 提交于 2019-12-30 18:53:13
问题 Is it possible to have an InMemory database (ASP.NET Core) that is shared across multiple DbContexts? It seems that each DbContext type keeps its own database, even when the same database name is specified in UseInMemoryDatabase. 回答1: The same name is enough. If your instances of DbContext do not 'see' the same in memory DB, it seems they use ones with different names. Make sure your DbContext is created once for the same name. EF Core 2.0 even re-uses in memory databases with the same name:

Default language via settings not respected during testing

谁都会走 提交于 2019-12-30 18:51:04
问题 Using Django 1.3, Python 2.6 Having a particularly weird problem to track down related to internationalization, and RequestFactory vs. TestClient for testing views. If I run: ./manage.py test All tests run (including the problematic ones) and pass successfully. If I run: ./manage.py test <appname> The app's tests will fail, throwing a template rendering exception for templates that use the language code because the language django thinks the request is asking for is not a language we've

Default language via settings not respected during testing

不羁的心 提交于 2019-12-30 18:50:09
问题 Using Django 1.3, Python 2.6 Having a particularly weird problem to track down related to internationalization, and RequestFactory vs. TestClient for testing views. If I run: ./manage.py test All tests run (including the problematic ones) and pass successfully. If I run: ./manage.py test <appname> The app's tests will fail, throwing a template rendering exception for templates that use the language code because the language django thinks the request is asking for is not a language we've

How to solve TypeError: environment.teardown is not a function?

怎甘沉沦 提交于 2019-12-30 18:46:25
问题 i cant test application which created with create-react-app, all guides says that test is working by default, but when i try "yarn test" it requires install 'jest-cli' and after installation gives an error "TypeError: environment.teardown is not a function". 回答1: You shouldn't need to install jest-cli yourself, it should come out of the box. Try the following: Delete package-lock.json, yarn.lock and node_modules Remove jest from the dependencies in package.json Then do npm install or yarn

Dojo intern set firefox profile name

江枫思渺然 提交于 2019-12-30 12:21:39
问题 Hi Iam trying to set firefox profile name in environment settings of intern config file.I have tried environments: [ { browserName: 'firefox',firefox_profile:'default' }, {firefox_profile:'default'} ], and environments: [ { browserName: 'firefox',profile:'default' }, {profile:'default'} ], as well as capabilities: { 'selenium-version': '2.42.0', firefox_profile:'default' }, as mentioned in Selenium capabilities But still firefox launches with an anonymous profile. However if I use watir, def

Dojo intern set firefox profile name

♀尐吖头ヾ 提交于 2019-12-30 12:20:09
问题 Hi Iam trying to set firefox profile name in environment settings of intern config file.I have tried environments: [ { browserName: 'firefox',firefox_profile:'default' }, {firefox_profile:'default'} ], and environments: [ { browserName: 'firefox',profile:'default' }, {profile:'default'} ], as well as capabilities: { 'selenium-version': '2.42.0', firefox_profile:'default' }, as mentioned in Selenium capabilities But still firefox launches with an anonymous profile. However if I use watir, def

Why should Mocha test cases be stateless?

筅森魡賤 提交于 2019-12-30 11:53:10
问题 It is a common recommendation, that Mocha test cases should not share state . In light of Mochas strongly sequential nature of execution of test cases, I really do not understand this recommentation. And more - I see it dubious. If the test cases, even asynchronic ones, are executed strictly one after another, there is no risk of time-race problems or other unpredicted execution sequence. Let's take this Mocha structure: describe describe it1 it2 // async it3 describe it4 it5 describe

Testing ssh connection

旧巷老猫 提交于 2019-12-30 10:30:41
问题 an important part of my project is to log in into remote server with ssh and do something with files on it: Net::SSH.start(@host, @username, :password => @password) do |ssh| ssh.exec!(rename_files_on_remote_server) end How to test it? I think I can have local ssh server on and check file names on it (maybe it could be in my test/spec directory). Or maybe someone could point me better solution? 回答1: I think it's enough to test that you're sending the correct commands to the ssh server. You're

How to use CSV Config Set's sharing mode to run thread in Jmeter?

一世执手 提交于 2019-12-30 10:26:15
问题 Is there any way to use this option "edit" of "share mode" in CSV Data Set Config? I have found the description in official web site? apache jmeter component CSV Data Set Config Identifier - all threads sharing the same identifier share the same file. So for example if you have 4 thread groups, you could use a common id for two or more of the groups to share the file between them. Or you could use the thread number to share the file between the same thread numbers in different thread groups.

How mock private method that modify private variables?

…衆ロ難τιáo~ 提交于 2019-12-30 10:19:27
问题 How mock private method that modify private variables? class SomeClass{ private int one; private int second; public SomeClass(){} public int calculateSomething(){ complexInitialization(); return this.one + this.second; } private void complexInitialization(){ one = ... second = ... } } 回答1: You don't , because your test will depend on implementation details of the class it is testing and will therefore be brittle. You could refactor your code such that the class you are currently testing