Wednesday, October 26, 2011

The first Nokia Windows Mobile smartphone is here to beat others

What's up?
Today, London, Stephen Elop, Nokia president, presents a very first Nokia - Microsoft Windows phone. It is really exciting, especially being part of this truly innovative mobile Company. Hands on videos are below - enjoy!
What I really like - facebook seamlessly integration, skype is part of MS ecosys after acquiring first one, MS office and finally - the big hope is this phone gonna stay synched up with Windows 8 as you work on one same machine - if this illusion will come true - Windows across all devices will be very user friendly so ppl will be tapped to one big solution without need to manually synchronize, manage, convert and worry about platforms incompatibilities. Another big market for MS appears to be enterprise which is totally under Windows. + it would be awesome if next version will come with Kinect. Will see if Win Mobile can crack the code.





Fun ad:



Friday, October 21, 2011

SOAP UI is hot

Hey there, what's up with API nowadays?
They are hot topics wherever you go. No API = no product for now. Well, Soap UI is on a wave of this trendy tech flop. Why? Let's see:

  1. Easy to get into it, small learning curve
  2. Perfectly, thoughtfully built to test SOAP and Restful web services
  3. Supports proprietary and specific protocols
  4. No coding required
  5. If coding is needed - use lightweight non-typed but still OOP Groovy
  6. Functional scripts can be used for load testing
  7. Nice approach for assertions and verification
  8. Through data/variables transferring
  9. Documentation is pretty good
Now how to make happen logging in Gredy after SOAP UI test execution?
Easy! Basically there are 2 ways to enable it but everything starts from nice built-in Teardown script (there is Setup too). So you can write some Groovy in Teardown script on level of test suite or/and test case. This script will automatically kicked off once test suite (case) will be finished (all iterations including iterative, e.g. when you have multiple ones driving data through external data source)

Ok, now two ways to send data to your gredy server:
1. Sending POST request in accordance with given documentation. The data structure is given here:

Array
(
[product] => YOUR_PRODUCT_FULL_NAME
[acronym] => YOUR_PRODUCT_ACRONYM
[owner] => YOUR_PRODUCT_OWNER
[descr] => YOUR_PRODUCT_DESCRIPTION
[ProjectName] => TEST_PROJECT_NAME
[DesignSteps] => TEST_PROJECT_TEST_DESIGN
[Resolution] => TEST_PROJECT_ASSOCIATED_COMMENTS
[ToDOs] => TEST_PROJECT_ASSOCIATED_TODO
[Defects] => TEST_PROJECT_ASSOCIATED_DEFECTS
[SuiteName] => SUITE_BELONGED_THIS_TEST_RUN
[Tier] => TIER_TESTED_ON
[Date] => DATE_OF_RUN_YYYY-MM-DD
[ErrorsCnt] => NUMBER_OF_ERRORS_OCCURED_ON_TEST_PROJECT_RUN
[WarnCnt] => NUMBER_OF_WARNINGS_OCCURED_ON_TEST_PROJECT_RUN
[Path_to_log] => DIRECT_PATH_TO_TEST_RUN_LOG
[Path_to_Report] => DIRECT_PATH_TO_TEST_REPORT_OR_WHATEVER
[ReportErrors] => NUMBER_OF_ERRORS_OCCURED_ON_Path_to_Report
[Version] => TESTED_VERSION_OR_BUILD
[StandName] => MACHINE_ON_TEST_RUN
[Locale] => TESTED_LOCALIZATION
[Language] => TESTED_LANGUAGE
)


2. Sending data via database directly as given below. This script is one-stop script which will do everything for you. The only thing you should care is database connectivity [sql = Sql.newInstance("jdbc:mysql://MySQL_SERVER", "db_user","db_password", "com.mysql.jdbc.Driver");]
Another thing which can be customized is the way how you name test steps (def testname = i + " - " + testRunner.testCase.name + " - " + r.testStep.name;)
Finally, you can send more data to database (see Gredy's data model)

the Groovy script:
import static org.junit.Assert.*;
import groovy.sql.Sql
com.eviware.soapui.support.GroovyUtils.registerJdbcDriver( "com.mysql.jdbc.Driver" );

def i=0;
//def r=testRunner.results;
//r in testRunner.results
for( r in testRunner.results )
{
i++;

def product = testRunner.testCase.testSuite.project.name;
def suite = testRunner.testCase.testSuite.name;
def testname = i + " - " + testRunner.testCase.name + " - " + r.testStep.name;
def err=0;

sql = Sql.newInstance("jdbc:mysql://MySQL_SERVER", "db_user","db_password", "com.mysql.jdbc.Driver");
try{
log.info("Status: " + r.status);
log.info("TestStep Name: " +r.testStep.name);

def rows = sql.firstRow("select * from products where name=${product}");
if (rows==null )
sql.execute("INSERT INTO products (Name) VALUES  (${product})");
   
  rows = sql.firstRow("select * from suites where SuiteName=? and product_Id IN (SELECT id FROM products WHERE Name=?)", [suite,product]);
if (rows==null )
  sql.execute('INSERT INTO suites (SuiteName, product_Id) VALUES  (?, (SELECT id FROM products WHERE Name=?))', [suite,product]);

rows = sql.firstRow("select Name from projects where Name=? and testLevel IN (SELECT Id FROM suites WHERE SuiteName=? and product_id IN (SELECT id FROM products WHERE Name=?))", [testname,suite,product]);
if (rows==null )
sql.execute('INSERT INTO projects (Name, testLevel, Defects) VALUES  (?, (SELECT Id FROM suites WHERE SuiteName=? and product_id IN (SELECT id FROM products WHERE Name=?)), "")', [testname,suite,product]);
if (r.status.toString()=="FAILED")
err=1;
else err=0;
sql.execute('INSERT INTO logs (PrjID, Date, ErrorsCnt, tier, Path_to_Log) VALUES ((SELECT Id FROM projects WHERE Name=? and testLevel IN (SELECT Id FROM suites WHERE SuiteName=? and product_id IN (SELECT id FROM products WHERE Name=?))), CURRENT_DATE, ?, ?, ?)', [testname,suite,product,err,context.expand('${#Project#tier}'),"\\\\"+InetAddress.localHost.hostName]); 

catch(Error e){}

   if (sql != null) {
      sql.close();
   }   
 log.info("Status: " + r.status);
}


Here are links to get more familiar with advanced features of SOAP UI and Groovy: