woensdag 24 november 2021

Do you need to make test checks on your Azure Portal subscription which Azure Resources you have deployed in a Resource Group? Then I've made this Pester script to check the location of a resource.

  $resourcegroup = 'YOUR_REOURCE_GROUP'
  $resourcename = 'YOUR_RESOURCE_NAME'
  $resources = Get-AzResource -Name $resourcename -ResourceGroupName $resourcegroup  

  # Create an empty array
  $testcases = @()
  $resources.ForEach{$testcases += @{resource = $_}}

  Describe 'Azure Resources'{
       It "Gives correct region to <resource>" -TestCases $testcases  {              
              $resource.Location | Should -Be 'westeurope'      
       }      
}

What tool is Pester?

source: https://github.com/pester/Pester

video: https://www.youtube.com/watch?v=qeiy8fRMHf8&t

vrijdag 31 januari 2020

Gitlab Ubuntu image

Always had plans to play with Gitlab but never get a change or time? Then simply download my Ubuntu image within Gitlab, NodeJS example test project* and Docker gitlab-runner.

You only have to install Oracle Virtualbox:

And the download my Ubuntu image (20GB free diskspace for downloading and unzipping):

Action after starting ubuntu:
  1. user/ww: osboxes.org
  2. wait 5 minutes after login action to start up Gitlab in the background
  3. Start firefox and go to http://10.0.2.15/ and then user/ww: root/gitlab20 for Gitlab
  4. Inside Gitlab you can navigate to the screenshot below to see the last runned pipeline.
*Source:






maandag 25 februari 2019

Try Cypress in VM for VirtualBox

Like to try Cypress without installing it by yourself? Then download this Ubuntu VM for VirtualBox!
https://drive.google.com/file/d/1gq8fBKUrMyXZ7H1Y0Fv7LtLk0vYH3sDU/view

user and password: osboxes.org

Start Cypress in new Terminal window with command:
osboxes@osboxes: cd ~/Work/Cypress && npm run cypress:open

Example testcase 1:
describe('Check if the Hotel App from Adactin is available', function() {
  it('Visits the Adactin Hotel App website', function() {
    cy.visit('https://adactin.com/HotelApp/')
    cy.contains('Welcome to AdactIn Group of Hotels')
    cy.get('#username')
      .type('Cucumbertestuser')
    cy.get('#password')
      .type('cucumbertestuser')
    cy.get('#login').click()
  })
})

Install Visual Studio code if you need another IDE to edit Cypress scripts:
https://websiteforstudents.com/install-visual-studio-code-on-ubuntu-16-04-18-04/ 

