Pester: Add a new repository for generic tests

Created on 24 Apr 2016  路  17Comments  路  Source: pester/Pester

I've been asked by @juneb if I could create a sub-repository in the Pester organisation that would hold generic tests that people can take and reuse. One example would be her module help tests that can be reused on any module. Also I saw a similar idea shared on twitter today. The idea is to share generic infrastructure tests that would span as much vendors as possible.

I very much like the idea of bringing tests closer to the framework. But I would like to get some further information, to get the feeling of what people expect from this.

So please share your thoughts on those topics, and anything else that comes to your mind:

  • What are the potential products to be covered?
  • How much can be tested while keeping the usable across different configurations/versions of software?
  • What is the right amount of generic?
  • How to version the tests? (modules?)
  • How the package will be distributed? (if that's the plan)
  • How to validate the functionality without having all the vendor specific software on the CI server?
  • Would a list of links to vendor/product specific repositories be a better idea?

Most helpful comment

Agree with @rdtechie, These tests should serve as a template for people to start with and then tailored for their own needs.
Can the OVF format for tests be extended here where the generic tests go into simple and more specific test cases fall under Comprehensive ?

All 17 comments

Great initiative. Here are some of my thoughts:

  • Potential Products: Can be unlimited in my opinion, but be very careful in choosing your taxonomy. This is important for finding tests quickly. No more than 3 levels deep, preferably.
  • Tests should not try to be too much generic. It's OK to have specific use cases. These can function as templates for the user. But tests should cover only a tiny part of a given technology. Take for example Active Directory. A test for creating a user can be shared as a template.
  • It would be nice if the tests are being seperated into their own modules, downloadable on the PowerShell Gallery. Take as a example the DSC resources. Pester test templates COULD be aligned also to the DSC resources in terms of taxonomy.
  • A resource list is always useful, but it shouldn't be the main resource for getting modules. It should act more like a supporting resource.

( ps: I registered pestertesting.com, I'm happy to hand it over to you if you want to ).

I think it's a great idea.

  1. DscResource.Tests has the same spirit.
    This example can provide some insights about distribution model and related challenges.
  2. I personally would love to see "Git"-related tests

    • any project that uses Git would benefit from using consistent tabs, encoding and enforcing "new line" at the end-of-file.

    • examples of such tests is here, here, as you see, it's just a bunch of duplication.

    • the value come from the predictable diffs, hence better history. I.e. PR that accidentally change tabulation would be automatically marked as failed, because test would fail.

I'm about to post a blog post (& also a module to the gallery) on my method to build a set of dynamically built generic basic pester tests for existing/old modules that helps me move away from massive psm1 files into a file structure that is easier to work with going forward i.e seperate ps1 files for each function.

Happy to push the examples to a SubRepo if that is a better suggestion from the community

Agree with @rdtechie, These tests should serve as a template for people to start with and then tailored for their own needs.
Can the OVF format for tests be extended here where the generic tests go into simple and more specific test cases fall under Comprehensive ?

Remember the portable script center? A setup like that would be a great starting point. Back in my vbs days this was my goto repository. Like @DexterPOSH said it's a template, much like the script center combine and tailor to your needs!

@irwins What is a portable script center? Sorry, not familiar, but I'm very intrigued.

Discovery might be a challenge. I'll help to write/edit the ReadMe.md. Can we require that everyone who submits a .Tests. file add an entry to a list of tests with a link and a short description. Can we tag them in categories? Or, is this a job for PSGallery?

@juneb The Portable script center was a chm file back when vbs was mainstream. I rather much like the setup of the file. Here's a link to the current gallery: https://gallery.technet.microsoft.com/scriptcenter.

Categories & Tags will be helpful

image

Just an idea how we could categories...

I already have tests written for VMware vSphere infrastructures. I would be happy to share them here !

I like this idea.

Especially for more specific modules/applications tests examples (e.g. Exchange) are very limited and/or dispersed.

Having a good set of reference tests (distributed as modules on PS Gallery) would be fantastic.

These could serve as simple smoke tests for your core infrastructure services. I think of them as a subset of the tests found in the OpsMgr management packs. Bonus points if the Pester tests are written so users can plugin the parameters for their environment to override the defaults. This would be similar to parameter overrides in OpsMgr.

Is this still moving along and/or is any assistance needed? I've previously used powershell with vCheck to add several third party plugins for checks and reporting.

Would be glad to get that moved over to a standard pester/OVF format.

I believe @nohwnd set up the new repo recently, though it doesn't have much happening yet. :) https://github.com/pester/Test-library

The first pull request Pester/test-library#3 opened :-)

Based on a lack of responses (the one pull request did by myself - https://github.com/pester/Test-library/pull/3) to Pester/Test-library I declare that the idea is dead and close the current issue.

@nohwnd, can you consider removing the Pester/Test-library?

@it-praktyk yeah, that kinda sparked up and died (and I am to blame, at least a bit). Hopefully we can re-visit the idea somewhere in the future. I'll remove the repo.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fromthewoods picture fromthewoods  路  34Comments

nohwnd picture nohwnd  路  129Comments

ghost picture ghost  路  20Comments

iRon7 picture iRon7  路  20Comments

Mahendra1260 picture Mahendra1260  路  50Comments