Git Product home page Git Product logo

Comments (5)

teppolainio avatar teppolainio commented on May 25, 2024

I'd think you shouldn't put too much onto responsibility of the single fake-xrm-easy NuGet package as unit testing and integration testing have quite different responsibilities. Another tests components as separate entities and another tests components as a part of the complete system.

I'd consider approach where current fake-xrm-easy functionality would be broken into two pars:

  1. IOrganizationService simulation would be in one separate NuGet package and
  2. Plugin and WF activity testing would be on separate NuGet package.

This would allow greater flexibility for community to build their own solution which might depend solely from IOrganizationService package. After these two are separated then I'd say integration tests could be implemented into separate NuGet package depending for example for those two.

from fake-xrm-easy.

jordimontana82 avatar jordimontana82 commented on May 25, 2024

Thanks a lot for your feedback @teppolainio

I get your point for integration testing and maybe is better to have a separete NuGet package for that.

I do like having Plugin and Codeactivity mocks into the one fakexrmeasy NuGet package tho, to keep maintenance of the project itself easier, and also, from a point of view of unit testing solely, it's just easier to add a single reference than adding 2 per unit test project.

What do you want to add which depends solely on the IOrganizationService?

from fake-xrm-easy.

teppolainio avatar teppolainio commented on May 25, 2024

Situation I was thinking about where dependancy only to IOrganizationService would be sufficient was testing of standalone applications which query and/or write data from/to CRM but are not run within CRM. Examples would be different kind of integration services, web services, Windows services, command line application, desktop applications etc.

Also, if my assumption is correct IOrganizationService mockup is implemented using "pure code" which does not have dependency to FakeItEasy mockup library whereas plugin and code activity execution parts of fake-xrm-easy are done using mockups i.e. they have dependancy to FakeItEasy. If this assumption is correct then separate NuGet package for IOrganizationService mockup would also make it possible to integrate it into existing unit test solution which might be built using some other mockup libraries (like NSubstitute). Please correct me if my assumption about FakeItEasy dependancy was incorrect.

Nevertheless, current fake-xrm-easy implementation doesn't incur too much unnecessary features to cases where only IOrganizationService mockup is sufficient that we couldn't handle it but adding also integration tests into the same NuGet package could mitigate usefullness and easy approachability of the current fake-xrm-easy unit testing library.

from fake-xrm-easy.

jordimontana82 avatar jordimontana82 commented on May 25, 2024

Dependency on FakeItEasy is at the core of FakeXrmEasy (in part, that was the reason it was named that way :) ).

If you look at this you'll see even really basic operations like CRUD, are also using FakeItEasy.

If you look at the codebase, the heavy work was around mocking the IOrganisationService, and the Plugin and CodeActivity mocks just add a little bit on top of that.

I totally agree though it doesn't make much sense to incorporate integration testing mocks here because in that case tests should be run against a real Organisation Service. I was thinking of initially adding them here to add some kind of helper logic to implement TearDown methods, which would clean all the testing data for you on the integration environment once the test is finished.

But after thinking a lot on it, I believe it is much more easier and safer to setup a VM environment where you will spin up a VM with a CRM integration test environment, execute integration tests, and stop it when done.

By doing that there won't any interference or clashes between integration test runs and therefore no need to worry about the data that was created there. Which is really key concept of TDD: tests should be Repeatable.

from fake-xrm-easy.

jordimontana82 avatar jordimontana82 commented on May 25, 2024

Hi @teppolainio

Iยดm going to close this if you are happy as it makes more sense to have a separate NuGet package for integration testing.

from fake-xrm-easy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.