open source – Nightly Builds Test against real database

Although Arseni Mourzenko’s answer covers a lot of the points, it’s important to make a distinction between different databases.

Tests, especially those that manipulate data, should probably be run against a database that is instantiated for those tests. Assuming that your pre-prod environment is also used by people to perform manual testing or demonstrations, you don’t know what the state of the database is. If you ensure that the database starts in a known state, you can make stronger assertions about what the end state will be. If the database isn’t in a known start at the start of the test, the test could erroneously fail or succeed based on the state of existing data or the assertions will need to account for unknown data in the database.

I do think that it makes sense to run tests against a real database on a regular basis, especially if there are stored procedures in the database that need to be tested in conjunction with the application code. However, this should be a database that you have good control over so you can assert a state at the start and end of tests.

continuous integration – Test stage failed in GitLab CI for .NET Core projects

I’m facing trouble with my GitLab CI. The expected workflow for my Test stage is :

  • fetching changes
  • checking out
  • downloading artifacts
  • run dotnet test
  • uploading artifacts

The current workflow is :

  • fetching changes
  • checking out (removing all bin/obj folder)
  • uploading artifacts -> this line failed due to inexistance of my test-results.xml file

My solution looks like this:
— yml file
— MyApp
— MyApp.Tests

The version of my gitlab-runner is 12.4.1 and I’m using the shell executor on Windows environment.

Please find below my yml file:

image: mcr.microsoft.com/dotnet/core/sdk:3.1
variables:
  EXE_RELEASE_FOLDER: 'Oncolin.UI.DesktopbinRelease'
  # the folder inside the deploy folder 
  DEPLOY_FOLDER_APP: 'Oncolin.UI.DesktopBuilds'
  CONFIGURATION: 'release'

 #NUGET_PATH: 'C:NuGetnuget.exe'
 #MSBUILD_PATH: 'C:Program Files (x86)Microsoft Visual Studio2019EnterpriseMSBuildCurrentBinMSBuild.exe'
 #MSTEST_PATH: 'C:Program Files (x86)Microsoft Visual Studio2017EnterpriseCommon7IDEMSTest.exe'
 NUNIT_PATH: '.packagesNUnit.ConsoleRunner.3.9.0toolsnunit3-console.exe'

 SOLUTION: 'Oncolin.sln'

stages:
 - build
 - test

build:
  stage: build
  tags:
   - windows
script:
  - '& nuget restore' # restore Nuget dependencies
  - '& dotnet restore'
  - '& SonarScanner.MSBuild.exe begin /k:Oncolin /d:sonar.host.url=https://docker:10500 '
  - '& dotnet build -c release'
  - '& "$env:MSBUILD_PATH" "$env:SOLUTION" /t:Build /p:Configuration=Release' # build the project
  - '& SonarScanner.MSBuild.exe end'
artifacts:
  expire_in: 1 week # save gitlab server space, we copy the files we need to deploy folder later on
  paths:
    - '$env:EXE_RELEASE_FOLDER*' # saving exe to copy to deploy folder
    - 'RNC.RULES.QUALITY.TESTS*' # saving entire Test project so NUnit can run tests 
    - 'RNC.MODEL.TNM.TESTS*' # saving entire Test project so NUnit can run tests 
    - 'Oncolin.Model.Tests*' # saving entire Test project so NUnit can run tests 
  
test:
  stage: test
  tags:
    - windows
  allow_failure: false
  script:
    - '& dotnet test --test-adapter-path:. --logger:"junit;LogFilePath=$CI_PROJECT_DIRartifacts{assembly}-test-result.xml;MethodFormat=Class;FailureBodyFormat=Verbose"' 
  artifacts:
    expire_in: 1 week # save gitlab server space, we copy the files we need to deploy folder later on
    when: always
    paths:
      - $CI_PROJECT_DIRartifacts*test-result.xml
    reports:
      junit:
        - $CI_PROJECT_DIRartifacts*test-result.xml
  dependencies:
    - build

Can someone explain to me why the downloading and dotnet test steps are skipped ? I hope I gave enough informations.

Thanks in advance.

testing – Basic kernel test fails with Type of DrupalKernelTestsCoreEntityEntityKernelTestBase::$modules must be array

Trying to port a Drupal 7 module to 9 with accompanying test and getting this error immediately when running it:

PHP Fatal error:  Type of DrupalKernelTestsCoreEntityEntityKernelTestBase::$modules must be array (as in class DrupalKernelTestsKernelTestBase) in /var/www/html/docroot/core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBase.php on line 12

The test:

class MyModuleTest extends EntityKernelTestBase {

  use NodeCreationTrait;

  /**
   * @var DrupalmymoduleQueryYearsQuery
   */
  protected $query;

  /**
   * @var array $modules
   */
  protected static $modules = (
    'node',
    'mymodule',
    'mymodule_test',
  );

