Wednesday, August 2, 2017

Pair-wise (or other data combination) testing

Found good word combinations generator with rich parameter configurations - http://textmechanic.com/text-tools/combination-permutation-tools/combination-generator/ 

Examples: for applying A,B,C parameter in some service:

Initial parameters list:

  • A
  • B
  • C

Results (combination by 2 words with ";" delimiter.):

  • A;B
  • A;C
  • B;A
  • B;C
  • C;A
  • C;B

In my case A;B == B;A, so duplicates deleted:

  • A;B
  • A;C
  • B;C


Friday, March 10, 2017

Working comfortable on several git branches simultaneously with ComEmu

As a automation QA engineer I works on different tickets. For example, for some new feature I need to create new autotest, another test is needed to be re-run because developer probably fixed bugs, and it yet another test must be adapted due to test data changed due to service improvements. Some times (and very often - every day)  you need to do all this simultaneously.

Monday, February 13, 2017

How to modify testStepResult fields in SoapUI NG PRO

It was needed to modify standard JUnit style report in SoapUI NG (aka ReadyAPI! tool). testStepResult object has no writable fields ;( , but we know Java and especially its Reflection API ;)

Full problem history - https://community.smartbear.com/t5/SoapUI-NG/How-to-modify-testStepResult/m-p/135425#M30786

Hi,
I use log processing script (as TestSuite tear down script) used for a lot of our projects.
It gets information (like request URL) from testStepResult. But I need to add more information unique for every test step run into this object testStepResult. But it seems has only get... methods.
Is it possible to add custom fields and values into testStepResult object?



While deep learning Java I  found another solution, but it risky because you can modify testStepResult as much as you can and possibly lost test consistency.  Solution is Java Reflection API in general, but I use version from apache commons FieldUtils library:

In Events window:

import static org.apache.commons.lang3.reflect.FieldUtils.writeDeclaredField;

writeDeclaredField(testStepResult, "messages", ["Hiiiiiiiiiiiii!"], true);
log.info testStepResult.getMessages()[0]
Code modify private field  "messages" with List<String> type in testStepResult object.

Output:
<...> :INFO:Hiiiiiiiiiiiii!



Tuesday, June 14, 2016

Selenium WebDriver: get() vs. navigate().to()?

Question "What is difference between Selenium WebDriver get() and navigate().to() methods" is asked often on QA Automation interview. Answer is  there are the same methods performed HTTP GET request, but Navigation object has more ability to navigate like browser backward(), forward(), etc.

But navigate() method returns browser history in the form of Navigation object.
---------------
javadoc for WebDriver https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/WebDriver.html#get-java.lang.String-


WebDriver.get

void get(java.lang.String url)
Load a new web page in the current browser window. This is done using an HTTP GET operation, and the method will block until the load is complete. This will follow redirects issued either by the server or as a meta-redirect from within the returned HTML. Should a meta-redirect "rest" for any duration of time, it is best to wait until this timeout is over, since should the underlying page change whilst your test is executing the results of future calls against this interface will be against the freshly loaded page. Synonym for WebDriver.Navigation.to(String).
Parameters:
url - The URL to load. It is best to use a fully qualified URL

navigate

WebDriver.Navigation navigate()
An abstraction allowing the driver to access the browser's history and to navigate to a given URL.
Returns:
A WebDriver.Navigation that allows the selection of what to do next

WebDriver.Navigation.to

void to(java.lang.String url)
Load a new web page in the current browser window. This is done using an HTTP GET operation, and the method will block until the load is complete. This will follow redirects issued either by the server or as a meta-redirect from within the returned HTML. Should a meta-redirect "rest" for any duration of time, it is best to wait until this timeout is over, since should the underlying page change whilst your test is executing the results of future calls against this interface will be against the freshly loaded page.
Parameters:
url - The URL to load. It is best to use a fully qualified URL

navigate

WebDriver.Navigation navigate()
An abstraction allowing the driver to access the browser's history and to navigate to a given URL.
Returns:
A WebDriver.Navigation that allows the selection of what to do next


WebDriver.Navigation methods
 

Method Summary

All MethodsInstance MethodsAbstract Methods
Modifier and TypeMethod and Description
voidback()
Move back a single "item" in the browser's history.
voidforward()
Move a single "item" forward in the browser's history.
voidrefresh()
Refresh the current page
voidto(java.lang.String url)
Load a new web page in the current browser window.
voidto(java.net.URL url)
Overloaded ve



Friday, August 14, 2015

How to execute a Cucumber Scenario / Feature multiple times?

You can use several approaches:
  1. On operation system level: run command several times or write appropriate shell script.
  2. On Cucumber level. E.g. you have following feature file:
Feature: My great feature Scenario: My scenario Given My given step one When My when step two Then My then step three
You can force cucumber-jvm run it several times e.g. 3 by transforming "Scenario" to "Scenario outlines" and using "Examples":
Feature: My great feature
  Scenario **Outline**: My scenario
   Given My given step <number>
   When My when step two
   Then My then step three
Examples: to run this scenario several times
   |number|
   |one|
   |one|
   |one|
It looks some artificially, but works. I use this approach to gather statistics for complex tests dependent of a lot of conditions.