Thursday, March 19, 2015

Example to execute RobotFramework test cases using maven plugin

I spent some time using maven plugin to run the RobotFramework tests. It is OK, run as expected.
But I feel it is a kind of restrictive.

Here I post my one maven pom.xml example.

For details, please check my github source code:
1. https://github.com/stevez/robotframework-maven-plugin-example
2. https://github.com/stevez/robotframework-java-keyword


pom.xml

Execute RobotFramework test cases using Gradle script


I did some research for RobotFramework using maven plugin. But I don't like it. it is too restrictive.Today I tried to implement a Gradle script, it is working, surprising easy.  Here is the code sample.

For details please refer my github repository.

build.gradle

Saturday, February 7, 2015

Run soapUI project using ANT script



Following is the sample ANT script to run soapUI project. To run it, you need to copy all the jar files from soapUI installation folder and also add soapUI-xxx.jar from bin folder, and put them in the lib folder and add it to ant classpath.

This ant script support:
1. you can run test by specifying the paramters like suite name, url, user name, password etc.
2. by default it will run all the test cases in the project.
3. it will generate JUnit compatible report.

Please refer my github reporitory for the whole sample code.

<project name="WS-Test"  default="test" >
<property file="build.properties"/>
<property name="test.dir" value="test-results"/>
<property name="project.dir" location="project"/>

<target name="clean">
       <delete dir="${test.dir}"/>
    </target>

<target name="init">
      <mkdir dir="${test.dir}"/>
    </target>

<target name="test-with-properties" depends="init">
<java classname="com.eviware.soapui.tools.SoapUITestCaseRunner" errorproperty="tests-failed" fork="yes" dir="${test.dir}">
 <arg line="-j -M -r -a -f${basedir}/${test.dir}"/>
 <arg value="-e${wsdl.url}"/>
 <arg value="-s${soapui.testsuite}"/>
 <arg value="${project.dir}/${soapui.project}"/>
 <arg value="-x${user.name}"/>
 <arg value="-x${user.password}"/>
 <classpath>
<fileset dir="lib" includes="*.jar"/>
 </classpath>
</java>
</target>

<target name="test" depends="init">
<java classname="com.eviware.soapui.tools.SoapUITestCaseRunner" errorproperty="tests-failed" fork="yes" dir="${test.dir}">
 <arg line="-j -M -r -a -f${basedir}/${test.dir}"/>
 <arg value="${project.dir}/${soapui.project}"/>
 <classpath>
<fileset dir="lib" includes="*.jar"/>
 </classpath>
</java>
</target>

<target name="test-single-project" depends="init">
<antcall target="run-single-test">
 <param name="project" value="${project.dir}/${soapui.project}"/>
</antcall>
</target>

<target name="run-single-test">
   <java classname="com.eviware.soapui.tools.SoapUITestCaseRunner" errorproperty="tests-failed" fork="yes" dir="${test.dir}">
 <arg line="-j -M -r -a -f${basedir}/${test.dir}"/>
 <arg value="${project}"/>
 <classpath>
<fileset dir="lib" includes="*.jar"/>
 </classpath>
</java>
</target>


<target name="report">
<junitreport todir="${test.dir}">
 <fileset dir="${test.dir}">
<include name="TEST-*.xml"/>
 </fileset>
 <report format="frames" todir="${test.dir}/reports/html"/>
</junitreport>
    </target>


</project>



Tuesday, February 3, 2015

RobotFramework tools installation guide

I used RobotFramework for more than half a year, I really love it.
Now I shared my installation guide.

Hope this will be helpful for any  Developers who are interested in RobotFramework, but don't have Python experiences.

Set up Robot framework Tool Chai

1. Install python
   download python 2.7.6
   https://www.python.org/downloads/

 add the python installation folder to the windows PATH environment variable, for example
   C:\dev_software\Python27;
 
2. Install pip
    http://pip.readthedocs.org/en/latest/installing.html
   download get-pip.py via https://bootstrap.pypa.io/get-pip.py
   open a command window via "run as admin", type:
   python get-pip.py

   Add following into windows PATH environment variable:
   C:\dev_software\Python27\Scripts;

 