Example testcase 2:
describe('Check if you can book a room with the Hotel App from Adactin', function () {

  const todaysDate = Cypress.moment().format('DD/MM/YYYY')
  const fourteenDaysForward = Cypress.moment().add(14, 'day');
  const todaysDatePlus14 = Cypress.moment(fourteenDaysForward).format('DD/MM/YYYY');
  const twoYearsForward = Cypress.moment().add(2, 'year');
  const todaysDatePlusTwoYears = Cypress.moment(twoYearsForward).format('YYYY');

  beforeEach(function () {
    // login on the website before each test
    cy.visit('https://adactin.com/HotelApp/')
    cy.contains('Welcome to AdactIn Group of Hotels')
    cy.get('#username')
      .type('Cucumbertestuser')
    cy.get('#password')
      .type('cucumbertestuser')
    cy.get('#login').click()
    cy.contains('Search Hotel')
    cy.contains('Fields marked with Red asterix (*) are mandatory')
  })

  function fillsearchscreen(Location, Hotels, RoomType, RoomNos, DatepickIn, DatepickOut, AdultRoom, ChildRoom) {
    cy.get('#location')
      .select(Location)
    cy.get('#hotels')
      .select(Hotels)
    cy.get('#room_type')
      .select(RoomType)
    cy.get('#room_nos')
      .select(RoomNos)
    cy.get('#datepick_in').clear()
      .type(DatepickIn)
    cy.get('#datepick_out').clear()
      .type(DatepickOut)
    cy.get('#adult_room')
      .select(AdultRoom)
    cy.get('#child_room')
      .select(ChildRoom)
    cy.get('#Submit').click()
    cy.contains('Select Hotel')
  }

  // it('can fill the screen for search hotel', function () {
  //   fillsearchscreen('London', 'Hotel Sunshine', 'Double', '2 - Two', todaysDate, todaysDatePlus14, '2 - Two', '2 - Two')
  // })

  // it('can select a hotel after searching', function () {
  //   fillsearchscreen('London', 'Hotel Sunshine', 'Double', '2 - Two', todaysDate, todaysDatePlus14, '2 - Two', '2 - Two')
  //   cy.get('#radiobutton_0').click()
  //   cy.get('#continue').click()
  //   cy.contains('Book A Hotel')
  // })

  // it('can select the second hotel after searching', function () {
  //   fillsearchscreen('Sydney', '- Select Hotel -', 'Double', '2 - Two', todaysDate, todaysDatePlus14, '2 - Two', '2 - Two')
  //   cy.get('#radiobutton_2').click()
  //   cy.get('#continue').click()
  //   cy.contains('Book A Hotel')
  // })

  it('can book an hotel and search it in the reservation menu', function () {
    fillsearchscreen('Sydney', '- Select Hotel -', 'Double', '2 - Two', todaysDate, todaysDatePlus14, '2 - Two', '2 - Two')
    cy.get('#radiobutton_2').click()
    cy.get('#continue').click()
    cy.contains('Book A Hotel')
    cy.get('#first_name')
      .type('CypressFirst')
    cy.get('#last_name')
      .type('CypressLast')
    cy.get('#address')
      .type('CypressAddress')
    cy.get('#cc_num')
      .type('1234567812345678')
    cy.get('#cc_type')
      .select('VISA')
    cy.get('#cc_exp_month')
      .select('June')
    cy.get('#cc_exp_year')
      .select(todaysDatePlusTwoYears)
    cy.get('#cc_cvv')
      .type('1234')
    cy.get('#book_now').click()
    cy.contains('Please wait! We are processing your Hotel Booking').should('be.visible')
    cy.contains('Booking Confirmation').should('be.visible')

    cy.get('#order_no').then(ordernr => {
      const OrderNo = Cypress.$(ordernr).val();
      cy.get('#my_itinerary').click()
      cy.contains('Search Order Id')
      cy.get('#order_id_text')
        .type(OrderNo)
      cy.get('#search_hotel_id').click()
      cy.contains('1 result(s) found').should('be.visible')
      cy.get('tr:nth-child(2) > td:nth-child(2) > input').should('have.value', OrderNo)
      cy.get('td:nth-child(4) > input').should('have.value', 'Hotel Creek')
      cy.get('#check_all').click()
      cy.get('input.reg_button:nth-child(1)').click()
      cy.get('#order_id_text')
        .type(OrderNo)
      cy.get('#search_hotel_id').click()
      cy.contains('0 result(s) found').should('be.visible')
    });
  })
})

Or a project* with this above example combining Cucumber and Cypress:
Cypress Cucumber Example project
*source: https://github.com/TheBrainFamily/cypress-cucumber-example 

dinsdag 19 februari 2019

On Docker Hub I've created a new Docker Container with a working Cucumber project.

If you want to try this by yourself:
1. Install Docker on your host device
2. Visit my container on Docker Hub: https://hub.docker.com/r/steavy/docker-cucumber-demo
3. Read the Overview on Docker Hub for more information

woensdag 5 december 2018

Async Groovy script for polling database results for ReadyAPI (SoapUI) TestCases

Make a new "Groovy Script" Step in your SoapUI TestCase for Async calls to a database for waiting for a certain result:


import groovy.sql.Sql
import com.eviware.soapui.support.GroovyUtils
import static org.junit.Assert.assertThat
import static org.hamcrest.CoreMatchers.containsString

log.info("")
log.info(" init DB connection...")

com.eviware.soapui.support.GroovyUtils.registerJdbcDriver("oracle.jdbc.driver.OracleDriver")
sql = Sql.newInstance("jdbc:oracle:thin:<USERNAME>/<password>@<HOSTNAME:PORT/DATABASENAME>", "oracle.jdbc.OracleDriver")

def timeout = 0
log.info("setup done")

while (true)
{
   def itemCount = sql.firstRow("select count(*) from <TABLENAME> where <QUERY>")
   def itemCount_nr = itemCount[0].toString()
   log.info("while count = " + itemCount_nr)
   sleep(2000)
   timeout++
   if (itemCount_nr == "1") break
   else if (timeout % 22 == 0) break
}

log.info("sql close")
sql.close()



In this above example the result will depend on the count (expect 1 row) if not then loop 2000msec with the max of 22 x 2000 msec then "break". If between this 44 sec there is a result then "break". After that always close the SQL connection.

vrijdag 8 december 2017

Meerdere testomgevingen configureren voor je Maven Cucumber-Java project dmv profiles

Om tegen verschillende testomgevingen aan te kunnen testen heb ik een opzet gemaakt dmv profiles in de pom file van een Maven project.

