Automation Concepts in testing

This thread is dedicated for automation concepts and problems you faced during automation with various tools. Be it a Open source or its a paid tool, do post your quires. Here at CE we will try to resolve the problems. Also, I will keep on posting the concepts of automation and overview of different tools.

Automation is a mechanism that tests software unattended by automating and executing repetitive test cases for various releases of any product in different test environment.

The purpose of automated testing is to:
Save Time and Money
Better utilization of resources
Avoid redundancy on test execution
Increase test coverage

-CB

Replies

  • Saandeep Sreerambatla
    Saandeep Sreerambatla
    Hi CB,

    i have a problem with the screen saver in our systems.
    i have a functionality to capture the screenshot of the image which is on the desktop , and in the execution after 5 mins the screensaver gets displayed how to handle this issue.
    IS there any generalised function which runs every 4 mins to Mouse over or to send keys?
  • Anil Jain
    Anil Jain
    ES - do one thing, either write a VB script which will open a calc and close it and execute it using windows schedular recurringly after every 4 minutes.

    Second option could be start VNC server on the system it won't allow system to lock or screen saver to enable. Third option could me use mousehover function (using co-ordinate.)

    So let me know if any of this function works.

    -CB
  • Saandeep Sreerambatla
    Saandeep Sreerambatla
    what is VNC server?

    Will try the first option and i have tried the third one like mouse over but to call it appropriately after 4 mins is a task which is actually troubling a bit.
  • slashfear
    slashfear
    Hi ES,

    VNC is used for remote desktop access, you can control any desktop remotely (if you know the IP address and provided VNC installed in there machine too)
  • Anil Jain
    Anil Jain
    Right Slashfear. To pour more light on VNCE server:

    In computing, Virtual Network Computing (VNC) is a graphical desktop sharing system that uses the RFB protocol to remotely control another computer. It transmits the keyboard and mouse events from one computer to another, relaying the graphical screen updates back in the other direction, over a network.

    VNC is platform-independent รข€“ a VNC viewer on one operating system may connect to a VNC server on the same or any other operating system. There are clients and servers for many GUI-based operating systems and for Java. Multiple clients may connect to a VNC server at the same time. Popular uses for this technology include remote technical support and accessing files on one's work computer from one's home computer, or vice versa.

    VNC was originally developed at the Olivetti Research Laboratory in Cambridge, United Kingdom. The original VNC source code and many modern derivatives are open source under the GNU General Public License.

    Etymology:
    The name 'Virtual Network Computer/Computing' originates from ORL's work on a thin client called the Videotile which also used the RFB protocol. This was essentially an LCD with a pen input and a fast ATM connection to the network. At the time, network computer was commonly used as a synonym for 'thin client'. VNC is essentially a software-only (i.e virtual) version of this network computer.

    Operation:
    A VNC system consists of a client, a server, and a communication protocol.
    The VNC server is the program on the machine that shares its screen.
    The VNC client (or viewer) is the program that watches and interacts with the server.
    The VNC protocol (RFB) is very simple, based on one graphic primitive from server to client ("Put a rectangle of pixel data at the specified X,Y position") and event messages from client to server.

    The server sends small rectangles of the framebuffer to the client. In its simplest form, the VNC protocol can use a lot of bandwidth, so various methods have been devised to reduce the communication overhead. For example, there are various encodings (methods to determine the most efficient way to transfer these rectangles). The VNC protocol allows the client and server to negotiate which encoding will be used. The simplest encoding, which is supported by all clients and servers, is the raw encoding where pixel data is sent in left-to-right scanline order, and after the original full screen has been transmitted, only transfers rectangles that change. This encoding works very well if only a small portion of the screen changes from one frame to the next (like a mouse pointer moving across a desktop, or text being written at the cursor), but bandwidth demands get very high if a lot of pixels change at the same time, such as when scrolling a window or viewing full-screen video.

    VNC by default uses TCP ports 5900 through 5903[1][2], each port corresponding to a separate screen ๐Ÿ˜€0 to :3). A Java viewer is available in many implementations such as RealVNC on ports 5800 through 5806, allowing clients to interact through, among other things, a Java-enabled web browser. Other ports can be used as long as both client and server are configured accordingly.

    Using VNC over the Internet works well if the user has a broadband connection at both ends. However, it may require advanced NAT, firewall and router configuration such as port forwarding in order for the connection to go through. Some users may choose to use instant private networking applications such as Remobo or VPN applications such as Hamachi to make usage over the Internet much easier.
    Note that on some machines, the server does not necessarily have to have a physical display. Xvnc is the Unix VNC server, which is based on a standard X server. Xvnc can be considered to be two servers in one; to applications it is an X server, and to remote VNC users it is a VNC server. Applications can display themselves on Xvnc as if it were a normal X display, but they will appear on any connected VNC viewers rather than on a physical screen.

    In addition, the display that is served by VNC is not necessarily the same display seen by a user on the server. On Unix/Linux computers that support multiple simultaneous X11 sessions, VNC may be set to serve a particular existing X11 session, or to start one of its own. It is also possible to run multiple VNC sessions from the same computer. On Microsoft Windows the VNC session served is always the current user session.

    VNC is commonly used as a cross-platform remote desktop system. For example, Apple Remote Desktop for Mac OS X (and more recently, "Back to My Mac" in 'Leopard' - Mac OS X 10.5) interoperates with VNC and will connect to a Linux user's current desktop if it is served with x11vnc, or to a separate X11 session if one is served with TightVNC. From Linux, TightVNC will connect to an OS X session served by Apple Remote Desktop if the VNC option is enabled, or to a VNC server running on Microsoft Windows. The Aqua Connect Terminal Server utilizes VNC to achieve a cross-platform remote desktop delivering the Mac OS to PCs, Mac, smartphones and the iPhone.

    Security:
    By default, VNC is not a secure protocol. While passwords are not sent in plain-text (as in telnet), brute-force cracking could prove successful if both the encryption key and encoded password are sniffed from a network. For this reason it is recommended that a password of at least 8 characters be used. On the other hand, there is also an 8-character limit on some versions of VNC; if a password is sent exceeding 8 characters, the excess characters are removed and the truncated string is compared to the password.

    However, VNC may be tunnelled over an SSH or VPN connection which would add an extra security layer with stronger encryption. SSH clients are available for all major platforms (and many smaller platforms as well); SSH tunnels can be created from UNIX clients, Microsoft Windows clients, Macintosh clients (including Mac OS X and System 7 and up) รข€“ and many others. There are freeware applications that create instant VPN tunnels between computers such as Remobo. Hamachi which has been purchased by LogMeIn and is no longer freeware, though it's free for non-commercial use.
    UltraVNC supports the use of an open-source encryption plugin which encrypts the entire VNC session including password authentication and data transfer. It also allows authentication to be performed based on NTLM and Active Directory user accounts. However, use of such encryption plugins make it incompatible with other VNC programs. RealVNC offers high-strength encryption as part of its commercial package. Workspot released AES encryption patches for VNC.

    Reference link: Virtual Network Computing

    Feel free to ask any dobuts or issues you face with VNC.

    By the way Is your problem solved with the first workaround.

    -CB
  • Anil Jain
    Anil Jain
    English-Scared
    what is VNC server?

    Will try the first option and i have tried the third one like mouse over but to call it appropriately after 4 mins is a task which is actually troubling a bit.
    First method of calling that function is using windows schedular, another is write mouse hover operation in a function and call that function after every step. It will increase the execution time a bit, but will be full proof for your execution.

    -CB
  • Saandeep Sreerambatla
    Saandeep Sreerambatla
    Yes using the mouse over function and calling it after every 3 steps solved my problem as of now..
    thinking of a permanent solution and will update you on that thanks Slashfear and CB for your details ๐Ÿ˜€
  • Saandeep Sreerambatla
    Saandeep Sreerambatla
    Hi guys ,

    I am trying to get the Run time property of an object .

    the property name is isContentEditable , there is a method to get it with a function called Getroproperty but this function is not allowed on that object in run time.
    SO i want to verify this property, how can i do it?

    I am using QTP.

    Thanks ๐Ÿ˜Ž
  • Saandeep Sreerambatla
    Saandeep Sreerambatla
    Guys is my question clear , or needed any more information?
    Please let me know ๐Ÿ˜€
  • Anil Jain
    Anil Jain
    English-Scared
    Hi guys ,

    I am trying to get the Run time property of an object .

    the property name is isContentEditable , there is a method to get it with a function called Getroproperty but this function is not allowed on that object in run time.
    SO i want to verify this property, how can i do it?

    I am using QTP.

    Thanks ๐Ÿ˜Ž
    As per me for some applications you can get only those runtime properties which are available in TestObject properties as well.

    Looks like your applications falls in the same category as well. Most probably isContentEditable property is not present in TO so GetRoProperty is not showing the value for the same.

    PS: - can you use disabled property for the same use, I am sure it will be present in both TO and well as RO. Also to getting the property which has boolean output you should use CBool(Var).

    DO let me know If you if this sounds alien.

    -CB
  • Saandeep Sreerambatla
    Saandeep Sreerambatla
    Yes GetRo Property is showing null you are correct , Will check the above said methods and will let you know.

    Meanwhile i got another method of solving the same will let you know if i get through it through any means ๐Ÿ˜€

    Will post my question/solution after trying out again.
    Thanks CB ๐Ÿ˜€
  • Saandeep Sreerambatla
    Saandeep Sreerambatla
    Hey guys this is specific to people who work on QTP.

    @CB. If we are trying to do the GetRoProperty of Run-time objects we get a Null value.

    There is a method to get the Runtime value using GetRoProperty
    we have to use
    browser("...").page("...').Object("....").GetRoproperty("attribute/run time property name")

    We get the property of the object.


    The problem which i stated i tried solving with using SetToProperty but the result is not clear , so using this property its working fine..

    I guess this would be useful to people here.

    Post the questions which you come across ๐Ÿ˜€
  • Saandeep Sreerambatla
    Saandeep Sreerambatla
    Guys ,

    "How to get the adjacent text / label of a radio button in QTP" ?

    this is my question.

    Please let me know if any body came across this ?
  • Anil Jain
    Anil Jain
    Buddy, there is no option to ckeck the attached text directly.

    Only method which I can suggest you right now is find out the name of the radio button and then at run time fetch the X,Y co-ordinate of that and then find out the element name on run time by doing +-5 or 10 whatever you think is suitable.

    Other then that there is no direct option.

    By the way why you require this??
  • Saandeep Sreerambatla
    Saandeep Sreerambatla
    This is a requirement of my friend in my organization.

    This is required because we wanted to select the radio button with respect to the label.

    without giving #0 or #1 in the select statement.

    But as of now without giving those values selecting Radio's is not possible so we left that.

    I will try the above said method , it could be useful elsewhere.

    Thanks for the suggestion, will try and let you know my findings.


    Have you checked my previous solution for Runtimeproperty??
  • Saandeep Sreerambatla
    Saandeep Sreerambatla
    The problem was "How to get the row count of a csv file"

    That is solved now ๐Ÿ˜€

    Next , i have a application browser , on clicking on a link a new blank browser will get displayed , iff i close my first browser the script on second one is working ,if not its not working ๐Ÿ˜”


    For second browser i am using descriptive programmming .
  • fake_lover01
    fake_lover01
    Great Post !!
  • Anil Jain
    Anil Jain
    English-Scared
    The problem was "How to get the row count of a csv file"

    That is solved now ๐Ÿ˜€

    Next , i have a application browser , on clicking on a link a new blank browser will get displayed , iff i close my first browser the script on second one is working ,if not its not working ๐Ÿ˜”


    For second browser i am using descriptive programmming .

    why don't you use ("creation time" --> 0 for first and 1 for second) for functioning / switching between browsers. That will work I guess....

    -CB
  • Saandeep Sreerambatla
    Saandeep Sreerambatla
    Tried that too , still no luck ๐Ÿ˜”
  • Saandeep Sreerambatla
    Saandeep Sreerambatla
    one more question,

    How to find the justification of a cell through QTP??

    IF a cell is left justified or right or center ,how to find that ??

    I know how to make a cell left/right/center intended .

    But my problem i need to check whether a range of cells are left intended or right??

    How ?? scratching my head from 5 hours ๐Ÿ˜”๐Ÿ˜”
  • Anil Jain
    Anil Jain
    As you said you know how to justify (align) text in a single cell; in the very same syntex use counter and apply a for loop

    means
    Set objExcel = CreateObject("Excel.Application")

    ObjExcel.Cells(i,j)

    Use a for loop as per your requirement and check the alignment of the cells as per your need of range.

    Have I misunderstood you and on the wrong path???

    -CB
  • Saandeep Sreerambatla
    Saandeep Sreerambatla
    I tried that one too.

    The code and output is ..
    Set objExcel = CreateObject("Excel.Application")
    Set objWorkbook = objExcel.Workbooks.Open("Excelpath")
    objexcel.cells(1,1).select
    objExcel.Selection.HorizontalAlignment = -4131
    If (objExcel.Selection.HorizontalAlignment =-4131) Then
    MsgBox "PASS"
    Else
    MsgBox "Fail"
    End If

    If i check like this the msgbox value is PASS.


    But if in the first execution i set only
    objexcel.cells(1,1).select
    objExcel.Selection.HorizontalAlignment = -4131

    Later in the second execution / if i check
    If (objExcel.Selection.HorizontalAlignment =-4131) Then
    MsgBox "PASS"
    Else
    MsgBox "Fail"
    End If

    The result is Fail.

    This is the problem?
  • Saandeep Sreerambatla
    Saandeep Sreerambatla
    here is the solution for the problem mentioned..

    Set oExcel = CreateObject("Excel.Application")

    Set oWorkbook = oExcel.Workbooks.Open("C:\Test.xls")

    Set oWorksheet = oWorkbook.Worksheets(1)
    oWorksheet.Cells(1, 2).Value = 15
    oWorksheet.Cells(1,2).Select
    oExcel.Selection.HorizontalAlignment = - 4131
    oExcel.ActiveWorkbook.Save
    oExcel.ActiveWorkbook.Close
    oExcel.Quit
    Set oWorkbook = oExcel.Workbooks.Open("C:\Test.xls")
    Set oWorksheet = oWorkbook.Worksheets(1)
    oWorksheet.Cells(1,2).Select
    a = oExcel.Selection.HorizontalAlignment
    msgbox a
    oExcel.ActiveWorkbook.Close
    oExcel.Quit

    Set oExcel = Nothing

    It works!!!
  • jhbalaji
    jhbalaji
    Yeah have a look in my automated program created with PHP mate
    #-Link-Snipped-#
    Demo Here
    #-Link-Snipped-#
  • srf_world
    srf_world
    If you are using QTP then
    Make a VBS file, Copy paste below code into VBS
    Execute once

    Code for QTP
    '*********************************************
    Const micVoid = 0
    Const micByte = 26
    Const micLong = 3
    Const KEYEVENTF_KEYUP = &H2
    Set Extern = CreateObject("Mercury.ExternObj")
    extern.Declare micVoid, "keybd_event", "user32", "keybd_event", micByte, micbyte, miclong, micLong
    Extern.Declare micVoid, "Sleep", "kernel32", "Sleep", micLong
    While True
    extern.keybd_event 0, 0, KEYEVENTF_KEYDOWN, 0
    Extern.Sleep 20000
    Wend
    '*****************************************************************

    If you are using other tool
    Download Caffeine Exe from Zhorn Software

    It will keep on ur monitor without intrupt of Screen Saver

    Regards,
    Munna Sarfraz

You are reading an archived discussion.

Related Posts

When we execute a C program, the output is printed on the black screen by default. I want this output to be decorated. I want it on a well designed...
I had a 5.1 surround system..but recently a high voltage burnt my woofer PCBs. The woofer speaker is gud...i want to do somethnig... the four channels (front left/right n rear...
From the first day of evolving roads, I think they've been placing a new layer onto an old layer of road. But again, replacing roads would be expensive, right? If...
I think all of you would know the FLAMES game played by school students and teenagers. Using this game, they predict the relationship between two persons. F-Friends L-Love A-Affection M-Marriage...
CEans, I thought of declaring this as a CE Lab mini project to be developed by CEans who'd like to contribute to CE. Here are the requirements of the feed...