Pinscher Testing

“How can I best get up the mountain?” – Just climb upwards, and don’t think about it! Friedrich Nietzsche

Spoon – distributing instrumentation tests to all your Androids

We have talked and written about Relish, here Relish – Living documentation instead in this article we analyze together Spoon, a distributing instrumentation tests to all your Androids.

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.

Using the application APK and instrumentation APK, Spoon runs the tests on multiple devices simultaneously. Once all tests have completed, a static HTML summary is generated with detailed information about each device and test. With the high-level output you can immediately see whether or not a test failure is specific to a single device or all devices. This view is designed to be displayed on a dedicated monitor or TV. Spoon will run on all targets which are visible to adb devices. Plug in multiple different phones and tablets, start different configurations of emulators, or use some combination of both!

In addition to simply running instrumentation tests, Spoon has the ability to snap screenshots at key points during your tests which are then included in the output. This allows for visual inspection of test executions across different devices. Taking screenshots requires that you include the spoon-client JAR in your instrumentation app.

Spoon Site
 
Spoon Quick Start Guide

1. export PATH=/Users/pinschertesting/Library/Android/sdk/platform-tools/:/Users/pinschertesting/Library/Android/sdk/tools/:$PATH

2. java -jar spoon-runner-1.3.2-jar-with-dependencies.jar
The following options are required:
–test-apk
–apk

Usage:

[options]
Options:
–adb-timeout – Set maximum execution time per test in seconds (10min default); Default: 600
–apk – Application APK
–class-name – Test class name to run (fully-qualified)
–e – Arguments to pass to the Instrumentation Runner. This can be used
multiple times for multiple entries. Usage: –e =.
–fail-if-no-device-connected – Fail if no device is connected; Default: false
–fail-on-failure – Non-zero exit code on failure; Default: false
–init-script – Script file executed between each devices
–method-name – Test method name to run (must also use –class-name)
–no-animations – Disable animated gif generation; Default: false
–output – Output path; Default: spoon-output
–sdk – Path to Android SDK
–sequential – Execute tests sequentially (one device at a time); Default: false
–size – Only run methods with corresponding size annotation (small, medium,
large)
–test-apk – Test application APK
–title – Execution title; Default: Spoon Execution
–serial – Serial of the device to use (May be used multiple times) – Default: []

Run example:
java -jar spoon-runner-1.3.2-jar-with-dependencies.jar –apk /Users/pinschertesting/Documents/android-feature-signup/app/build/outputs/apk/app-debug.apk –test-apk /Users/pinschertesting/Documents/android-feature-signup/app/build/outputs/apk/app-debug-androidTest-unaligned.apk –sdk /Users/pinschertesting/Library/Android/sdk/

share me!:))Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone
Print this page

Relish – Living documentation

Relish helps your team get the most from Behaviour Driven Development (BDD). Publish, browse, search, and organize your Cucumber features on the web.

Relish’s benefits are:

  • Documentation that works – Gorgeous, trustworthy, living documentation from your executable Cucumber or Specflow features.
  • Find anything fast – Fast, comprehensive search index of all your projects’ documentation.
  • Safe and sound – Private projects, SSL as standard.
  • Read it how you like – Print it, create a beautiful PDF* or browse on the web.
  • See the bigger picture – Organize your acceptance tests to read like a traditional specification document. Customise navigation. Add markdown pages.
  • Stay up to date – Track progress with RSS or email summaries of changes*.

*coming soon

Relish Site

Relish Pro – plans and pricing

 

Relish Quick Start Guide
Publishing is done from the command-line, using the relish gem.
Install the gem:
gem install relish

Create a project:
relish projects:add my-best-project

or, if you want a private project:
relish projects:add my-secret-project:private

Write some documentation, by adding some markdown or Cucumber feature files in the features directory.
Push the documentation to Relish:
relish push my-best-project

Go and admire your features at http://relishapp.com/`username`/my-best-project

 

Available Commands
relish

collab # list the collaborators for a project

collab:add : # add a collaborator to a project – example: relish

