Automation Beyond

To raise the bar in Testing and Test Automation for Software Quality Assurance. Above Requirements. Beyond Expectations. Methodologies and concepts. Framework Design. Programming and Scripting. Created by Albert Gareev.

GP/QTP Automation: cross-dictionary issue with sanScript

Posted by Albert Gareev on 2009/11/09

All related posts: Reference Page – GP/QTP Automation 

The problem 

Those who tried sanScript code examples on their windows/objects probably noticed that Great Plains refuses to execute some instructions referring to certain objects even if they were successfully mapped with Dexterity GUI Mapping Script or with GUI Capture Script.

And while  highlighting  window controls you may see that some were “omitted”.

The reason is that those GUI objects do not belong to the base product package or dictionary as it is named (filename: Dynamics.dic).

Those who are interested in researching the problem from the application development side might find useful the following articles. 

Understanding Cross Dictionary Dexterity Development 

Cross Dictionary Dexterity Development 

There is no solution for the cross-dictionary scripting issue but modification of source code of the application’s dictionaries and this way is not really applicable for the functional test automation.

However Dexterity Macros could be used as a workaround.

See detailed examples in the next blog posts.

Posted in Automation, Links, MS Dynamics Great Plains | Tagged: , , , , , , , , , , , , , , , , , | Leave a Comment »

The keys are under the mat… The brains are on the Web… Are we missing something?

Posted by Albert Gareev on 2009/11/04

With regards to a recent post in Phil Kirkham’s blog.

So it seems that any technical job challenge could be resolved with help of crowdsourcing. All you need to do is posting your request on the site like “GetAFreelancer” or “ScriptLance” and offering some money.

While exploring projects section I also found requests for non-technical articles, design, and web-security troubleshooting.

So I guess QA and Development managers should get ready for a dialog like in the stories below.

Story 1

- Have you already resolved those discrepancy issues with customer data?
- No, not yet, but don’t worry. I posted all the screenshots along with the data spreadsheets attached on 3 QA community forums. I’m sure they’ll figure it out by tomorrow!

Story 2

- Are you on target with your security testing assignment?
- Yes, sure. I have never done it myself so I posted it as a project on a freelancing web-site. One guy has already offered to do that for me for just $25. We scheduled a web access session for tomorrow. I’ll share my desktop with him and he’ll do all the testing for me while I’m watching.

Story 3

- How is it going with your authentication module for the online banking application?
- I don’t have it ready so far but don’t worry. I already posted a project on a freelancing web-site. Security is a serious thing so I offered $100 and I will select the best skilled resource available!

 

… What would be your reply?

Posted in 1. Software Quality Assurance / Testing, Discussions, Links | Tagged: , , , , , , , , , | Leave a Comment »

Complex data boundaries

Posted by Albert Gareev on 2009/11/02

Number Boundary Testing -  Complex data boundaries 

Complex data types are created by composition of basic data types. Compositions of data of the same type are formed as arrays. Compositions of data of different type are formed as records.

There are internal (technical) rules defining how complex data type is managed. The rules are platform and programming language specific. 

Arrays 

For the each dimension it has an array has minimal and maximal index boundaries defined as numbers. In some programming languages array index begins with 0, in some other – with 1. That leads to lots of confuses based on:

  • First element should be accessed as Array(0),
  • Last element should be accessed as Array(Number_of_elements minus one) 

When reported to the screen indexes should be converted to 1-based notations. When an input is received it should be converted to 0-based index before addressing an array element. 

To overcome that issue programmers use various approaches. For example, I have seen the code below on a few projects and in different companies:

Months = Array (“Zerourary”, “January”, “February”, “March”, “April”, “May”, “June”, “July”, “August”, “September”, “October”, “November”, “December”)

“Zerourary” month is defined to occupy the first slot which has index 0. 

String is an array consisting of characters. Some programming languages reserve 256 elements for a string type and store the actual number of characters at index 0 element. So the string may have up to 255 characters total. Depending on the programming language and compiler directives, when the actual number of characters is exceeded the string is silently truncated or an automatic exception is thrown. 

Enumerations and lists define possible values that could be taken. In addition to index boundaries there are could be additional rules as in the following examples:

  • an array must contain same or less number of items as in the enumeration (e.g. reporting week days in timesheet)
  • an array may not contain duplicated items from the enumeration (e.g. week days should not be duplicated in the example above)
  • some items may not be duplicated and some could be (e.g. one can have multiple brothers, sisters, sons, daughters but only one mother and father. To make it more complicated: some countries allow having multiple spouses) 

Records 

Records may represent closely related values, like year, month, and day for the date; or somewhat related only business-wise, for example last name and SIN. Often values stored in a record require transformation before output to the screen. These transformation rules are subject to change depending on regional settings and customization settings in the program. 

A code operating records is oriented to the specific format. Code modules that pass in and back data records should either follow the same convention with a format or have bridging functions that perform the conversion. That applies both to back-end and front-end functions. 

Testing the boundaries 

The approach 

While defects with these types of boundaries usually impose a high severity issues they can be relatively easy caught at very early stages of development. Implementation of automated Unit Tests is better investment here rather than implementation of automated functional tests.

However there are a few good functional test sets that allow quickly check the most common scenarios. Since complex data type boundaries are internal the main trick here is to make a code make a mistake. 

Examples. 

  • Strings. Although GUI may not allow user to input strings exceeding the boundaries tester may try to make an application to produce a string of an inappropriate length. For example, if full name is constructed by an application as a combination like “last name comma first name” based on the manual input of first and last name.
  • Arrays and enumerations. Tries to make a code assigning a wrong value work very well with combo boxes (leave black, try multi-select, try typing value not presented in the list), list boxes (select none, select all), radio groups (select none) and combinations of those, for example, try input two mothers. 

The challenges 

The challenges in identifying and proving a defect are similar to the ones described in data container boundary testing.

1. No immediate visible reaction

An application might accept an (invalid) input and still be alright. Causing it to output the value or use the value in some operations might help revealing a problem.

Boundary testing for a single value might require a whole scenario: post transaction – run processing – verify account balance.

 2. Internal messing

A single value might “travel” a pretty complicated path while being passed from one function to another inside the program. If somewhere within that chain the value won’t fit the memory cell the end-result will be wrong despite of the application accepted input. Or value could be properly stored in memory but will be messed up during saving into file or database record.

Test scenarios might be required to reveal those defects.

Posted in 1. Software Quality Assurance / Testing, Heuristics, Methodology | Tagged: , , , , , , , , , , , | 1 Comment »

GP/QTP Automation: Highlight controls in Dexterity Window

Posted by Albert Gareev on 2009/10/26

SanScript, Visual Basic, and VBScript functions implementing the “Highlight in Application” feature as in QTP Object Repository Manager.

All related posts: Reference Page – GP/QTP Automation 

VBA/SanScript function – put in your Excel VBA macro file

Note. Ignores sanScript errors

Public Function HighlightControl()
    Dim intRC As Integer
    Dim intCount, Iter As Integer
    Dim sCode, sErrMsg As String
    Dim sControlName As String

    sControlName = Workbooks.Item(1).Sheets.Item(1).Cells(2, 1)
   
    Call GPApp.Activate
   
    ‘Show/Hide
    intCount = 3
    For Iter = 1 To intCount
        sCode = “hide field ” & sControlName & “;”
        intRC = GPApp.ExecuteSanScript(sCode, sErrMsg)
        Sleep 300
        sCode = “show field ” & sControlName & “;”
        intRC = GPApp.ExecuteSanScript(sCode, sErrMsg)
        Sleep 300
    Next   

End Function

VBScript function – put as Dexterity Interface Class method

