Skip to content

Instantly share code, notes, and snippets.

@bcnzer
bcnzer / Startup.cs
Created August 5, 2017 10:49
Part of the Startup.cs in which I setup key vault
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", true, true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", true)
.AddEnvironmentVariables();
if (env.IsDevelopment())
{
@bcnzer
bcnzer / secrets.json
Created August 6, 2017 03:11
Sample secrets.json with only the connection string and key vault config
{
"ConnectionStrings": {
"WolfTrackerDB": "Server=(localdb)\\MSSQLLocalDB;Database=wolftracker;Trusted_Connection=True;MultipleActiveResultSets=true",
"WolfTrackerRedis": "<my connection string>",
"WolfTrackerStorage": "<my connection string>"
},
"KeyVault": {
"ClientId": "7985ad5b-ca56-4013-b627-4de75291cace",
"ClientSecret": "2MJMMybvsVGzn7la5gTSACWXvKeua50GzxKE7CgxEEU=",
@bcnzer
bcnzer / launch.json
Created October 25, 2017 09:18
VS Code launch.json file for use in debugging Vue.js apps
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
@bcnzer
bcnzer / Home.vue
Created October 25, 2017 09:22
Sample vue file with the debugger statement
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<h4 v-if="authenticated">
You are logged in!
</h4>
<h4 v-if="!authenticated">
You are not logged in! Please <a @click="hi()">Log In</a> to continue.
</h4>
</div>
@bcnzer
bcnzer / pip commands.txt
Created November 12, 2017 08:28
Pip commands for Selenium testing
pip install yolk
pip install robotframework
pip install robotframework-selenium2library
pip install robotframework-faker
pip install robotframework-ride
Test using 'robot --version'
@bcnzer
bcnzer / copyallfiles.ps1
Created November 12, 2017 09:31
Copy all the files from the repo in VSTS
# Note I'm using the clean option in the Get Sources area
Write-Host "Copying all items in the project"
copy-item * $(Build.ArtifactStagingDirectory) -recurse
@bcnzer
bcnzer / cleanandcopy.ps1
Created November 12, 2017 09:42
Copy latest tests onto the server - VSTS
# Remove any existing files and then copy in the new one from the build
remove-item C:\agent\_work\_robotframework\* -recurse
copy-item "Robot framework tests\drop\*" "C:\agent\_work\_robotframework" -recurse
Write-Host "Copied Selenium test items"
@bcnzer
bcnzer / runrobotframeworktests.ps1
Created November 13, 2017 09:19
Run Robot Framework Tests on my VSTS build server
Write-Host "Running Robot Framework tests"
C:\Python27\Scripts\robot.bat -o '$(OutputFolder)\output.xml' -l '$(OutputFolder)\log.html' -r '$(OutputFolder)\report.html' -x '$(OutputFolder)\outputxunit.xml' '$(RobotFrameworkFolder)\Dashboard\Dashboard.robot'
@bcnzer
bcnzer / uploadfilestoblogstorage.ps1
Created November 13, 2017 09:22
Upload resultant files to Azure blog storage
# Azure subscription-specific variables.
$storageAccountName = "spotterazurelogs"
$containerName = "robotframework-logs"
# Upload files in data subfolder to Azure.
$localfolder = "$(OutputFolder)"
$destfolder = "$(Release.ReleaseName)"
$blobContext = New-AzureStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $(SpotterLogStorageKey)
$files = Get-ChildItem $localFolder
@bcnzer
bcnzer / checkForError.ps1
Created November 13, 2017 09:32
Check for errors in the output so I can log an error in the console
$successPattern = "<status status=""FAIL"""
$Matches = select-string -Pattern $successPattern -Path 'C:\agent\_work\_robotframework\Output\output.xml'
$errorCount = $Matches.Matches.Count
if ($errorCount -ne 0) {
Write-Host "##vso[task.logissue type=error;]There are $errorCount errors in the Robot Framework tests"
#exit 1 # decided I won't have it stop. Instead I'll have it as a partial pass
}