Dieses Blog durchsuchen

Mittwoch, 3. August 2016

ubuntu: install phpunit

This i an easy task:

open up terminal:

$ wget https://phar.phpunit.de/phpunit.phar

$ chmod +x phpunit.phar

$ mv phpunit.phar /usr/local/bin/phpunit
 
 
After that phpunit is available on your terminal. 

composer: install and add it permanently to console on ubuntu 16.04

We want to download and install composer, so that it is available on your terminal permanently

If you do not have curl installed
apt-get install curl
 
Copy folling commands to your terminal for the current user
This installs composer  and adds it to the users bashrc

thats it!

Now composer works everywhere on your console
- open console and type:
composer


Create a selenium browsertest with java in eclipse

Now we want to create our first simple automated selenium test with java and eclipse.

For that we need selenium server , java and eclipse running on our machine.

If you do not have the prerequisits installed, you can follow this tutorials.

http://magento2-tuts.blogspot.de/2016/08/install-selenium-rc-server-2-3-on.html

We want to use chrome as testing browser. So you need to have chrome on your machine.


Okay lets start:
 1) create a new javaproject in eclipse
- start eclipse
- select new -> java project
- give it a name. For instance: "selenium test"
- just let the configuration in default and click finish

3) include the selenium server jar to the main library sources.
- Rightclick on your project. Choose Properties->Java Build Path

Here you choose "external library" from the tab and search your selenium server jar.




If you do not have one, you can dowload Selenium Standalone Server here:
http://www.seleniumhq.org/download/

Click apply and the server is added to your external library folder.


Now we can start writing our first testcase

- Rightclick on src and add a new class.

- Set it up like that


Configure a chrome webdriver
At next we have to tell our test which driver we want to use. We want to use chrome as a webrowser. So we have to install the chrome webdriver

Download chrome webdriver.
- http://chromedriver.storage.googleapis.com/index.html?path=2.22/
- move the zip to /usr/bin/selenium
- unzip the package there.
- after that you have an executable file under /usr/bin/selenium/chromedriver

 Write a first testclass

Back to your eclipse ide you find your javaclass "googleSearch". In that class you now import the chromedriver and tell the code to use it.
This is my class:


As you can see, we just import the webdriver class and the chromedriver class.
After that we tell the class to set a systemvariable to the chromedriver and reference an object from type chromedriver to a local variable "driver"


If you now run the program, chrome should start up with an empty page.

Conratulation. You have your selenium server running and you are able to drive now,

Create a more complex test
At next we want to start a test which opens google and searches for a text typed in th searchfield.


The Testtasks are:

- define browser
- get a driver
- open "http://google.com"
- type in "magentotuts"
- click enter
- printout the pagetitle.

This is a very simple test, but it shows, how to automate the pageclicks.


Thats it ! Feel free to have fun with it.



Install selenium rc server 2, 3 as a service on ubuntu 16.04

Hi ,

Today we want to install java, eclipse  and selenium server rc 3 on ubuntu 16.04 to have a small testenviroment to test our applications in different browsers.

At fisr we need the openjdk 8 and the server application


1) openjdk-8-jdk
 follow this tutorial:
http://magento2-tuts.blogspot.de/2016/08/ubuntu-1604-istall-openjdk-8.html

2) eclipse
follow this tutorial:
http://magento2-tuts.blogspot.de/2016/08/install-eclipse-on-ubuntu-1604.html


3) download Seleniumserver rc (remote control)
http://www.seleniumhq.org/download/
my current version is selenium-server-standalone-3.0.0-beta2.jar

3.2 create a folder:
/usr/lib/selenium
/var/log/selenium
chmod a+x /var/log/selenium

3.3 move downloaded server jar to
/usr/lib/selenium


3.3 install selenium as a service
save following shell script to:
 


Add startscript to runlevel, to start on reboot
$ update-rc.d selenium defaults

Configure a chrome webdriver
We want to use chrome as the standard webdriver.

Download chrome webdriver.
- http://chromedriver.storage.googleapis.com/index.html?path=2.22/
- move the zip to /usr/bin/selenium
- unzip the package there.
- after that you have an executable file under /usr/bin/selenium/chromedriver





$ mkdir -p /var/log/selenium
$ touch /var/log/selenium/selenium-output.log

type:
/etc/init.d/selenium start


Thats. It.

In the next tutorial we want to use java, eclipse and selenium ide to create our first automated browsertests.

create first seleniumtest in java with eclipse

If you want to use firefox as testbrowser, you have to download and install webdriver.gecko.driver from:
https://github.com/mozilla/geckodriver/releases 
- move the zip to /usr/bin/selenium
- unzip the package there.
- after that you have an executable file under /usr/bin/selenium/geckodriver










Install Eclipse on ubuntu 16.04

On ubuntu 16 eclipe comes with an installer.  

1) Download Eclipse from here: 
http://www.eclipse.org/downloads/

if you do not have the openjdk-8 installed, open a terminal an type:
sudo apt-get install openjdk-8-jdk

2) change to your download directory wher you have downloaded eclipse and unpack it

3) run the installer on the terminal:
./eclipse-inst

After that you have to decide which type of a programmer you are.
I decided to be  java developer.

4) Choose the path where you want to install eclipse.
I have choosen /usr/local/bin/eclipse 

5) Accept the disclaimer

6) Accept the next packagedisclaimer by selecting the small checkbox on the left in the upper window and press okay.

7) Get a cup of coffee. 

8) Now you can "launch" eclipse 

9) After that you are asked to choose a workspace folder:
- I have choosen /home/<myuser>/Documents/eclipse



Thats it. Eclipse will run an you can start working

Ubuntu 16.04 install openjdk-8

On ubuntu 16.04 the openjdk-8 is available directly in the apt repoository.

open up a terminal and type: 
sudo apt-get install openjdk-8-jdk Thats it!

Dienstag, 2. August 2016

Mobile first gridlayouts with twitter boostrap 3

Today we want to play a little with mobile first grid layouts.

Noone wants to create a website in more than 1 version for different devices. Since twitter 3 moves its default "fixed width" behaviour to "mobile first", all new layouts are using the fluid grid version. So you can use your layout on different devices like mobile, tablet, desktop and even cellphones.

So lets start:

At first we have to include the bootstrap (3.7.x) library.  I m using cdn, to make it simple. In reality you want to require or import it, or use grunt or gulp as a dependency manager.

This is my html file "2_column_grid.html". I am using vs code to generate it.



This simple grid renders 2 Boxes with the 6 columns (col-sm-6). That means, that each box takes the half of the windowwitdh. 100 % are 12 columns. So 12 / 6 = 2. If you want to have 4 boxes you have user 3 columns. (col-sm3) and so on.



Okay.Now we want to create a 4 column layout for medium screens with a resolution > 990 pixels (Laptops / Desktops)


Now we want to create a 3 column layout, that will turn to a 2 column layout if the screen gets smaller.