testing

Robolectric + rxJava + retrofit Second call throws java.io.InterruptedIOException

巧了我就是萌 提交于 2019-12-21 05:04:16
问题 I am developing and android app. I am using retrofit (with OkClient) for api requests and Robolectric for testing. My api looks like this: @GET("/v1/book/{bookId}") Observable<Book> getBook(@Path("bookId") int bookId); Just for Robolectric I am forcing api calls to be synchronous. The restAdapter builder looks like this: RestAdapter.Builder builder = new RestAdapter.Builder().setEndpoint(environment.getServerEndpoint()) .setClient(new OkClient(client)) .setExecutors(new ImmediateExecutor(),

How to set path chrome driver in robot framework?

不想你离开。 提交于 2019-12-21 04:59:25
问题 Now, I set path variable path : D:..;C:\Program Files\Google\Chrome\Application Chrome : C:\Program Files\Google\Chrome\Application\chromedriver.exe I can call open Chrome in command line. But error when run in RIDE FAIL : WebDriverException: Message: unknown error: Chrome failed to start: crashed (Driver info: chromedriver=2.13.307647 (5a7d0541ebc58e69994a6fb2ed930f45261f3c29),platform=Windows NT 6.1 SP1 x86) 回答1: You need chromeDriver not Chrome. Start by downloading the chrome driver.

How can I perform mutation testing of my Java program?

此生再无相见时 提交于 2019-12-21 04:53:38
问题 Can anyone provide suggestions of tools that can be used to make mutations within a Java program at a source-code (not byte-code) level? I need to seed my source code with faults. I would prefer an application with a GUI, if one exists. 回答1: I've found PIT Mutation Testing tool, which I quite like. With MuJava I have exceptions caused by @Override annotations. Seems that it doesnt' support Java 5/6. 回答2: When I took a software engineering class on testing at GMU, we used Mu Java, for one of

How do you mock a RelatedManager method in Django?

こ雲淡風輕ζ 提交于 2019-12-21 04:51:53
问题 I have a customer manager for a Django model which overrides the create method to also save some related objects: class CustomManager(models.Manager): def create(self, amount, user, description): txn = self.get_query_set().create(user, description) txn.budget_transactions.create(amount) return txn My question is: how do I mock the call to txn.budget_transactions.create to raise an exception? The budget_transactions attribute of the txn object is an instance of django.db.models.fields.related

How do you mock a RelatedManager method in Django?

那年仲夏 提交于 2019-12-21 04:51:26
问题 I have a customer manager for a Django model which overrides the create method to also save some related objects: class CustomManager(models.Manager): def create(self, amount, user, description): txn = self.get_query_set().create(user, description) txn.budget_transactions.create(amount) return txn My question is: how do I mock the call to txn.budget_transactions.create to raise an exception? The budget_transactions attribute of the txn object is an instance of django.db.models.fields.related

Rspec request specs and Rails 5

元气小坏坏 提交于 2019-12-21 04:51:12
问题 I'm starting a new project, my first with Rails 5.1.0. I have a pb with my first request spec. describe 'Users', type: :request do it 'are created from external data' do json_string = File.read('path/to/test_data/user_data.json') params = { user: JSON.parse(json_string) } headers = { "CONTENT_TYPE" => "application/json" } expect do post '/api/v1/users', params.to_s, headers end.to change { User.count }.by(1) expect(response.status).to eq 200 end end this spec return the error ArgumentError:

ContextConfiguration RunWith WebAppConfiguration annotations together

自古美人都是妖i 提交于 2019-12-21 04:49:17
问题 I have class which annotated these annotations: @ContextConfiguration(locations = { "classpath:pathToXml.xml" }) @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration Can you explain what features I had after I added these annotation on my class ? 回答1: You'll get the features described in @WebAppConfiguration configuration javadoc. WebApplicationContext mostly changes the way resources are loaded, i.e. resources with unspecifed resource prefix will be loaded from src/main/webapp or

How do I fake input for form testing?

谁说胖子不能爱 提交于 2019-12-21 04:48:06
问题 I'm building a test harness for my Delphi 2009 app. Testing the logic is fairly simple. Making sure the forms work properly is proving a bit more complicated. I'd like a way to simulate real user input, to open a form, make it think there's a user typing certain things and clicking in certain places, and make sure it reacts correctly. I'm sure there's a way to do this, I just don't know what it is. Does anyone know how to do it? 回答1: DUnit has GUITesting.pas whicih extends testing so you can

how to clear JSESSIONID of each Thread(user) in Jmeter on demand

…衆ロ難τιáo~ 提交于 2019-12-21 04:46:50
问题 I want to clear Jmeter JsessionID variable at any time (on my demand). I know there is a check box option in Jmeter CookieManager named " Clear Cookie on each Iteration ". But it clears the session on each iteration while I want to clear it at any time in the iteration. How can i do that in Jmeter? 回答1: Currently you cannot simply , particularly if you want to clear one particular cookie. You should raise an enhancement request at JMeter Bugzilla giving precision on what you want to do. I

Tensorflow batch_norm does not work properly when testing (is_training=False)

倾然丶 夕夏残阳落幕 提交于 2019-12-21 04:46:08
问题 I am training the following model: with slim.arg_scope(inception_arg_scope(is_training=True)): logits_v, endpoints_v = inception_v3(all_v, num_classes=25, is_training=True, dropout_keep_prob=0.8, spatial_squeeze=True, reuse=reuse_variables, scope='vis') logits_p, endpoints_p = inception_v3(all_p, num_classes=25, is_training=True, dropout_keep_prob=0.8, spatial_squeeze=True, reuse=reuse_variables, scope='pol') pol_features = endpoints_p['pol/features'] vis_features = endpoints_v['vis/features'