Door onderstaande aan je maven file toe te voegen kun je met een extra parameter in je Maven commando aangeven met welke omgeving config.properties de testen moeten draaien. Door meerdere profiles met verschillende <id> neer te zetten in de POM kun je aangeven welke config.properties vanuit je resources naar je target directory gekopieerd moet worden.

Dit kan erg handig zijn als je meerdere builds in bijvoorbeeld Jenkins wilt configureren voor meerdere testomgevingen.

Bronvermelding:

Maven commando met juiste parameter (-Ptst) om testomgeving te bepalen:
mvn clean test -Ptst

Voorbeeld profile (TST omgeving) die opgenomen kan worden in je Pom file:
<profiles>
        <!-- TST profile -->
        <profile>
            <id>tst</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>generate-test-sources</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <tasks>
                                        <delete file="target/test-classes/config.properties"/>
                                        <copy file="src/test/resources/config.tst.properties"
                                              tofile="target/test-classes/config.properties"/>
                                    </tasks>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>3.1</version>
                        <configuration>
                            <source>1.8</source>
                            <target>1.8</target>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.20.1</version>                
                        <dependencies>
                            <dependency>
                                <groupId>org.apache.maven.surefire</groupId>
                                <artifactId>surefire-junit4</artifactId>
                                <version>2.20.1</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                </plugins>
                <finalName>TstEnvironment</finalName>
            </build>
        </profile>
</profiles>



dinsdag 25 juli 2017

Hamcrest icm een Rest Assured demo project

Lijkt het je leuk om eens met Hamcrest te spelen? Dan heb ik goed nieuws. Ga snel naar mijn volgende GitHub repo: https://github.com/Steavy/hamcrest-rest-assured-demo/tree/develop

dinsdag 20 december 2016

Travis CI gebruiken om Cucumber icm PhatomJS te gebruiken

Op dit moment is het tevens mogelijk om in Travis CI te gebruiken voor het Cucumber-Java project via PhantomJS.

Wat heb je nodig:
  1. Cucumber-Java
  2. PhantomJS
  3. Een Travis account via je GitHub account "Sign in with GitHub" rechtsbovenaan
  4. Selecteer bij de eerste keer inloggen op Travis je eigen CucumberDemo project vanuit GitHub
  5. Het onderstaande .travis.yml bestand in de root van je Cucumber project
language: java
jdk:
- oraclejdk8
before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- sleep 3 # give xvfb some time to start

vrijdag 16 december 2016

PhantomJS binnen Cucumber gebruiken?

In een eerdere post Cucumber-Java heb ik uitleg gegeven hoe je makkelijk eens Cucumber kan bekijken. Als aanvulling heb ik het nu ook mogelijk gemaakt om PhantomJS naast Chrome of FireFox te gebruiken. Het voordeel is dat testen uitvoeren doorgaans een stuk sneller gaan en op de achtergrond worden uitgevoerd zonder dat daarvoor een browserscherm voor hoeft geworden gestart.

Hiervoor kun je het volgende stappenplan doorlopen:

  1. Download en installeer PhantomJS
    1. Download install-phantomjs.sh (bron: GitHub)
    2. Open het gedownloade bestand in gedit
    3. Voer per stap het script uit in een terminal venster
  2. Zet versie 3.01 van selenium-java in je pom.xml binnen het project met IntelliJ 
    <dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>3.0.1</version>
    </dependency>
  3. Neem het volgende stukje code over in je SharedDriver.java bestand binnen het Cucumber-Java project binnen IntelliJ:
