In ServiceStack, how can I do integration testing with multiple endpoints?

Sebastian Nemeth

We're using ServiceStack for a client project with several distinct problem domains, which we'd prefer to keep separated. We've developed a testing framework that spins up an AppHostHttpListener and sets up an in-memory test database using SQLite and DbUp - but, as you know, a test session's AppDomain can only have one AppHost at a time.

On the other hand, we have two different AppHosts that we want to deploy, let's call them Foo and Bar. Foo accepts requests and passes them to Bar, so Foo -> Bar, and Bar is standalone.

We want to be able to write end-to-end integration tests that exercise instances of both Foo and Bar. With ServiceStack's limitation of one AppHost per AppDomain, we seem to have the following options:

  1. Spin up a new AppDomain for each AppHost inside the test session and control their lifetime across a MarshallByRef boundary. Not sure how this would perform sharing 'test connections' between AppHosts though.
  2. Mock out the external service. This is the textbook answer, but these systems are critical enough that we'd like to see when changes to one service break the other.
  3. Make the endpoints pluggable so that they can be loaded in the same AppHost for testing, but under different sub-URLs. The way I see it, this would require the endpoints to share AuthFeature, IDbConnectionFactory etc, so we would lose that flexibility.

My questions to you are:

  1. Which option would you go with?
  2. Can you recommend another approach that would enable us to test integration of multiple ServiceStack endpoints in memory?
mythz

The only way to test multiple Services in memory is to combine them in the same Test AppHost which will only need the to register the dependencies the integration tests are testing. In memory Integration tests normally have a Custom AppHost built to task, the AppHost isn't part of the test.

The alternative is to use IIS Express and start instances of the endpoints used in the integration test before running them.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How can I do test setup using the testing package in Go

How to do integration testing in Clojure?

How do I set the ServiceStack ResponseStatus StatusCode?

How can I configure endpoints in Kestrel?

How do I configure Amplify to to use multiple AppSync endpoints?

How can I do an in-memory SQL Server for integration testing?

How to do integration testing in Flutter?

How do I resolve the issue the request matched multiple endpoints in .Net Core Web Api

How do I correctly add data from multiple endpoints called inside useEffect to the state object using React Hooks and Context API?

How can I prevent a React state update on an unmounted component in my integration testing?

How to do Ember integration testing for route transitions?

Can I specify multiple endpoints for Sendgrid Event Notification?

How do I use the servicestack ormlite JoinSqlBuilder

How can I hide swagger ui endpoints from servicestack metadata?

How do I write REST service to support multiple Get Endpoints in .net MVC Web API?

How Can I perform Integration Testing against Oracle UCM with consistent data?

How can I do automated testing in the WCF web service?

How I can make a webservice to be published in multiple addresses (endpoints) using CXF with Grails?

How do I handle elasticsearch's index timing when doing integration testing with mocha

how do I Mock endpoints with blueprint in camel?

How can I do unit testing for retrofit callbacks?

How do I write personalized endpoints in Wordpress?

How can I do multiple filtering with datatables?

How do i extract response value of a promise.all call (ReactJS multiple endpoints)

How do i use multiple paths and endpoints in Express Gateway with my RESTAPI?

How can I do multiple delete in js?

How can I do this in Flutter Testing

How can I override the JPA properties for multiple datasources for Integration tests?

How do I retrieve multiple vpc endpoints?