collab:add rspec/rspec-core:justin

collab:remove : # remove a collaborator from a project – example: relish
collab:remove rspec/rspec-core:justin

config # display the contents of your options file

config:add

help # show this usage

projects # list your projects

projects:add / # add a project – append :private to make the project private – example: relish projects:add rspec/rspec-core:private

projects:remove # remove a project

projects:visibility : # set the status of a project – example: relish projects:visibility rspec/rspec-core:private

projects:rename : # rename a project’s handle – example: relish projects:rename rspec/rspec-core:rspec-corez

push : [path ] # push features to a project – is optional – is optional (defaults to ./features) – example: relish push rspec/rspec-core – example: relish push rspec/rspec-core:2.0

push:publisher # push markdown files to a publisher – example: relish push:publisher rspec

versions # list the versions for a project

versions:add : # add a version to a project – example: relish versions:add rspec/rspec-core:2.0

versions:remove : # remove a version from a project – example: relish versions:remove rspec/rspec-core:2.0
 

share me!:))Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone
Print this page

SoapUI and Groovy Scripting (second part)

The first part is here: SoapUI and Groovy Scripting (first part)

Modify an item for obtain for example an Error from Response

import groovy.json.JsonSlurper
import groovy.json.JsonOutput

def response = testRunner.testCase.getTestStepByName("/cart/{id}").getPropertyValue("response")
jsonSlurperResponse = new JsonSlurper().parseText(response)

if(jsonSlurperResponse.cartItems[1] != null) {
	
	def idDevice = jsonSlurperResponse.cartItems[1].id
	def request = '''
	{
	   	"context":    {
	     	"cartid": null,
	      	"flowid": null,
	      	"id": "defaultSessionContextId",
	      	"userid": "pinscherTesting"
		},
		"cartItems":
		[
			{"cartItemId":"","quantity":"6"}
		]
	} '''
	
	def jsonSlurperRequest = new JsonSlurper().parseText(request)
	jsonSlurperRequest.cartItems[0].cartItemId = idDevice
	def conv = JsonOutput.toJson(jsonSlurperRequest)
	def restRequest = testRunner.testCase.getTestStepByName('/cart/{id}/modify');
	restRequest.setPropertyValue('Request',conv);
} 

Insert a new item at the end of a json Response

def slurperNewDevice = new JsonSlurper().parseText(newDevice)
def slurperNewDeviceToKeep = new JsonSlurper().parseText(newDeviceToKeep)
def slurperResponse = new JsonSlurper().parseText(takeResponse)

slurperResponse << slurperNewDevice //add new device to list of device
slurperResponse << slurperNewDeviceToKeep
def map = ["devices":slurperResponse]
def deviceList  = JsonOutput.toJson(map)

def restRequest = testRunner.testCase.getTestStepByName("Create New Device")
restRequest.setPropertyValue('Request', deviceList)

Takes code from Response and set it like parameter in next Request

def String pinTmp = testRunner.testCase.getTestStepByName("/login").httpRequest.response.responseHeaders["pinscher-variable"]
def String[] pinSplit = pinTmp.split('\\[')
def String[] pinSplit2 = pinSplit[1].split('\\]')
def String pin = pinSplit2[0]

testRunner.testCase.testSteps["/verify"].setPropertyValue("pinscher-variable", pin)

Replace an element and send it

def String pinErrato = pin.replaceAll("J9fQ","X8hW")
testRunner.testCase.testSteps["/verify-wrong"].setPropertyValue("pinscher-variable", pinErrato)

Takes value of variables from Data Source (and DataSource Loop after Request)

import groovy.json.*
import java.lang.Object

def cvv = context.expand( '${DataSource#cvv}' )
def emailOwner = context.expand( '${DataSource#emailOwner}' )
def expirationDate = context.expand( '${DataSource#expirationDate}' )
def firstName = context.expand( '${DataSource#firstName}' )
def lastName = context.expand( '${DataSource#lastName}' )
def pan = context.expand( '${DataSource#pan}' )

