integration-testing

How to test Mongo indexes in integration tests?

假如想象 提交于 2020-05-23 17:51:54
问题 I have a Java method which creates an index on two fields from a Mongo collection. I should get the index info for the collection, then check if the name and fields of the index are correct. What is the cleanest way to write an integration test for this? Would it make sense to use a custom Hamcrest matcher to see if the index is in the collection? 回答1: In Spring With MongoTemplate#indexOps(String collection) you can fetch a List of IndexInfo , representing the indexes of the MongoDB

How to test Mongo indexes in integration tests?

北慕城南 提交于 2020-05-23 17:47:13
问题 I have a Java method which creates an index on two fields from a Mongo collection. I should get the index info for the collection, then check if the name and fields of the index are correct. What is the cleanest way to write an integration test for this? Would it make sense to use a custom Hamcrest matcher to see if the index is in the collection? 回答1: In Spring With MongoTemplate#indexOps(String collection) you can fetch a List of IndexInfo , representing the indexes of the MongoDB

Using mocha/chai to ensure REST API serves up a file?

二次信任 提交于 2020-05-13 14:45:07
问题 I am wanting to validate that a call to one of my REST API's end-point is serving up a file, but I am not sure how to go about it and I am not seeing any examples on this? I did look at the documentation, but this didn't help me much. The server side code essentially does (in Express): handleRetrieveContent(req, res, next) { const filepaht = '...'; res.sendFile(filepath) } and the test case: it('Should get a file', (done) => { chai.request(url) .get('/api/exercise/1?token=' + token) .end

Testing Flink with embedded Kafka

百般思念 提交于 2020-04-16 05:45:10
问题 I have a simple Flink application, which sums up the events with the same id and timestamp within the last minute: DataStream<String> input = env .addSource(consumerProps) .uid("app"); DataStream<Event> events = input.map(record -> mapper.readValue(record, Event.class)); pixels .assignTimestampsAndWatermarks(new TimestampsAndWatermarks()) .keyBy("id") .timeWindow(Time.minutes(1)) .sum("constant") .addSink(simpleNotificationServiceSink); env.execute(jobName); private static class

How do I specify a separate maven goal for running (Cucumber) acceptance tests?

偶尔善良 提交于 2020-03-17 10:34:41
问题 I have the following project structure: MyProject --src --test --acceptance --step_definitions --features --unit I would like to be able to run my cucumber tests (in test/acceptance) separately in Maven from the unit tests declared in test/unit, so that they can be run in different CI build plans etc. I am using cucumber-junit so the 'runners' for each acceptance test are written with JUnit. Is this possible? 回答1: Is this possible? Yes, it is possible. I believe you should separate your unit

How do I specify a separate maven goal for running (Cucumber) acceptance tests?

試著忘記壹切 提交于 2020-03-17 10:34:14
问题 I have the following project structure: MyProject --src --test --acceptance --step_definitions --features --unit I would like to be able to run my cucumber tests (in test/acceptance) separately in Maven from the unit tests declared in test/unit, so that they can be run in different CI build plans etc. I am using cucumber-junit so the 'runners' for each acceptance test are written with JUnit. Is this possible? 回答1: Is this possible? Yes, it is possible. I believe you should separate your unit

In-memory MongoDB for test?

懵懂的女人 提交于 2020-03-17 10:07:51
问题 I am writing some integration and system tests for my NodeJS application using a MongoDB database. The test framework I use is Mocha and Supertest. Is it possible to setup MongoDB as an in-memory database which I can use to only test which then wipes away all my collections and documents when the test is done? 回答1: You can accomplish this using mongodb-memory-server. The package downloads a mongod binary to your home directory and instantiates a new memory-backed MondoDB instance as needed.

Android Kotlin: integration tests using Dagger 2 and Mockito getting error, “zero interactions with this mock”

試著忘記壹切 提交于 2020-03-04 19:36:08
问题 I am developing an Android application using Kotlin. I am writing integration tests for my application. Now I am having a problem mocking an injected dependency class that is injected using the Dagger 2 test if a method of the mocked object is called. Following is my code. I have the TestAppComponent class with the following code @Singleton @Component(modules = [ TestAppModule::class ]) interface TestAppComponent { fun inject(app: ApplicationController) fun inject(app:

is this braintree testing multi purchase error something I should worry about?

久未见 提交于 2020-02-25 09:50:30
问题 I'm trying to figure out how to test with braintree, and I'm running into what feels like a bandwidth error. response = ::Braintree::Customer.create(payment_method_nonce: Braintree::Test::Nonce::Transactable) token = response.customer.credit_card.first.token #so far so good response = ::Braintree::Transaction.sale(payment_method_token: token, amount: "1.00") #still good response = ::Braintree::Transaction.sale(payment_method_token: token, amount: "1.00") #response is failure # => Braintree:

is this braintree testing multi purchase error something I should worry about?

筅森魡賤 提交于 2020-02-25 09:50:26
问题 I'm trying to figure out how to test with braintree, and I'm running into what feels like a bandwidth error. response = ::Braintree::Customer.create(payment_method_nonce: Braintree::Test::Nonce::Transactable) token = response.customer.credit_card.first.token #so far so good response = ::Braintree::Transaction.sale(payment_method_token: token, amount: "1.00") #still good response = ::Braintree::Transaction.sale(payment_method_token: token, amount: "1.00") #response is failure # => Braintree: