Skip to content

Instantly share code, notes, and snippets.

View SergioLuis's full-sized avatar
:bowtie:

Sergio Luis Para SergioLuis

:bowtie:
  • Valladolid, SPAIN
View GitHub Profile
@SergioLuis
SergioLuis / spectre.console.performance.test.cs
Created September 26, 2021 17:28
spectre.console.performance.test.cs
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using Spectre.Console;
namespace spectre.tree.performance
{
Enabled:
- activity:
- Version: 2.6.0
- Path: /var/www/owncloud/apps/activity
- camerarawpreviews:
- Version: 0.7.11
- Path: /var/www/owncloud/custom/camerarawpreviews
- checksum:
- Version: 0.3.5
- Path: /var/www/owncloud/custom/checksum
{
"basic": {
"license key": "***REMOVED SENSITIVE VALUE***",
"date": "Sat, 12 Jun 2021 09:26:04 +0000",
"ownCloud version": "10.7.0.4",
"ownCloud version string": "10.7.0",
"ownCloud edition": "Community",
"server OS": "Linux",
"server OS version": "Linux 7fa2d5b425f0 5.4.0-1034-raspi #37-Ubuntu SMP PREEMPT Mon Apr 12 23:14:49 UTC 2021 aarch64",
"server SAPI": "apache2handler",
@SergioLuis
SergioLuis / GetGitignore.ps1
Last active October 24, 2019 18:53
A PowerShell function to generate a .gitignore file using gitignore.io service
function Get-Gitignore {
<#
.SYNOPSIS
Creates a .gitignore file using gitignore.io API
.DESCRIPTION
Creates in the current directory a .gitignore file using the template
provided by gitignore.io based on the services you use.
.PARAMETER Targets
List of applications, programming languages and tools you use.
.PARAMETER Output
@SergioLuis
SergioLuis / GuiTest.cs
Created January 28, 2019 17:08
A peek on how a GUI test looks like
/* (...) */
ITestableInputDialog testableDialog =
testableWindow.GetInputDialog();
testableDialog.ChangeEntryText("Sergio");
testableDialog.ClickOkButton();
WaitingAssert.IsTrue(() =>
{ return testableDialog.IsOkButtonEnabled()
@SergioLuis
SergioLuis / TestOperations.cs
Created January 28, 2019 17:03
How to do rutinary checks without repeating yourself
/* (...) */
public delegate void ExecuteTestDelegate(string testName);
public static void RunTest(
string methodTestName, ExecuteTestDelegate testDelegate)
{
// Run the test...
RunGuiTest(methodTestName, testDelegate);
@SergioLuis
SergioLuis / GuiTest-DialogChecking.cs
Created January 28, 2019 17:00
An example on how to check for unwanted dialogs at the end of a test
[Test]
public void SomeTest()
{
// The rest of the test
ITesteableErrorDialog errorDialog = testeableAppWindow.GetErrorDialog();
if (errorDialog == null)
return;
LogErrorMessage(errorDialog);
Assert.Fail(“There was an unexpected error dialog!”);
@SergioLuis
SergioLuis / BaseDialog.cs
Created January 28, 2019 16:59
The base implementation of a dialog that registers and unregisters itself against the WindowHandler
public class BaseDialog : Form
{
protected override void OnShown(EventArgs e)
{
WindowHandler.AddDialogForTesting(this);
base.OnShown(e);
}
protected override void OnClosed(EventArgs e)
{
@SergioLuis
SergioLuis / WindowHandler-2.cs
Created January 28, 2019 16:58
The part of the WindowHandler that takes care of dialogs
/* (...) */
public static void AddDialogForTesting(Form dialog)
{
if (!bIsTestingMode)
return;
mDialogs.Add(dialog);
}
@SergioLuis
SergioLuis / GuiTest-ErrorChecking.cs
Created January 28, 2019 16:56
An example on how to check for unhandled exceptions at the end of a test
[Test]
public void SomeTest()
{
// The rest of the test
if (GuiTesteableServices.UnhandledExceptions.Length == 0)
return;
LogExceptions(GuiTesteableServices.UnhandledExceptions);
Assert.Fail(“There were unhandled exceptions trapped!”);
}