GithubHelp home page GithubHelp logo

Comments (8)

whozDougie avatar whozDougie commented on June 11, 2024

Such a simple concept! Would love to see this in action say a video demo!

from sharepointdsc.

anlynes avatar anlynes commented on June 11, 2024

Seems like a fair idea to me. Mocking has been a "thing" for ages and is not an onerous activity when compared to the benefits.

from sharepointdsc.

prajeeshprathap avatar prajeeshprathap commented on June 11, 2024

@BrianFarnhill I've used FluentShellUnit to create a stub for SPWebApplication in my scripts. http://blogsprajeesh.blogspot.nl/2015/02/fluentshellunit-create-stub-from-script.html

If you want to write the unit tests using MSTest and want to test the scripts, then you can use the FluentShellUnit project from GitHub or from the nuget server

from sharepointdsc.

BrianFarnhill avatar BrianFarnhill commented on June 11, 2024

@prajeeshprathap - love the idea, is there any way we could achieve this in something purely PowerShell based that we could work in to Pester? We need to line up with all of the other DSC Resources that execute tests in PowerShell with Pester, do you think we could adapt that C# in to script?

from sharepointdsc.

prajeeshprathap avatar prajeeshprathap commented on June 11, 2024

@BrianFarnhill You can do the same with PowerShell as well. The idea is to create a proxy function for the SharePoint cmdlets after the context is loaded and then whenever you make a call to the actual cmdlets, the proxies will be executed.

http://blogs.technet.com/b/heyscriptingguy/archive/2011/03/01/proxy-functions-spice-up-your-powershell-core-cmdlets.aspx

from sharepointdsc.

BrianFarnhill avatar BrianFarnhill commented on June 11, 2024

I have an approach to enable better unit testing without needing to stub all of the methods out in our script. I wrote a blog post on the topic and am almost finished incorporating this in to a pull request with the fixes and expanded test base. I'll close this issue once I push the script in to a pull request, but in the mean time here is the blog post on how it is done:

http://blogs.msdn.com/b/brian_farnhill/archive/2015/09/10/how-to-unit-test-powershell-scripts-that-call-cmdlets-from-the-sharepoint-snap-in.aspx

from sharepointdsc.

BrianFarnhill avatar BrianFarnhill commented on June 11, 2024

This approach is now fixed to PR #78 and should be merged to dev shortly. I will close when the code review is complete

from sharepointdsc.

BrianFarnhill avatar BrianFarnhill commented on June 11, 2024

This is now merged in to the dev branch and will be in the next release - closing this issue

from sharepointdsc.

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.