slurperNewCreditCard.creditCardData.cvv = cvv
slurperNewCreditCard.creditCardData.emailOwner = emailOwner
slurperNewCreditCard.creditCardData.expirationDate = expirationDate.toLong()
slurperNewCreditCard.creditCardData.firstName = firstName
slurperNewCreditCard.creditCardData.lastName = lastName
slurperNewCreditCard.creditCardData.pan = pan

def jsonObject = JsonOutput.toJson(slurperNewCreditCard)
log.info(jsonObject)

def restRequest = testRunner.testCase.getTestStepByName("POST")
restRequest.setPropertyValue("Request", jsonObject)
testRunner.runTestStepByName("POST")

Function get time

def timestamp = new java.util.Date().getTime()

Replace function and conversion to BigDecimal

"price":priceDevice[i].replace(",",".").toBigDecimal()

Conversion to Integer

"quantity":quantityDevice[i].toInteger()

Create a map – A map is a collection of (key, value) pairs

def map = ["id":null, "products":slurperPinscherProducts]
def listPinscherProducts  = JsonOutput.toJson(map)

Forced Assert True and False

if ( buyerName_beforePatch != buyerName_afterPatch ) {
	log.info "Different values -> test OK."
	assert true
} else {
	log.info "Same values -> test KO."
	assert false
}

Conversions date to timestamp

def date = new Date()
lastUpdateBefore_value = date.parse('dd/MM/yyyy mm:ss', '04/10/2016 02:00')
log.info( "date read: ${lastUpdateBefore_value}" )
def lastUpdateBefore_valueTimestamp = lastUpdateBefore_value.time.toString()
log.info( "timestamp: ${lastUpdateBefore_valueTimestamp}" )

Checks values in Response

import groovy.json.JsonSlurper

def values = context.expand( '${Request the list of items of the catalogue#Response#$[\'values\']}' )
def slurperProducts = new JsonSlurper().parseText(products)
def Integer i
def String[] productTypeArray = ["",""]

Integer values_number = slurperValues.size()
log.info(values_number)

for(i=0; i<values_number; i++){
	def valueType = context.expand( '${Request the list of items of the catalogue#Response#$[\'values\']['+i+'][\'valueType\']}' )
	valueTypeArray[i] = valueType
	log.info(valueTypeArray[i])
	if(valueTypeArray[i]!="pinscher" && valueTypeArray[i]!="testing"){
		assert false
	}else{
		assert true
	}	
}

 

share me!:))Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone
Print this page

Pinscher Testing is on Tea-time with Testers

Tea-time with Testers, is the largest-circulated software testing monthly in the world. As the wave of change sweeps business, testing field and community of testers like never before, Tea-time with Testers has ensured that its readers have all the necessary upgrades to challenge tomorrow. It takes its readers deeper to give a complete understanding of the world of software testing.

Ever since its inception in 2011, it has set one benchmark after another in testing publication circle. It was the first to do serious reporting on software testing theories and thoughts. And then again, it is the first to bring a whole new genre of technical/corporate journalism more upclose and more incisive. It is the only monthly magazine in global testing community known for quality of its content, authors and unique way of presenting the information.Today, Tea-time with Testers commands the highest circulation and readership among all English language testing magazines in the world.

Tea-time with Testers Site
 

You can click on cover to download the PDF with my article, The Test Tower by Giuseppe Cilia.

PDF of last edition with my article

Happy testing with Tea-time with Testers, thank you very much!:)
 

share me!:))Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone
Print this page

SoapUI and Groovy Scripting (first part)

Groovy is an object-oriented programming language for the Java platform alternative to the Java language. Can be seen as the scripting language for the Java Platform, has characteristics similar to those of Python, Ruby, Perl, and Smalltalk.

Features:
Groovy uses a syntax similar to that of Java, based on braces, dynamically compiles bytecode for the Java Virtual Machine, and interacts seamlessly with other Java code and existing libraries. The Groovy compiler can be used to generate standard Java bytecode which can be used by any Java project. Groovy can also be used as a dynamic scripting language.

  • Dynamic Typing
  • Native syntax for lists, maps and regular expressions
  • Closures
  • Overloading operators

Another Groovy feature that is worth emphasizing is its native support for various markup languages like XML and HTML. This feature allows to define and manipulate many types of disparate data with a syntax and a methodology of uniform programming.

Standard Java (Java 5+):

for (String item : new String [] {"Pinscher", "Testing", "Blog"}) {
     if (item.length() <= 4) System.out.println(item);
}

Groovy:

["Pinscher", "Testing", "Blog"].findAll{it.size() <= 4}.each{println it}

 
Groovy Site
 

To test better services SoapUI we can use Groovy.
Between a request and the next we can insert a groovy script, renamed properly, it generates something between the two step or create an assert “more complex” than those provided by SoapUI.

Follow four rows generates a random string

import org.apache.commons.lang.RandomStringUtils
String charset = (('a'..'z')).join() //+ ('0'..'9')).join()
Integer length = 9
String randomStringName = RandomStringUtils.random(length, charset.toCharArray())

Print value of a variable on SoapUI console

log.info "randomStringName: ${randomStringName}"

Define of a json array

def body = '''[{
         "OrderId": "1",
         "buyerEmail": "pinschertesting@gmail.com",
         "buyerName": "'''+"${randomStringName}"+'''",
         "earliestDeliveryDate": null,
         "earliestShipDate": null,
         "isPremium": null,
         "isPrime": null,
         "lastUpdateDate": 1462113597000,
         "latestDeliveryDate": null,
         "latestShipDate": null,
         "numOfItemsShipped": null,
         "numberOfItemsUnshipped": null,
         "orderCurrency": null,
         "orderItems": [],
         "orderStatus": "A",
         "orderTotal": null,
         "purchaseDate": 1462113597000,
         "shipServiceLevel": null,
         "shipmentServiceLevelCategory": null,
         "shippingAddress": null
}]'''

Sends a json object to a request

def restRequest = testRunner.testCase.getTestStepByName("Request updates the list of orders")
restRequest.setPropertyValue('Request', body)

Defines a variable that contains a value takes from a specific xpath value of Response; after that, compares value stored in variables

def buyerName_beforePatch = context.expand( '${#[Order TestSuite#/orders TestCase#Request All Orders]#Response#$.orders[4].buyerName}' )
log.info "buyerName_beforePatch: ${buyerName_beforePatch}"

def buyerName_afterPatch = context.expand( '${#[Order TestSuite#/orders TestCase#Copy of Request All Orders]#Response#$.orders[4].buyerName}' )
log.info "buyerName_afterPatch: ${buyerName_afterPatch}"

if ( buyerName_beforePatch != buyerName_afterPatch ) {
	log.info "Different values -> OK."
} else {
	log.info "Same values -> KO."
	return false
}

Takes the value of a Response and saves in a variable; JSON slurper parses text or reader content into a data structure of lists and maps

import groovy.json.JsonSlurper
import org.apache.commons.lang.math.RandomUtils
import java.util.Random

def orders = context.expand( '${#[Order TestSuite#/orders TestCase#Request All Orders]#Response#$.orders}' )
def slurperOrders = new JsonSlurper().parseText(orders)
log.info "slurperOrders: ${slurperOrders}"

Generates a random number between a range values

Integer randomInteger = RandomUtils.nextInt(new Random(),slurperOrders.size())
log.info "randomInteger: ${randomInteger}"

def aOrderId = slurperOrders[randomInteger].aOrderId
log.info "aOrderId: ${aOrderId}"

Defines a json object

def context = '''{
   "context":    {
      "cartid": null,
      "flowid": null,
      "id": "defaultSessionContextId",
      "userid": "pinscherTesting"
   },
   "cartItems":[]
}'''

Settings of a global property value

testRunner.testCase.testSuite.setPropertyValue("cartId", cartID)

Defines and takes property value

def cartID = testStep.getPropertyValue("id")

Conversion text in Json

import groovy.json.JsonOutput
def conv = JsonOutput.toJson(jsonSlurperRequest)

 

share me!:))Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone
Print this page

SoapUI Testing

SoapUI is an open source application for web service testing in a service-oriented architecture (SOA). Its features include web service inspection, invocation, development, simulation, mocking, functional testing, load testing and compliance testing. A commercial version, SoapUI Pro, which focuses mainly on features designed to improve productivity, has also been developed by eviware software. In 2011, eviware was acquired by SmartBear Software.

SoapUI was first published in September 2005 under the GNU General Public License. Since its publication, SoapUI has been downloaded more than 2 million times. It is entirely based on the Java platform and uses Swing for the user interface. This means that SoapUI is multiplatform. SoapUI now supports IDEA, Eclipse and NetBeans.

Basic features include:

  • Inspection of web services,
  • Invocation of web services,
  • Development of web services,
  • Simulation and mocking of web services,
  • Functional testing, load testing, compliance and web services security.

SoapUI is a very extensive tool though, and sometimes it takes some time to understand it in its entirety. Here are 8 very basic tips on how to use SoapUI; following them might not necessary make you a better tester, but it will make you a more proficient user, and that’s a good first step.

  1. Right Click on any item you would like to interact with and see what shows up.
  2. You have a group of tests, called TestSuites that contains the actual tests, called TestCases. A TestCase can in its turn contain a number of steps, called TestSteps. If you follow the TestSuite, TestCase, TestStep structure you have so much to gain. Test reuse is easier; you can clone or copy tests as well as refer to them from other tests.
  3. When you create a new TestCase SoapUI offers an easy name for you, for example “TestSuite for validating Pinscher Testing Updates work” instead of “TestSuite 44”. A good advice is also using the same way of naming Items in your project.
  4. Testing in SoapUI is all about the assertions. Without them you can’t properly say that you have performed a test. Creating assertions is real simple in SoapUI; you create them by going to the Assertion Tab in the SoapUI request/response editor.
  5. Property Transfer is obviously useful to take a value in a response and move it to a request.
  6. When you’ve done the tests, you can see the results, step by step, by looking in the Test Log.
  7. There are a number of logs in SoapUI telling you what might be wrong.
  8. Load testing? Just right click a Functional Test, choose New LoadTest and you’re ready to go!

SoapUI site

Happy Service Testing!:)

 

share me!:))Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone
Print this page

Testing with NightwatchJS and PhantomJS

Nightwatch.js, based on Node.js, is an End-to-End (E2E) testing solution for browser and web app. Use the power of API Selenium WebDriver to perform commands and assertions on the elements of the DOM.

nightwatchjs site
PhantomJS is a scriptable headless WebKit with API JavaScript. Fast, native to various Web standards: DOM handling, CSS selectors, JSON, Canvas, and SVG.

phantomjs site

nightwatchjs_project

 

 

 

 

An example of step_definition.js ->

module.exports = function() {

    this.Given(/^I open site_example's page$/, function() {
        this
        	.resizeWindow(1024, 768)
            .url("http://www.site-example.it")
            .waitForElementVisible("body", 1000);
    });

    this.When(/^I search for iPhone$/, function() {
        this
        	.useXpath()
        	.waitForElementVisible("//input[@id='short_gsa_search_box']", 1000)
        	.setValue("//input[@id='short_gsa_search_box']", "iphone")
        	.click("//*[@id='gsa_menu_box']/a");
    });

    this.Then(/^the page title is as expected$/, function() {
        this.assert.containsText("//*[@id='c118109']/div[2]/div/span[1]", "Hai cercato: iphone");
    });
    
};

 

nightwatch.conf.js ->

module.exports = {
    "src_folders" : [require('nightwatch-cucumber')()],
    "output_folder" : "reports",
    "custom_commands_path" : "",
    "custom_assertions_path" : "",
    "globals_path" : "",
    "live_output" : false,
    "parallel_process_delay" : 10,
    "disable_colors": false,
    "test_workers" : false,

    "selenium" : {
        "start_process" : false,
        "server_path" : "lib/selenium-server-standalone-2.52.0.jar",
        "log_path" : "logs",
        "host" : "10.60.236.49",
        "port" : 6666,
        "cli_args" : {
            "webdriver.chrome.driver" : "",
            "webdriver.firefox.profile" : ""
        }
    },

    "test_settings" : {
        "default" : {
            "launch_url" : "http://ip_nightwatch_pc",
            "selenium_host" : "ip_nightwatch_pc",
            "selenium_port" : 6666,
            "silent" : true,
            "disable_colors": true,
            "screenshots" : {
                "enabled" : false,
                "path" : ""
            },
			"desiredCapabilities" : {
				"browserName" : "phantomjs",
				"phantomjs.cli.args" : ["--ignore-ssl-errors=true"],
  				"phantomjs.page.settings.userAgent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36",
  				"phantomjs.binary.path" : "/Users/jenkins/Desktop/nightwatchjs_job_jenkins/phantomjs-2.1.1-macosx/bin/phantomjs",
  				"javascriptEnabled" : true,
  				"acceptSslCerts" : true
			}
    	}
 	}
}

 

package.json ->

{
  "name": "nightwatchjs",
  "version": "1.0.0",
  "description": "",
  "main": "nightwatch.conf.js",
  "dependencies": {
    "cucumber": "^0.9.5"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" &amp;amp;&amp;amp; exit 1"
  },
  "author": "",
  "license": "ISC"
}

 

feature_example.feature ->

Feature: Homepage Search

Scenario: Searching Homepage

    Given I open example_site's page
    When I search for iPhone
    Then the page title is as expected

 

Job Jenkins Nightwatch.js on Excute Command bash

  • export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
  • cd /Users/jenkins/workspace/PhantomJS\ Cucumber-Nightwatchjs\ Tests
  • /Users/jenkins/workspace/PhantomJS\ Cucumber-Nightwatchjs\ Tests/node_modules/nightwatch/bin/nightwatch

 

Happy Testing with Ghosts! XD

share me!:))Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone
Print this page

Run Selenium Grid on Safari browser

To run your tests on Safari browser need to download selenium-safari-driver-last_version.jar
safari-driver

Selenium Grid Node start with:

java -jar selenium-server-standalone-last_version.jar -role node -nodeConfig nodeconfig.json -Dwebdriver.safari.driver=selenium-safari-driver-last_version.jar

Set nodeconfig.json:

{
    "capabilities":
    [
        {
            "seleniumProtocol":"WebDriver",
            "browserName":"safari",
            "maxIstances":1
        }
    ],
    "configuration":
    {
        "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
        "maxSession": 5,
        "port": 4448,
        "register": true,
        "registerCycle": 5000,
        "hubPort": 4444
        "hubHost": "ip_hub"
    }
}

 

How to add the WebDriver extension to Safari (Safari extz)

You have to unpack the selenium-safari-driver.jar in selenium folder, copy the files SafariDriver.safariextz downloaded selenium-safari-extension and double click on it.
At this point you will open the extensions preferences safari and you will see the active and installed WebDriver.

Happy testing on Safari!;)

share me!:))Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone
Print this page

Lint your Swift with Tailor

Tailor is a static analysis and lint tool for source code written in Apple’s Swift programming language. It analyzes your code to ensure consistent styling and help avoid bugs.

Tailor supports Swift 2 out of the box and helps enforce style guidelines outlined in the The Swift Programming Language, GitHub, Ray Wenderlich, and Coursera style guides.

tailor-site
tailor-wiki

I have integrated Tailor with Jenkins in a job “iOS Tailor Testing – App Example”
tailor –format=json . | tailorf >> tailor_report.html

tailorf is a python formatter created to convert json tailor output in html report.

Structure Project tailorf
tailorf-project

 

 

 

 

 

Source code of tailorf:

tailor.html ->

<!DOCTYPE html>
<html>
<head>
    <title>Tailor Report</title>
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">

    <!-- Optional theme -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">

    <!-- Latest compiled and minified JavaScript -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
</head>
<body>

<div class="container">

<h2>TAILOR REPORT</h2>


