…
|
||
---|---|---|
.. | ||
Generators | ||
Generators.Tests | ||
bicep@d6f8b33a8a | ||
BenchPress.sln | ||
README.md |
README.md
Generator
The Generator project can take a .bicep
file and scaffold example Pester tests that use the BenchPress PowerShell
module. These generated tests are not meant to work out of the box and are just a starting point for your
infrastructure tests. Tests will only be generated for supported Azure resources. You can see which resources are
currently supported by the classes defined in the Generators\ResourceTypes
folder. The Generator project is still
in the early stages of development, so expect many ongoing changes.
Running Locally
If you are interested in contributing to or consuming the Generator project at this time, the following steps will help you get started:
Prerequisites
- .NET 7 installed
Steps
-
Clone the repository.
-
Open your command prompt and initialize the
bicep
submodule:git submodule update --init --recursive
-
Navigate to the BenchPress solution:
cd BenchPress
-
Build the solution:
dotnet build
-
Run the Generator project using a
.bicep
filecd Generators dotnet run --provider powershell --import ../../examples.StreamAnalytics/streamAnalytics.bicep --output ./output/
- The
provider
option specifies the language test file to generate. Currently, only PowerShell is supported. - The
import
option specifies the.bicep
file to generate tests for. Feel free to use your own. This document uses an existing.bicep
file that is located under theexamples
directory. - The
output
option specifies where to write the generated test files. Feel free to use a different path.
- The
-
Success! The generated PowerShell test files will be located in the directory specified by the
output
option. Open these test files and look over the contents to see the tests that have been generated. You will notice that you will still need to edit some of the file contents (i.e. changing resource names) to make these tests work. Happy testing!