.....................................................
static {
    String browserName = System.getProperty("browser");
    if(browserName == null) {
        browserName = "phantomjs";
    }
    if(browserName.equals("firefox")) {
        REAL_DRIVER = new FirefoxDriver();
    }
    else if(browserName.equals("chrome")) {
        String pathToDriver = System.getProperty("pathToDriver");
        if(pathToDriver == null) {
            pathToDriver = "/usr/local/share/chromedriver";
        }
        System.setProperty("webdriver.chrome.driver", pathToDriver);
        REAL_DRIVER = new ChromeDriver();
    }

    else if(browserName.equals("phantomjs")) {
        String pathToDriver = System.getProperty("pathToDriver");
        if(pathToDriver == null) {
            pathToDriver = "/usr/local/share/phantomjs";
        }
        System.setProperty("webdriver.phantomjs.driver", pathToDriver);
        REAL_DRIVER = new PhantomJSDriver();
    }
..................


maandag 28 november 2016

Protractor icm WebStorm (Trial versie) direct Live proberen onder mijn Ubuntu image?


Protractor icm WebStorm (Trial versie) direct Live proberen onder mijn Ubuntu image?

Stappenplan:

  1. Installeer Virtual Box (gratis te downloaden)
  2. Download het volgende .7zip bestand en pak uit https://drive.google.com/file/d/0B-h5vCbyIOwjUTZOQWYyVE9lZ2M/view?usp=sharing
  3. Open het "Agile testingtools Testlab.vbox" bestand
  4. Start de image via Virtual Box
  5. Wachtwoord = Xebium
  6. Start WS (WebStorm) via de onderste knop aan de linkerkant in de menubalk
  7. Run de testen met de groene play knop.
Voor meer informatie:
en handige video:


dinsdag 1 november 2016

Cucumber Java icm Selenium in IntelliJ proberen?

Download hier dan mijn bijgewerkte Agile Testtool image:
https://drive.google.com/file/d/0B7wcjjWCUZECMzg4MUl0NTE1RzA/view?usp=sharing

1. Met bovenstaande link het .7zip bestand downloaden
2. Uitpakken
3. Laatste versie van Oracle Virtual Box downloaden (gratis) en installeren
4. Nu het volgende bestand openen: Agile Testtools Image with Cucumber FitNesse and Jenkins.vbox
5. wachtwoord = Xebium
6. Start IntelliJ (onderste icoon in de startbalk aan de linkerkant)
7. Zie dat het CucumberDemo project al geladen is vanuit GitHub.
8. Testen draaien door rechtermuisknop op het .feature bestand te doen en dan Run (play knop) te klikken.

donderdag 25 februari 2016

woensdag 2 september 2015

Voorbeeld van een Subway map in Visio

Voorbeeld van een Subway Map in Visio.

Onderstaande Subway map is geïnspireerd op een Subway Map uit de volgende presentatie van Anko Tijman:
http://www.slideshare.net/AnkoTijman/test-n-et-workshop-scaling-agilesubwaymap-final

Kennis opgedaan via AgileHubNoord meeting:
http://www.meetup.com/AgileHubNoord/events/223886206/


Voorbeeld Visio Subway Map bestand:
https://docs.google.com/uc?id=0BxQAVALI2GONLUpQV1RqUVh6NXgxV2d6Wlh3bVUyWDlaU0lR&export=download


dinsdag 7 oktober 2014

Nieuwe image beschikbaar van FitNesse Xebium met CMS Prestashop

En ja, daar is hij dan! De nieuwste versie van mijn FitNesse Xebium Sandbox image, maar nu met een CMS Prestashop om volledig lokaal te kunnen testen. Je bent met dit image dus niet meer afhankelijk van een werkende internet verbinding. Dit is erg handig als je bijvoorbeeld een demo of workshop wilt geven met dit image en geen beschikking hebt over een werkende internetverbinding.

Wat kun je verwachten van dit image:
- Ubuntu met werkende FireFox voor de Selenium Webdriver (Ubuntu dus zelf niet verder updaten!)
- Chromedriver om FitNesse Xebium testen tegen chrome te kunnen draaien
- Firebug met Firepath
- Selenium IDE binnen FireFox
- Eclipse met FitNesse add-on
- CMS PrestaShop geïnstalleerd binnen XAMPP
- Voorbeeld FitNesse Xebium testen (ook met gebruik van scenario's) voor PrestaShop
- Handleiding op de desktopachtergrond met instructies om bovenstaande te starten/stoppen.

Link:
https://app.box.com/s/fejef4c6ce5hawu6z4zz

Username: Xebium
Password: Xebium

Download zelf even de gratis VirtualBox client:
https://www.virtualbox.org/wiki/Downloads

Om deze image te kunnen draaien heb je minimaal 2GB vrij RAM geheugen nodig.





maandag 8 september 2014

FitNesse Xebium VirtualBox Ubuntu image now available!

Het heeft even geduurd, maar nu is er dan eindelijk een FitNesse Xebium VirtualBox Ubuntu image waar je zelf met FitNesse Xebium kunt spelen.

Er zijn Web testen te vinden die met Scenario's opgezet zijn tegen een externe site. Maar ook is er een voorbeeld te vinden dat je Xebium gebruikt tegen een eigen lokale testomgeving. Het starten hiervan (samen met het starten van FitNesse) zijn terug te vinden in de handleiding via een snelkoppeling op de desktopachtergrond.

Username: Xebium
Password: Xebium

Alle benodigde rar bestanden zijn hieronder te downloaden:
https://app.box.com/s/h72v45e9se0lsk87c2x1
Het zijn 365 rar bestanden van elk 10mb per stuk.

Na het uitpakken heb je een image van ongeveer 7,8 GB groot.

Download zelf even de gratis VirtualBox client:
https://www.virtualbox.org/wiki/Downloads

Om deze image te kunnen draaien heb je minimaal 2GB vrij RAM geheugen nodig.

Op dit moment werk ik nog aan een image waar ook een CMS op staat geïnstalleerd waar je ook artikelen mee kan zoeken. Dit een standaard PrestaShop CMS waar je gemakkelijk testen voor kunt maken met Xebium.

donderdag 29 augustus 2013

FitNesse Xebium met Webdriver (Selenium 2.33) icm FireFox 22 (en hoger) werkt niet!

Wanneer je testen wilt draaien met Xebium in FitNesse icm FireFox 22 (en hoger) gaat dit niet werken. Dit omdat de Webdriver met Selenium 2.33 geen FireFox 22 (en hoger) ondersteunt.


Bron:
http://grokbase.com/t/gg/selenium-developer-activity/13722mfjtk/issue-5869-in-selenium-unable-to-execute-javascript-with-webdriver-in-firefox-22

De workaround voor nu is om FireFox 21 te installeren:
http://www.filehippo.com/download_firefox/15056/


zondag 25 augustus 2013

Xebium Formatter "Work Around" voor de laatste versie van Selenium IDE

There is a workaround, that is creating your own formatter. You can do this as follows:

1. Open SeleniumIDE
2. Go to Options>Options select the Formats tab
3. Press the "Add" button
4. Now enter a name, i.e. Xebium Formatter
5. And past the content of the following file completely over the sample code in the format window:
6. Now press "Ok"
7. Completely close Selenium IDE and reopen
8. Now in Options>Format you can select the newly added format.

It is a bit of a hassle, but it is the current workaround.


woensdag 21 augustus 2013

FitNesse Xebium achter een proxy gebruiken

Om FitNesse Xebium achter een proxy via Maven te laten bouwen kun je onderstaande settings in settings.xml opnemen. Deze is te vinden onder je Maven map (bv: C:\apache-maven-3.1.0\conf)

In bovenstaand stuk kun je het proxy gedeelte uit het commentaar halen en je eigen proxy settings aangeven. Vaak is username en password niet noodzakelijk om aan te geven.

donderdag 25 juli 2013

FitNesse Xebium installeren

Ga naar de volgende URL:
Ik ben uitgegaan van de free download (zonder Git) van een FitNesse Xebium project.

Helaas zijn de in de handleiding de volgende stappen op te nemen:
- Er is een installatie (laatste) versie van Jave JDK (Java Development Kit) nodig
bijvoorbeeld:


Aan de hand van bovenstaande screenshot naar de omgevingsvariabelen gaan in Windows 7.

De volgende onderstaande dingen toevoegen als dit nog niet gedaan is:
Variabele JAVA HOME met Waarde C:\Program Files\Java\jdk1.7.0_25
Variabele PATH             met Waarde .;%JAVA_HOME%\bin;C:\Program Files\Java\jre7\bin;


- Maven is nodig, maar om Maven werkend te krijgen moet wel de handleiding die bij de download wordt meegegeven werkend gemaakt worden.
http://maven.apache.org/download.cgi (bv: apache-maven-3.1.0-bin.zip)

Installing Maven
  ----------------
  1) Unpack the archive where you would like to store the binaries, eg:
    Unix-based Operating Systems (Linux, Solaris and Mac OS X)
      tar zxvf apache-maven-3.x.y.tar.gz
    Windows 2000/XP
      unzip apache-maven-3.x.y.zip
  2) A directory called "apache-maven-3.x.y" will be created.
  3) Add the bin directory to your PATH, eg:
    Unix-based Operating Systems (Linux, Solaris and Mac OS X)
      export PATH=/usr/local/apache-maven-3.x.y/bin:$PATH
    Windows 2000/XP
      set PATH="c:\program files\apache-maven-3.x.y\bin";%PATH%
  4) Make sure JAVA_HOME is set to the location of your JDK
  5) Run "mvn --version" to verify that it is correctly installed.


De volgende onderstaande dingen toevoegen als dit nog niet gedaan is:
Variabele PATH               met Waarde ;c:\program files\apache-maven-3.x.y\bin;
Variabele M2_HOME      met Waarde ;c:\program files\apache-maven-3.x.y\bin;

- Om testen te laten draaien in Chrome en IE de volgende drivers downloaden en tevens PATH instellen:

De volgende onderstaande dingen toevoegen als dit nog niet gedaan is:
Variabele PATH              met Waarde ;C:\%PlaatsFitNesseXebiumProject%\Xebium\WebDrivers;