3. Install robot framework
   pip install robotframework
 
4. Install selenium2library
   pip install robotframework-selenium2library
 

5. Install RIDE

  install wxPython  wxPython 2.8.12.1
    http://sourceforge.net/projects/wxpython/files/wxPython/2.8.12.1/wxPython2.8-win32-unicode-2.8.12.1-py27.exe/download
             
  install through windows ride package win32 version
   https://code.google.com/p/robotframework-ride/downloads/detail?name=robotframework-ride-1.2.3.win32.exe
 
  Or install using pip
   pip install robotframework-ride
 
6. Install selenium webdriver client

   chrome driver: http://chromedriver.storage.googleapis.com/2.10/chromedriver_win32.zip

   IE driver
    http://selenium-release.storage.googleapis.com/2.42/IEDriverServer_Win32_2.42.0.zip
             
unzip them and copy the exe files in c:\webdriver directory
set them to windows path

    C:\dev_software\webdriver
             
               

7. Test
   run pip list, then you should see following:

decorator (3.4.0)
docutils (0.11)
pip (1.5.6)
robotframework (2.8.5)
robotframework-ride (1.3)
robotframework-selenium2library (1.5.0)
selenium (2.42.1)
setuptools (5.1)
 
- open dos command, type
  pybot

  then it will shows:
  [ ERROR ] Expected at least 1 argument, got 0.
  Try --help for usage information.


Documents:
- RobotFramework installation doc
  https://code.google.com/p/robotframework/wiki/Installation#Python_package_managers

- RobotFramework Selenium2Library installation guide
  https://github.com/rtomac/robotframework-selenium2library

- RIDE installation instructions:
  https://github.com/robotframework/RIDE/wiki/Installation-Instructions

- selenium2library keywords doc
  http://rtomac.github.io/robotframework-selenium2library/doc/Selenium2Library.html  

Thursday, July 10, 2014

Using Groovy MarkupBuilder to generate XML Declaration and DOCTYPE

I found Groovy MarkupBuilder can also generate xml declaraion and doctype, with the help of groovy.xml.MarkupBuilderHelper class. Following is the example

def sw = new StringWriter()
def xml = new groovy.xml.MarkupBuilder(sw)

def helper = new groovy.xml.MarkupBuilderHelper(xml)
helper.xmlDeclaration([version:'1.0', encoding:'UTF-8', standalone:'no'])
helper.yieldUnescaped """<!DOCTYPE note SYSTEM "note.dtd">
"""

xml.person{
  firstname("Steve")
  lastname("Zhang")
  country("Canada")
  city("Toronto")
}

println sw.toString()


And the result:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE note SYSTEM "note.dtd">
<person>
  <firstname>Steve</firstname>
  <lastname>Zhang</lastname>
  <country>Canada</country>
  <city>Toronto</city>
</person>

Saturday, November 2, 2013

Crazy English - My Toastmaster CC #4 speech

I finally finished my CC#4 speech this week. It is almost been a year since my last speech, I feel a kind of awkward.
Actually last week I went to my mentor Robert Fox's club in Richmond Hill did the exact same speech, so this is my second time,
Doing a speech in the second time is a kind of weird feeling.

My speech is about my experiences of learning English, and I got many positive feedbacks, the audiences seemed like my speech, especially I put some humour.
I realized my main problem is the pace, I spoke too fast, need to slow down, need to add more pause. I am not sure if it is because I practiced too much. And when I looked my video, I realized I have so many unnecessary movements,I definitely need to work on it.

Following is the script of my CC#4 speech.


Crazy English

"If you like him, let him learn English, because it is heaven; if you hate him, let him learn English, because it is hell."
Learning English for me is more like going to the hell.

Mr toastmaster, fellow toastmaster and welcome guests, I would like to share my crazy English learning experiences.

I came from China, English is my second language. I started learning English at the age of 9, until I graduated from university when I was 22. After I graduated, I found I got an issue - we call it 'dumb English', it means I could read in English, but I couldn't speak. The reason is we focused more on 'learning' instead of 'practicing'. We had a crazy environment: on one hand, We don't have enough good English teachers, we don't have enough chance to practice speaking, we just focused on grammar, vocabulary,grammar and reading; on the other hand, the whole country is so crazy about the English, not because it is useful in daily life, but because the students have to deal with lots of English tests: when we go to university, when we get degree and when we apply for jobs. So the main reason of learning English is to pass the tests, there is no more time to improve our real English skills.

One of the craziest test I ever had is TOEFL test. TOEFL stands for 'test of English as a foreign language'. It is very popular for the Chinese students, because this is the test you have to pass if English is your second language and you want to apply for an university in North America. To prepare my TOEFL test, I went to an English school in Beijing, That schools is famous for improving your TOEFL score in a short time. they didn't teach your the real English skills, instead they gave your tips. Those tips will help you provide the correct answer even if you don't fully understand the question.For example: in listening part, when you heard a conversation between a boy student and a girl student, the correct answer would be always the girl is better than the boy, because in TOEFL test, the girls are always smarter, working harder, keep the rooms cleaner; while the boys are always silly, lazy and make their room messy.I learned lots of this kind of tips, the thing is to master those tips, I have to do large amount of exercises, I finished 30 - 40 hour audio tapes within 3 months. Unfortunately those tips are useless in reality.

TOEFL didn't help me, I have to try another way: I remembered that was one day in 2001, by chance I heard of an approach, it was so simple but really hard - I called it crazy dictation: when you listen to an article, try to write down every word you heard, leave the blank if you don't know, then repeat listening again and again, until you fill all the blanks. After I gave a try, I realize this is the right way for me, since those blanks gave me the real feedback, once I solved them, then they became my real improvements, no cheating any more. Since then I started the dictation, I listened for 2 years, everyday I spent 2 hours at least. I really enjoy the learning process, because every day I could see my listening skills improving. The dictation was really fun, since when I finally figured out a word after I listened to it for 10 times,15 times and even more, I felt like solving a puzzle game. After 2 years, I finished 20 hours audio tapes. The dictation gave me the break thorough, both my listening and speaking skills got improved, I became more confident, I felt finally I climbed out of the English hell.

This is my crazy stories of learning English, what I learned from it would be follow the basic, step by step, and be patient, working slowly will actually makes you faster. Now I face another challenge - my Toastmaster cc manual! I am going to attack this challenge by using these principles, I hope this time it will lead me to the heaven.
 
Mr. toastmaster.

Saturday, July 27, 2013

Building my Raspberry Pi - Hardware part

I've been working on my Raspberry Pi for 3 months, I got the Model B board from my former colleague Yuriy as a gift when I left the company, I really appreciate Yuriy give me a chance to play with this tiny toy.
Now I will share the hardware I used to build my raspberry Pi.

1. Wifi Adapter, Edimax 150Mpbs
 
It works perfectly in my Raspberry Pi,no driver installation needed, the only thing I would complain is it only support 2.4G, no support for 5.8G

2. Keyborad/mouse, Logitech mk360 combo,
 I bought it from costco for $30, no driver needed, works by just pluggin in.

3. Cable
   I bought this HDMI to DVI adapter on amazon.ca for less than $2.
4. SDcard
   I used my old Sandisk Ultra II 4.0GB, I think it is class 4, and a Trascend 8.0GB class 10 for using raspbmc media center

5. Case, I bought  it from Sayal

   I like the design, transparent, the thing is once you installed your Raspberry Pi board, it is hard to take out. Besides that no complain.

6. Power adapter
   Following works:
   LG phone power adapter, Samsung Note II power adapter, and Kindle power adapter.

7. Display
   I used Samsung LCD 22-inch (DVI) and 24-inch B2430, both works perfectly.

8. Blue tooth adapter, IOGEAR GBU521

   It works on Raspberry Pi, and could pair with my mac wireless keyboard and mouse, but it takes long process to install the bluetooth package, and I seldom use it
any more, I would not recommend it.

Totally I spent another $50 - $70 to build this tiny computer, it is still a lot cheaper than building a regular one. I really love this toy.