Skip to content

Instantly share code, notes, and snippets.

0x39E63a7B368F68B1c5d0F9C566D2A3C73Bf59004
@safestudent
safestudent / pom.xml
Last active April 18, 2018 05:42
pom.xml for deploying to Tomcat
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.safebear</groupId>
<artifactId>tasklist</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
@safestudent
safestudent / Jenkinsfile
Created April 18, 2018 05:40
Jenkinsfile
pipeline {
options {
buildDiscarder(logRotator(numToKeepStr: '3', artifactNumToKeepStr: '3'))
}
agent any
parameters {
string(name: 'apiTests', defaultValue: 'ApiTestsIT', description: 'API tests')
string(name: 'cuke', defaultValue: 'RunCukesIT', description: 'cucumber tests')
string(name: 'context', defaultValue: 'safebear', description: 'application context')
@safestudent
safestudent / Driver.cs
Created September 19, 2018 16:46
Wait for Element
public static IWebElement WaitForElement(By locator)
{
// Here we set the timeout as 5 second, 0 minutes and 0 hours
WebDriverWait wait = new WebDriverWait(Browser, new TimeSpan(0, 0, 5));
// Here we set the `Until` condition as until the browser finds the element. If it find the element in 5 seconds, it will return it.
return wait.Until(Browser => Browser.FindElement(locator));
}
@safestudent
safestudent / Driver.cs
Created September 19, 2018 16:49
Screenshots
public static string GetPathToMyDocuments()
{
// return the absolute path to the MyDocuments folder on your computer
return Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
}
// you need to pass through the filename you want to call your screenshot
public static void FullScreenScreenshot(string fileName)
{
// take the screenshot
@safestudent
safestudent / azure-pipelines.yml
Last active September 12, 2019 09:30
CI Pipeline MAT DotNet
resources:
# The 'repo' section defines the code repository (self means 'this one' i.e. ToolsList)
- repo: self
# The 'queue' section defines the machine on which we'll run our code and what are the tools we'll need to run the tests
queue:
# We'll use a standard machine that Azure provides for free. It comes pre-installed with Visual Studio 2017
name: Hosted Windows 2019 with VS2019
@safestudent
safestudent / NuGet Console
Last active March 14, 2019 13:54
Generate Report
nunit3-console.exe --labels=All --out=TestResult.txt “--result=TestResult.xml;format=nunit2” ToolsList.AcceptanceTests\bin\Debug\ToolsList.AcceptanceTests.dll
@safestudent
safestudent / NuGet Console
Last active March 14, 2019 13:55
SpecFlow Report Generation
specflow.exe nunitexecutionreport --ProjectFile ToolsList.AcceptanceTests\ToolsList.AcceptanceTests.csproj --xmlTestResult TestResult.xml
@safestudent
safestudent / SprintsControllerTest.cs
Created December 4, 2018 12:15
SprintsControllerTest
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using SprintTracker.Web.Controllers;
using SprintTracker.Web.Models;
using System.Threading.Tasks;
using Xunit;
namespace SprintTracker.Tests
{
public class SprintsControllerTest
{
@safestudent
safestudent / SprintTrackerWebContextTest.cs
Created December 4, 2018 12:17
SprintTrackerWebContextTest.cs
using Microsoft.EntityFrameworkCore;
using SprintTracker.Web;
using SprintTracker.Web.Models;
using System.Linq;
using Xunit;
namespace SprintTracker.Tests
{
public class SprintTrackerWebContextTest
{