<h3>

Summary
</h3>


<table class="table table-condensed">

<td>
            {% for key, value in data.summary.iteritems() %}

<tr>{{ key }}: {{ value }}</tr>

            
            {% endfor %}
        </td>

    </table>





    {% for file in data.files %}

<h4>

{{ basename_function(file.path, prefix) }}
</h4>


<table class="table table-condensed table-bordered">

<tr>

<td><strong>Severity</strong></td>


<td><strong>Rule</strong></td>


<td><strong>Location - line/column</strong></td>


<td><strong>Error message</strong></td>

        </tr>

        {% for error in file.violations %}

<tr>

<td>
                <mark>{{ error.severity }}</mark>
            </td>


<td>{{ error.rule }}</td>


<td>{{ error.location.line }}/{{ error.location.column }}</td>


<td><em>{{ error.message }}</em></td>

        </tr>

        {% endfor %}
    </table>





    {% endfor %}
</div>

</body>
</html>

 

__init__.py ->

import json
import os
import sys

from jinja2 import Environment, PackageLoader


def __basename_function(path, prefix):
    return os.path.relpath(path, prefix)


def format(file=sys.stdin):
    env = Environment(loader=PackageLoader('tailorf', 'templates'))
    env.globals['basename_function'] = __basename_function
    data = json.load(file)
    paths = [file["path"] for file in data["files"]]
    prefix = os.path.commonprefix(paths)
    template = env.get_template('tailor.html')
    print template.render(data=data, prefix=prefix)

 

requirements.txt ->
jinja2
setuptools

 

setup.cfg ->
[metadata]
description-file = README.md

 

README.md ->
tailorf
================

 

setup.py ->

from setuptools import setup

setup(
    name='tailorf',
    packages=['tailorf'],
    version='0.1.1',
    description='Format tailor json output to HTML',
    author='Giuseppe Cilia',
    author_email='pinschertesting@gmail.com',
    url='https://gitlab_url/tailor-formatter',
    download_url='https://gitlab_url/tailor-formatter/repository/archive.targ.gz?ref=0.1.1',
    keywords=['formatter', 'tailor', 'html'],
    classifiers=[],
    install_requires=['jinja2'],
    package_data={'tailorf': ['templates/*.html']},
    entry_points={
        'console_scripts': [
            'tailorf = tailorf:format',
        ]
    }
)

 

How to install tailorf?
sudo pip install tailorf

tailorf-report

 

 

 

 

 

 

share me!:))Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone
Print this page

SonarQube and Jenkins for Windows Phone App

We have talked many time in many posts of SonarQube but, how to integrate a project for Windows Phone APP and Jenkins for continuous automatic static testing?
Easy!:)

Download MSBuild.SonarQube.Runner-2.0.zip
msbuild-sonarqube-runner-download

in SonarQube.Analysis.xml insert the ip of server, user and password:
sonar.host.url: http://sonar_server_ip:9000
sonar.login: admin
sonar.password: admin

1. Open a Developer Command Prompt for VS2015 from the Start menu.
2. Navigate to the folder containing the project that you want to analyze.
3. Run the following commands:
path=%path%;C:\Sq\MSBuild.SonarQube.Runner-1.0.1 (env variable added)
MSBuild.SonarQube.Runner begin /n:AppExample /v:1.0 /k:blm
Msbuild
MSBuild.SonarQube.Runner end

AppExample is the name of project visualized in Sonar Server Dashboard.

To integrate SonarQube and Jenkins need write the follow code in an Execute Windows batch command:
C:\Sq\MSBuild.SonarQube.Runner-2.0\MSBuild.SonarQube.Runner.exe begin /n:AppWallet /v:1.0 /k:blm
nuget restore WalletApp.sln
MSBuild /t:Clean,Build /p:Configuration=Release
C:\Sq\MSBuild.SonarQube.Runner-2.0\MSBuild.SonarQube.Runner.exe end

Happy Testing;)

share me!:))Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone
Print this page

Page 1 of 8

Powered by WordPress & Theme by Anders Norén