Note. If use as embedded function don’t forget to call COM initialization procedures first.

 Public Function HighlightControl(ByVal sName)
  Dim boolRC, intRC
  Dim objUsedRange’
     Set objUsedRange = XLBook.Worksheets(1).UsedRange()
        objUsedRange.Cells(2,1) = ” ” & sName ’space char is apostrophe workaround

  XLHandle.Run(“HighlightControl”)

 End Function

A function to highlight all window controls one by one

Note.

Uses XML structure created by GUI Capture script

Uses Service Functions – XML (QTP, VBScript)

Public Function GP_HighlightContext(ByRef objXMLContext)
   Dim objColl, objColl2, objControl, objXMLDesc
   Dim objProperty, sName, sDexParent, sDexName, sFullName
   Dim Iter, Jter

   If (objXMLContext is Nothing) Then Exit Function End If

   sDexParent = ChildAttributeValueByName(objXMLContext, “dexhost”)
   Set objColl = objXMLContext.ChildElementsByPath(“./Object”)

   For Iter = 1 To objColl.Count
    Set objControl = objColl.Item(Iter)

       Set objXMLDesc = ChildElementByName(objControl, “desc”)
    Set objColl2 = objXMLDesc.ChildElementsByPath(“./property”)
    For Jter = 1 To objColl2.Count
     Set objProperty = objColl2.Item(Jter)
     sName = ChildAttributeValueByName(objProperty, “name”)
     If LCase(sName) = “dexname” Then
      sDexName = ChildAttributeValueByName(objProperty, “value”)
      sFullName = “‘” & sDexName & “‘ of “  & sDexParent
      GPHandle.HighlightControl(sFullName)
      Exit For
     End If
    Next

   Next

End Function

Posted in Automation, Code Examples, MS Dynamics Great Plains | Tagged: , , , , , , , , , , , , , , | 3 Comments »

Radiation 8 times higher than expected… yet no malfunction?

Posted by Albert Gareev on 2009/10/19

Hospital error leads to radiation overdoses

The article: http://www.latimes.com/news/local/la-me-cedars13-2009oct13,0,1200257.story

(…)
Doctors believed it would provide them more useful data to analyze disruptions in the flow of blood to brain tissue.
That meant resetting the machine to override the pre-programmed instructions that came with the scanner when it was installed.
“There was a misunderstanding about an embedded default setting applied by the machine . . . ,” officials at the renowned Los Angeles hospital said in a written statement that provided no other details about how the error occurred. “As a result, the use of this protocol resulted in a higher than expected amount of radiation.”
The dose of radiation was eight times what it should have been.
Once the scanner was programmed with the new instructions, the higher dose was essentially locked in. Each patient who got the procedure — known as a CT brain perfusion scan — was subjected to the overdose.
(…)
The machine was used for other types of scans but the reset error affected only the potential stroke patients, said Richard Elbaum, a hospital spokesman.
The error went unnoticed for the next 18 months, until this August, when a stroke patient informed the hospital that he had begun losing his hair after a scan.
When the hospital reviewed its records, it found — and contacted — 206 people who had received the overdoses to inform them of the mistake. Only then, Elbaum said, did the hospital learn that about 40% of them had suffered patchy hair loss. Many also experienced reddening of the skin.
(…)
General Electric, the manufacturer of the scanner, released its own statement Monday saying there were “no malfunctions or defects” of the machine.

I have conducted a short research over the web in blogs and forums about how this incident is seen. 

Some people say it’s a good chance to win a lawsuit.
Some people blame hospital for not testing their reprogramming.
Sadly, only a few people are actually asking how is this ever possible?

From myself I would like to ask why safety and security is not a built-in functionality of a product? And when will it be?

Doesn’t matter how easy or cheap to provide it, certain functionalities should be limited for security and safety reasons.

Not only to exclude a human mistake. The far more dangerous threat is a human intention: from a single employee going bad to planned actions of terrorist organization.

Posted in 1. Software Quality Assurance / Testing, Lessons learned, Limited freedom concept, Links | Tagged: , , , , , , , , | Leave a Comment »