  /**
   * {@inheritdoc}
   */
  protected function setUp() : void {
    parent::setUp();
    ...

I checked around some of the core classes – the $modules declaration looks the same. Note that I am using PHPUnit 9.

testing – Basic kernel test in Drupal 9 fatal errors with Type of DrupalKernelTestsCoreEntityEntityKernelTestBase::$modules must be array

Trying to port a Drupal 7 module to 9 with accompanying test and getting this error immediately when running it:

PHP Fatal error:  Type of DrupalKernelTestsCoreEntityEntityKernelTestBase::$modules must be array (as in class DrupalKernelTestsKernelTestBase) in /var/www/html/docroot/core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBase.php on line 12

The test:

class MyModuleTest extends EntityKernelTestBase {

  use NodeCreationTrait;

  /**
   * @var DrupalmymoduleQueryYearsQuery
   */
  protected $query;

  /**
   * @var array $modules
   */
  protected static array $modules = (
    'node',
    'mymodule',
    'mymodule_test',
  );

  /**
   * {@inheritdoc}
   */
  protected function setUp() : void {
    parent::setUp();
    ...

I checked around some of the core classes – the $modules declaration looks the same. Note that I am using PHPUnit 9.

UK courier for delivering covid-19 test (fit-to-fly requirements)

Are there any reliable couriers in the UK to deliver my (used) coronavirus test kit? The most common ones like DHL and DPD do not accept them, and Royal Mail deliveries are often delayed.

Travellers to many countries require a negative coronavirus test result (ie. fit-to-fly requirements) before you depart. Depending on the country, the test must be taken within 48h, 72h, or 96h before the departure time. So this is also a time sensitive parcel (delivery by 9am next day would be best).

What happens if I test positive for COVID in-transit at Doha Airport?

I know that if you test positive at the departure airport, you won’t be allowed on the plane. If you test positive at the arrival airport, you will probably be sent to isolation, either at home or somewhere else.

But … what happens if you test positive at a in-transit airport!? You cannot go home since you have no home and you cannot leave the airport since you have no visa!

In my case specifically, the transit airport will be Doha Airport.. What happens if I test positive there?

air travel – Does any international airport require passengers to take a COVID test when transiting?

I am not looking for a list of airports, but simply a yes/no answer, preferably with an example, so that I know whether to add this in my list of requirements to check before taking a flight that has a layover.

I am aware that:

  • some transit airports (e.g., in Russia) require passengers to do a COVID test prior to departure (i.e., before entering the transit airport), but I wonder if any require passengers to do a COVID test during transit.
  • in many (all?) cases, the COVID-19 requirements don’t come from the airport but from the country authorities. Let’s regard requirements from the country authorities as part of the airport requirements.

Response to comments:

The question below assumes that this is the case – Bernhard Döbler 2 mins ago

@BernhardDöbler no, could be optional, or only in some conditions (e.g. if the passenger shows some symptom of COVID-19). Also, I checked on IATA and didn’t see such a requirement.

microservices – How to connect a dockerized multi-container web application to an enterprise AWS ECS test environment?

I have a Go application that is divided into three containers, these containers are called via a docker-compose file and they have environment variables that I believe are held in the cloud including SQS and S3. The issue is, I am having trouble finding out how to actually connect to this environment. I have the in-prod master repo on my computer locally configured, and I also have the AWS cli configured. There are a lot of online examples of how one would go about creating a new cluster, but I just want to connect my docker containers to the test already created cluster and spin up new instances to run the containers on. A little more info about the app is it runs on two ports and our entire test env is hosted on the cloud. Although I am sure there is a way to get the applications to run entirely locally, I am not sure how the original engineer set this up and I believe they wrote this application to be testable on the cloud. The end goal would be having my docker-compose file running my 3 containers in a cluster and being able to hit it with requests in postman with the main app running on port 8000, then pushing my application changes to our test env via our test subdomain.

google sheets – How to test apps script addon

I have created an addon using this guide.

code.gs

function onOpen() {
   SpreadsheetApp.getUi().createAddonMenu()
   .addItem('Start', 'showSidebar');
}

function showSidebar() {
  const ui = HtmlService.createHtmlOutputFromFile('index').setTitle('Sample');
  SpreadsheetApp.getUi().showSidebar(ui);
}

index.html

<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
  </head>
  <body>
    <h1>Works</h1>
  </body>
</html>

It says “If you switch back to document and reload you will see a submenu under Add-ons menu.

But I could not find my addon submenu, I think the quickstart guide is outdated.

Please guide me, How to test the addon on google sheet.

unit testing – How to test UI frameworks

I am currently working on a library that provides functionality for interactive terminal applications.

For now, I implemented functionality for reading an arbitrary keypress from the User to the application as well as setting the currently active color.

I want my library to support a broad spectrum of terminals on different OSs.

Currently, I had to test every newly added feature by hand in a multitude of terminals manually which took a lot of time.

To simplify the task of testing and allow for regression testing, I want to write a test script which automatically opens a Terminal, reads some automated input and writes back colored text.
I want my test to automatically check whether the correct Key Sequence was read and whether the color is displayed.

What would be the best approach of doing this?

The solution that I came up with is based on creating a virtual x server using Xvfb, starting a terminal, send some input & output, screenshot what I have so far and analyze the screenshot (e.g. by comparing it to a predefined image).

Thanks for any help.