Skip to content
This repository was archived by the owner on Jan 5, 2026. It is now read-only.

Conversation

@JuanAr
Copy link
Collaborator

@JuanAr JuanAr commented Jul 18, 2018

Included compilation directive and [Ignore] attribute to Integration Test classes to make them disabled by default. They run only when explicitly define the RUNINTEGRATIONTESTS compilation constant.
Integration tests will be shown as _ Skipped_ in the Test explorer with the message: These integration tests run only when RUNINTEGRATIONTESTS is defined.

#if !RUNINTEGRATIONTESTS
    [Ignore("These integration tests run only when RUNINTEGRATIONTESTS is defined")]
#endif

@JuanAr JuanAr requested a review from cleemullins July 18, 2018 12:33
@JuanAr
Copy link
Collaborator Author

JuanAr commented Jul 18, 2018

@cleemullins By merging this PR all integration tests won't run until the RUNINTEGRATIONTESTS compilation constant is included in the MS Build command line.
Alternatively, we can include the compilation constant in the build target configuration (e.g. we can configure the unit test project for the Release configuration)

@JuanAr JuanAr force-pushed the southworks/conditional-integration-tests branch from ac68af4 to c675f4a Compare July 19, 2018 17:22
@JuanAr
Copy link
Collaborator Author

JuanAr commented Jul 19, 2018

We also moved all integration tests accessing network services to a new Microsoft.Bot.Builder.IntegrationTests project. Here we moved/copied tests classes from to categories:

  1. We copied those integration tests that can use the mock HttpMessageHandler approach. This way, the two versions of the tests are available: Unit tests and Integration tests.
  2. We moved those integration tests that are not suitable for mock. They will only exist in the IntegrationTests project.

@enzocano enzocano force-pushed the southworks/conditional-integration-tests branch from c675f4a to 74865f1 Compare July 24, 2018 13:39
Copy link
Member

@johnataylor johnataylor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only question is - does this include the extra build target referred to in the comment?
(its pretty sad that we have to use a macro to control the test framework - anyhow great to have the capability)

@JuanAr
Copy link
Collaborator Author

JuanAr commented Jul 24, 2018

@johnataylor The compilation symbol/constant is configured in the new Microsoft.Bot.Builder.IntegrationTests.csproj project only for the Release configuration. Alternatively, you can temporarily add the RUNINTEGRATIONTESTS constant in the project properties page.

Yes, it is included, but take into account it is not a new Target. https://github.com/Microsoft/botbuilder-dotnet/pull/765/files#diff-dfa2c0caf486505728526f3e1095a104R10
And yes, code is a bit dirty with those conditional compilation directives. on the other hand, it seems very clear what those 3 lines are meant to.

@JuanAr JuanAr force-pushed the southworks/conditional-integration-tests branch 3 times, most recently from 26c10c7 to a54ed68 Compare July 25, 2018 18:13
@JuanAr JuanAr force-pushed the southworks/conditional-integration-tests branch from a54ed68 to a6ed06d Compare August 7, 2018 16:43
@JuanAr JuanAr force-pushed the southworks/conditional-integration-tests branch from a6ed06d to c06bfb9 Compare August 7, 2018 17:16
@johnataylor
Copy link
Member

@JuanAr can we close this now?

@JuanAr
Copy link
Collaborator Author

JuanAr commented Aug 15, 2018

@johnataylor I think we should revisit the original objective for this PR.
Initially, the idea was to be able for users to just clone the repo and run all unit tests disconnected from external services while also having the option to run integration tests against the real services. This PR achieved the latest.

However, while developing mocks we implemented them in a way that, instead of two separated versions of tests (unit & integration tests), the same test uses a flag to conditionally hit the mocks or the external service. This might be a much better approach because it avoids having duplicated tests.
We already added issue #826 to use HttpRecorder to achieve this, if we agree we can close this PR without merging and take #826 as a replacement.

Let us know what you think.

@JuanAr JuanAr added the on hold Progress is halted at the moment. label Aug 15, 2018
@JuanAr
Copy link
Collaborator Author

JuanAr commented Oct 22, 2018

Closing this obsolete PR since the approach used in tested changed to an hybrid one.

@JuanAr JuanAr closed this Oct 22, 2018
@JuanAr JuanAr deleted the southworks/conditional-integration-tests branch October 22, 2018 15:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

on hold Progress is halted at the moment.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants