Few words on TestRail – A Great Test Case Management Tool

Few years ago, at a new job, we started our investigation on how to best organize numerous test cases that existed in the company. Tests were documented in spreadsheets, tracking was done manually through e-mail, status had to be requested from the leads and generally no one knew exactly what was being tested. We investigated all of the popular test case management tools. Most were complicated, requiring phone meetings with reps, sales intros before we had permission to test the tool and generally were not easy to understand.

TestRail seemed obvious from the start. We obtained a demo license within hours and had a full instance ready for our test. From the start it was obvious how to create projects, test suites, test cases, create releases and just about everything else. In two instances (during the demo period) we e-mailed for support, asking about specific features. Both e-mails were responded to within a day. We implemented the tool in the company and repopulated all of our tests within a few weeks. The test process improved dramatically. We could easily set up milestones, issue test suites to testers, track their progress in real time, manage different configurations, and all that with very minimal training of the testers. Writing new tests was easy. JIRA integration was simple but sufficient. In later stages with started populating automated test results through the API and that worked great as well.

I am not getting paid for this review. It is just a tool that works. It was $25 per user last time I checked (March 2014) and it is worth every penny. In the almost two years of use the hosted version never went down and was completely reliable. Everyone in the company knew at every point in time what is being tested, what the current status is, where the issues are and also look at pretty graphs. As a result, several important suggestions were made to improve the test bed resulting in better software.

Totally recommended for test case management and test execution tracking. There are a ton of other features that I did not even touch upon. Best to see that on their web site.

Official TestRail page.

Issue with building PhoneGap / Cordova Android app when bundle/widget id contains numbers

Tried building an Android app with PhoneGap / Cordova. It just kept failing and failing. The issue turned out to be in naming. I named the bundle/widget id as : com.cordova.Test0205 … Failed each time I built.

Then deleted that project and created a new one naming it as : com.cordova.Test
It worked like a charm. So there you go. No numbers in your ID.

This post on stackoverflow helped.

Create image with border and caption using Python script with a little help from Wand and ImageMagick

My goal was to create a script that generates images that have different sizes and colors, that have a definable border and variable image caption and file name. Simplified version is below. You can adjust to your own liking.

from wand.color import Color
from wand.image import Image
from wand.image import Font
import datetime
# directory for saving file
export_dir = "/tmp/images/generated/"
# get the date to add to caption and file name
today = datetime.date.today()
todaydate = today.strftime('%Y-%m-%d')
# some variables : these can be obtained from arrays, lists, anywhere
file_text = "deployment_test"
image_text = "Deployment Test"
image_width = 320
image_height = 200
font_size = 24
#function to create the image
def create_image_caption(widthsize,heightsize,backgroundcolor,borderwidth,bordercolor,image_caption,text_color,font_size):
    with Image(width=widthsize-2*borderwidth,height=heightsize-2*borderwidth,background=Color(backgroundcolor)) as image:
        image.border(Color(bordercolor),borderwidth,borderwidth)
        font=Font(path='/Library/Fonts/Verdana.ttf',size=font_size,color=Color(text_color))
        image.caption(image_caption,left=0,top=0,width=widthsize-10,height=heightsize-5,font=font,gravity='center')
        image.save(filename=export_dir+str(widthsize)+"x"+str(heightsize)+"_"+backgroundcolor+"_"+todaydate+"_"+file_text+".jpg")
# set the caption text
caption_text = str(image_width)+"x"+str(image_height)+"\n"+todaydate+"\n"+image_text
# create the image
create_image_caption(image_width,image_height,'green',1,'red',caption_text,'white',24)

Some explanations:

  • This worked for me with Python 2.7
  • The script depends on Wand : a ctypes-based simple ImageMagick binding for Python. Make sure to import wand
  • Set the export dir to your desired value
  • image width/height, file text and image text are just some variables I set, choose and define your own as desired
  • create_image_caption is the function that creates the image. It contains:
    • image.border(Color(bordercolor),borderwidth,borderwidth) : that creates the image with the border
    • font=Font(path=’/Library/Fonts/Verdana.ttf’,size=font_size,color=Color(text_color)) : specifies the font and its location, note that the directory I used is for a MAC
    • image.caption(image_caption,left=0,top=0,width=widthsize-10,height=heightsize-5,font=font,gravity=’center’) : sets the caption location and text
    • image.save(filename=export_dir+str(widthsize)+”x”+str(heightsize)+”_”+backgroundcolor+”_”+todaydate+”_”+file_text+”.jpg”) : specifies where to save the image and what to name it
  • caption_text = str(image_width)+”x”+str(image_height)+”\n”+todaydate+”\n”+image_text : just concatenates the string to show as caption
  • create_image_caption(image_width,image_height,’green’,1,’red’,caption_text,’white’,24) : this line calls the function with all the desired variables
  • Run and have fun
  • In the script that I use on a regular basis, image sizes, colors, caption text and such are dynamically inserted so after running it I have 40-50 images ready for various testing purposes. When someone uses them, it is obvious when they were created, their size and for what purpose (ie deployment test)

Spoon for testing multiple Android devices and result reporting -> awesome

I have been trying out the Espresso API for Android testing. It did not take too long to set up and run first tests. Still investigating. I will post some notes and comments later.

While trying out Espresso I found in one of Google’s forums mention of Spoon, so naturally, I decided to give it a try. As the first paragraph on the web site states (copy/paste):

Android’s ever-expanding ecosystem of devices creates a unique challenge to testing applications. Spoon aims to simplify this task by distributing instrumentation test execution and displaying the results in a meaningful way.

Here is how I tried it out.

  • I already had a simple Espresso test project that would open my app, click on a few buttons and then verify some text
  • Downloaded spoon-client-1.1.0.jar and placed it in my /libs folder for the Espresso test project.
  • Imported Spoon :
    import com.squareup.spoon.Spoon;
  • Per instructions from the web site surrounded one of my test cases with the screenshot activity
    Spoon.screenshot(activity, "initial_state");
    /* Normal test code... */
    Spoon.screenshot(activity, "after_login");
  • Built the Espresso test project.
  • Downloaded spoon-runner-1.1.0-jar-with-dependencies.jar
  • Hooked up several Android devices to my computer. Checked that adb recognized all
    adb devices
  • Executed the test :
    java -jar spoon-runner-1.1.0-jar-with-dependencies.jar --apk /path/to/my_amazing_app.apk --test-apk /path/to/EspressoTest_for_my_amazing_app.apk
  • Tests ran successfully.
  • Now accessed the /spoon-output/ folder from the location where I executed the test. Viewed the /spoon-output/index.html file. The beautiful summary appeared there. Clicking on the various device results provided more information including the screenshots. They can be viewed as animated gifs to show you the flow (whut, that’s amazing?)
  • Later created some tests that would fail and all worked rather well, the failures were in red, pass in green.
  • Not too much effort to set up but awesome benefit. I will use Spoon regularly. It is Licensed under the Apache License.

MonkeyTalk not working with Android 4.4 KitKat

Tried to execute some automation and realized this. Getting errors of type:

E/AndroidRuntime(13246):        at com.gorillalogic.fonemonkey.web.WebChromeClientWrapper.<init>(WebChromeClientWrapper.java:80)

Of course, others have already run into this much before me per this forum post: https://www.cloudmonkeymobile.com/content/crashing-application-while-login-kitkat-android?page=0

Have to wait for the next Beta per comment from the forum post : Just wanted to provide an update on this bug report. We’ve committed a fix and it will be a part of the next MonkeyTalk beta release.

MonkeyTalk testing with Android : Some initial notes and lessons learned

Some issues ran into while setting up MonkeyTalk

  • Almost immediately I realized that the basic commands provided by the MonkeyTalk UI and the .mt file would not be enough and that I would have to use JavaScript. That was OK by me as I have basic knowledge of JavaScript. IF you want conditions, variables etc. you might as well start immediately with JavaScript
  • If you would like to use a javascript script for your test, you must first create a MonkeyTalk script with .mt extension, then Export and then when you edit it, you can execute those tests. When you set up the .mt file, it creates proper include links in the libs.
  • conditional “if” in javascript is best handled with try and catch like this. I’ve been successful at nesting them too :
try
{
app.label("#24").verifyWildcard("*Setup: Start*");
app.device().screenshot();
app.button("Next").tap();
}
// if text "Setup: Start" is not in label 24, go on without stopping test
catch(e)
{
app.device().screenshot();
// now check if label 15 contains "Alert"
try
{
app.label("#15").verifyWildcard("*Alert*");
app.button("Next").tap();
}
// finally do this
catch(e)
{
app.button("Next").tap();
}
}
  • Component Tree is essential. Add it to your view, found in Other when adding views. Then when the device is connected to the view you want to automate click to refresh the Component Tree. There you can find all the IDs that you need
  • Good way to check text on your page is with wildcards. You don’t have to match the string exactly (at least for your initial attempts at learning):
app.label("#15").verifyWildcard("*Alert*");
  • Seems like the app.device().back(); command on Android has issues as of now (Dec 2013). It does not execute the same as on the device. Device returns to the previous view, MonkeyTalk returns view to Android Home page. Workaround is to use adb through Shell Exec. I had to enter full path to adb for it to work, something like this:
var adb_path = "/home/tester/android-sdk/platform-tools/adb"
app.system().exec(adb_path, "shell", "input", "keyevent", "4");
  • It is a good idea to check your main functions through a .mt file. Try out how the default function works with your device/view, then view in the JavaScript tab to learn of the proper Javascript notation. The feature to “Play Row” or “Play Rows” is awesome for troubleshooting/debugging.

Displaying advertising identifier value in iOS app (XCode 5)

Needed to display advertising identifier within a simple one page app.
Here are the items I added to include this value. This was in Xcode 5.

File : BlahViewController.m

label

@property (weak, nonatomic) IBOutlet UILabel *advertisingIdentifierval;

on load

- (void)viewDidLoad
{
[super viewDidLoad];
self.advertisingIdentifierval.text = [self getadvertisingIdentifierval];
}

get the actual string

- (NSString *)getadvertisingIdentifierval {
NSString *advertisingIdentifierval = [[ASIdentifierManager sharedManager].advertisingIdentifier UUIDString];
return advertisingIdentifierval;
}

File : BlahViewController.h

import necessary class

#import <AdSupport/ASIdentifierManager.h>

File : BlahViewController.xib

Created label to show the advId using the UI label tools.
Connected referencing outlet (Ctrl + drag):
advertisingIdentifierval to File’s Owner

Built and voila … it shows up in my simple app.

Scroll list with keys ARROW_DOWN to a visible element (Selenium, Python)

This issue comes up often. You want to select a value in a dropdown list, but when you click to show the values only the first several are listed, others are hidden (so to speak) and need to be scrolled to. You cannot click the selection if it’s not visible. Here is a way to scroll down to the desired value.

Import the keys module

from selenium.webdriver.common.keys import Keys

Click on the dropdown to show the initial values

self.driver.find_element_by_css_selector(".list_dropdown_class").click()

Now send some ARROW_DOWN keys to the ul element in question until your desired selection is visible

self.driver.find_element_by_css_selector("ul.list-with-results").send_keys(Keys.ARROW_DOWN)
self.driver.find_element_by_css_selector("ul.list-with-results").send_keys(Keys.ARROW_DOWN)
self.driver.find_element_by_css_selector("ul.list-with-results").send_keys(Keys.ARROW_DOWN)

Now select it and click it

self.driver.find_element_by_css_selector("li#SelectedList_21").click()

This is not the most elegant solution, but it does somewhat mimic what an end user would do, scroll down to the selection.

how to focus on page element : Python Selenium Webdriver

Had some trouble focusing on an element. When selecting an option from dropdown menu, page kept scrolling to bottom.
Did not find a good explanation online. Here is what worked for me

Find the element you want to focus on (in my case link text was : Welcome Everyone) and then send NULL key to that element.

self.driver.find_element_by_link_text("Welcome Everyone").send_keys(Keys.NULL)

If you will be using this solution do not forget to import the Keys module

from selenium.webdriver.common.keys import Keys

helped by this post on stackoverflow.com