Quantcast
Channel: New board topics in SmartBear Community
Viewing all 20755 articles
Browse latest View live

problems of step return inconsistency

$
0
0

Hello,

I have a strange problem with my step result processing.

I have a step ("get all devices") that can return a list of devices. the result is always ["item1", "item2, ...] etc, even if I have only one item.

In a further step, I get this step's output and do a parsing :

items_list = jsonSlurper.parseText(items_list)

this works fine. I use this as the items can sometimes be listed as [{"uid1":"item1"}],etc.

The problem is that it sometimes fails because my input is incorrect.

If my first step provides me with two items or more ( ["item1", "item2, ...] ) the second step input (${get all devices#testResponse#$['result']}) gives me ["item1", "item2, ...] 

If my first step provides me with a single item (["item1]) the second step input is like [item1] => slight difference, but with the missing "" my json parsing fails

 

Does anyone knows why the format changes ?


SoapUI oauth2 token retrieval failure

$
0
0

I'm using SoapUI 5.5.0 and want to use the gmail api. The problem is that, when I setup the authorisation (type OAuth 2.0) and click on "Get Access Token", the embedded browser pops up with an error message "The page could not be loaded".

 

The Client id, Client secret, Authorization URI, Access Token URI, Redirect URI and Scope are correct, because I reverted to an older version of SoapUI (5.2.1) and was able to get the access token.

 

Any help to solve this would be highly appreciated.

 

 

 

 

DataSink to different files when switching between Environment

$
0
0

Is it possible to export data via DataSink to different files when switching between Environment?

 

For example:

 

Environment

Environment 1
Environment 2
Environment 3

 

TestCase

Soap Request
DataSink
dataEnvironment1.txt->when executing in Environment 1
dataEnvironment2.txt->when executing in Environment 2
dataEnvironment3.txt->when executing in Environment 3

etc.

 

 

Thanks!

How to set default values into Swagger form

$
0
0

Hi,

I have a Swagger ui and a C# Controller with a GET.

Tha GET need's a json File as atribute.
Each time I will test my Api I have to write surtain values into the form (json).
Because it is allways the same value, I would like to have a prefilled field.

How can I set default values into this Swagger form?
Thanks for help.
Frank

Adding an application/json attachment to a REST request

$
0
0

I'm trying to add a json-file as an attachment to a REST-request, but it keeps converting the content type to text/javascrip instead of application/json. How can the attachment content type be changed to application/json? Literally tried everything by now.

REST Mock Response as a test step

$
0
0

How can I make a REST Mock Response test step?
I only see the option to add a SOAP Mock Response Test Step, is the same for REST not available?

This is to use SOAPUI as a message exchange simulator.

 

What I want to do:

1. Receive a REST message from my program [start a listener] - answer 200 OK

2. Send a REST message with the data to my program

Do this synchronous-ly, don't advance if the message hasn't been received


What I can't do:
Setup SoapUI to receive the REST message in a test case (I can do it manually by starting a mock but that's not good enough)

 

Any tips?

 

Many thanks!

Reading Project Test Results - LogItems Readable in Iteration but not Recursion

$
0
0

I'm trying to read some data from my log results for tracking purposes. I have nearly full functionality - I can read data from the log results of individual keyword tests, but I can't get anything from the results of a Project test item.

 

Here's some of the reading I've found helpful, so anyone not totally familiar with the systems can figure out what I've done:

 

https://community.smartbear.com/t5/TestComplete-General-Discussions/Extract-relevant-information-from-TestComplete-logs/td-p/170457

https://support.smartbear.com/testcomplete/docs/testing-with/log/working-with/from-tests.html

https://community.smartbear.com/t5/TestComplete-Functional-Web/Get-the-Execution-time-Start-and-End-Time/td-p/61930

 

Based on this, I've created the following code (heavily pared down, but functionally identical):

 

 

function WorkingLog()
{
  if(Project.Logs.LogItemsCount > 0)
  {
    // Exporting the test log contents
    try
    {
      for(var i = 0; i < Project.Logs.LogItemsCount; i++) 
      {
        for(var j = 0; j < Project.Logs.LogItem(i).DataCount; j++)
        {
          if(aqString.Compare(Project.Logs.LogItem(i).Data(j).Scheme.Name, "Test Log", false) == 0)
          {
            Log.Message("Test Log " + i + "exists!",
              ChildRead(Project.Logs.LogItem(i).Data(j)));
          }
        }
      }
    }
    finally
    {
      Log.Message("Goodbye!");
    } 
  }
  else
    // If the project does not contain log items,
    // post a message about this to the test log
    Log.Message("No logs for export."); 
}

With the following helper functions:

 

 

function ChildRead(Child)
{
  var str = "";
  switch(Child.Scheme.DataType)
    {
      case ldtTable : 
        str += TableRead(Child); // Exporting table data
        break; 
      case ldtText : 
        str += TextRead(Child); // Exporting text
        break;
      default: 
        break;
    }

  var i;
  for(i = 0; i < Child.ChildCount; i++)
  {
    str += ChildRead(Child.Child(i));
  }
  return str;
}

function TableRead(Table)
{
  var TableScheme, Row, i, str;
  TableScheme = Table.Scheme;
    if(Table.RowCount > 0)
    {
// Reads only the very last row in a table
// (I put a special log entry at the end of every test, meant for export) Row = Table.Rows(Table.RowCount-1); str += RowRead(TableScheme, Row); } return str; } function RowRead(TableScheme, ARow) { var i, str = ""; var Child, ChildRow; var ChildCount; // Exporting child tables data for(i = 0; i < TableScheme.ChildCount; i++) { Child = ARow.ChildDataByIndex(i); str += ChildRead(Child); } // Exporting child rows (if the data is displayed as a tree) for(i = 0; i < ARow.ChildRowCount; i++) { ChildRow = ARow.ChildRow(i); str += RowRead(TableScheme, s, ChildRow); } return str; } function TextRead(Child) { return Child.Text; }

 

 

As I said above, this mostly works. In a project with 17 individual test logs and 1 project log, this will read out the 17 individual logs and conspicuously skip the project log. Not only is there no data in the "additional info" section, there is no log entry at all for that log item.

 

I soon realized this was happening because the Project Log item is, in fact, a recursive container for individual log items, so I would need to perform a recursive search (as was done in the "Obtaining Log Data with Scripts" section on the Access Log Contents from Tests page).

 

So I wrote the following code: 

 

function BrokenLog()
{
  if(Project.Logs.LogItemsCount > 0)
  {
    // Exporting the test log contents
    try
    {
      for(var i = 0; i < Project.Logs.LogItemsCount; i++) 
      {
        arr = FindTestLog(Project.Logs.LogItem(i));
        for(var j = 0; j < arr.length; j++)
        {
          Log.Message("Test Log " + j + "exists!",
            ChildRead(arr[j]));
        }
      }
    }
    finally
    {
      Log.Message("Goodbye!");
    } 
  }
  else
    // If the project does not contain log items,
    // post a message about this to the test log
    Log.Message("No logs for export."); 
}

With the heavy lifting done by this helper function:

function FindTestLog(Child)
{
  arr = Array();

  // adds object to array if its name == "Test Log"
  if(Child.Scheme != null && aqString.Compare(Child.Scheme.Name, "Test Log", false) == 0)
  {
    arr.push(Child);
  }
  // if not, search children/data/rows/etc. for more objects and re-call
  // concatenating any returned arrays
  else
  {
    for(var i = 0; i < Child.ChildCount; i++)
    {
      arr.concat(FindTestLog(Child.Child(i)));
    }
    for(var i = 0; i < Child.DataCount; i++)
    {
      arr.concat(FindTestLog(Child.Data(i)));
    }
    for(var i = 0; i < Child.RowCount; i++)
    {
      arr.concat(FindTestLog(Child.Rows(i)));
    }
    for(var i = 0; i < Child.ChildRowCount; i++) 
    {
      arr.concat(FindTestLog(Child.ChildRow(i)));
    }
    for(var i = 0; i < Child.ColumnCount; i++)
    {
      arr.concat(FindTestLog(ChildDataByIndex(i)));
    }
  }
  return arr;
}

 

The intention there is to take a LogItem object and search ALL possible sub-objects for something with the name "Test Result", which is similar to how I delimited the search in the first method.

 

The problem with this, though, is that it doesn't work. It simply does not produce any information - all I get from it, with the same set of log items, is the "Goodbye" log message that I put at the end of both of them. I assumed that even if it didn't work as expected, I'd at least get a result similar to the original method, but no.

 

And now we finally get to the question of this topic: Huh???

 

Thanks for reading, and I'd definitely appreciate even the slightest hint, because I'm stumped.

 

PS I've attached the unit file as a .txt - you should be able to run it just by changing the extension to .js and linking it in TestComplete, or by copying it into a Script test.

Single readyAPI instance with multiple licences

$
0
0

I have two different customers I work for and both have readyAPI PRO licence.

So, my problem now is, how could I install both licences and run them separately?

I mean, I want to use the licence of customer1 when testing for them and licence for customer2 when testing for them...

Is that possible somehow?

Thanks,

Joaquin.


Ignoring text in a XML file

$
0
0

Hello,

 

I have a file compare checkpoint that compares XML files and consistantly fails. The XML file contains a line of text that shows the date that the file was generated. Probably goes without saying, but the date will change every time the file is generated which will be different than the baseline XML file.

 

Is it possible to configure file compare such that it will ignore a line of text in a XML file? Or set up the check point such that it only fails if there are more than one error?

 

Thank you!

 

 

 

 

How to get the script return code

$
0
0

I am executing a sequence of (JavaScript) test scripts and need to trap the return code of each script as it finishes.

Is there a project or global variable that contains the current test status/return code?

For example, if a Log.Warning or Log.Error statement is executed, the script finishes with a warning/error return code. 

Is it possible to obtain this return code value and if so, how do you do it?

Set SOAPUI loadtest threads from command line

$
0
0

Hi,

 I'm running SOAPUI Load tests from the command line and I am trying to find a way to set the number of threads the load test uses - is this possible please?

 

I've tried to use a -P value but the LoadTest thread text box doesn't accept non-numerical values


Thanks
Chris

How to insert new sheet in FarPoint Spread object?

$
0
0

Can anyone help me in adding new sheet in Farpoint Spread object? I am using TestComplete 14.0 version. I got to know some relevant functions to add a sheet but not able to use it properly:

 

bwSpread = Aliases.ClausionFPM.TemplateEditWindow.splitContainer1.SplitterPanel.uxtpnlInpRptOutlook.uxSplitContainerControl.SplitGroupPanel2.tableLayoutPanel3.Edit_Template;

 

bwSpread.TabStripInsertTab();

bwSpread.Sheets.Add();

bwSpread.Sheets.Insert();

Datadriven Using Excel for Scripts

$
0
0

I want to use excel sheet for different test cases. 

Value corresponding to ScriptName Column will be the function name as well in TestCase Script file. 

Please help how to read and write values from excel and run in Javascript.

I have seen lot of documentation but it is not helpful and everywhere it is using keyword driven test with data loops. I do not want that. Please refer attached file. 

 

 

Connecting to license manager behind a home router?

$
0
0

Hi,

I’m having networking problems connecting testExecute to the License Manager. It’s a slightly strange set-up, but maybe somebody has experienced similar issues?

 

I work remotely from home and the company I work for is cloud-based, so we don’t have any physical servers I can install the License Manager on. TestExecute is installed on a cloud Windows V.M., and because the License Manager must be installed on a physical machine, I have installed it my home desktop (windows 10, where I also have TestComplete).

 

I cannot connect to the license manager from the cloud V.M (I have installed TestExecute on a second home machine and that connects to the L.M. ok). I can ping ok from cloud V.M to home desktop. I have temporarily disabled proxies and firewalls on both the home machine and cloud V.M, and disabled Anti-Virus on my home desktop.

 

From googling,  I understand there are two possible solutions – port-forwarding on my home router and/or VPN. I did try installing the free version of TunnelBear VPN on my home desktop, but that didn’t help.

 

I guess next I’ll try port-forwarding, but to be honest I’m a little nervous about messing around with my router setup.

Anybody have any suggestions?

Contains assertion passed in SOAPUI tool, but failed executing from java using WsdlTestCaseRunn

$
0
0

I have assertion created in SOAPUI tool to verify content in response as given below and it is passing.

 

import groovy.json.JsonSlurper

def responseContent = messageExchange.responseContent
assert(responseContent.contains("queue:"))

 

Now i have exported this project to xml and i am running tests using Java using soapui maven dependency. 

WsdlTestCaseRunner

 SOAPUI test is failing [[Script Assertion] assert(responseContent.contains("queue:")) | | | false  ?%?A@0?S?

 

if noticed responsecontent is not in readable format when executed from java code. Need help on this as i need to run soaupui tests from java


NoClassDefFoundError: while reading XLSX file using XSSF cls for getCellType() /getStringCellValue()

$
0
0

Hello,

I am trying to read data from .XLSX file using Latest Apache POI libraries  4.0.1.  However I amgetting follwoing error when I am trying to getCellType() or cell.getStringCellValue() etc.

However it could read wb.getPhysicalNumberOfRows() , row.getCell(x) properly without error.

error - NoClassDefFoundError: org/openxmlformats/schemas/spreadsheetml/x2006/main/CTExtensionList

Steps followed - 

 

  1. Download the latest release version of the Apache POI libraries 4.0.1.
  2. Place the extracted libraries (all of the .jar files in the main extraction directory, \lib and ooxml-lib directories) to the ReadyAPI installation directory\bin\ext directory and restart ReadyAPI.
  3. Use this script:

    package application;

    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.util.Iterator;

    import org.apache.poi.hssf.usermodel.HSSFCell;
    import org.apache.poi.hssf.usermodel.HSSFRow;
    import org.apache.poi.hssf.usermodel.HSSFSheet;
    import org.apache.poi.hssf.usermodel.HSSFWorkbook;

    import org.apache.poi.xssf.usermodel.XSSFCell;
    import org.apache.poi.xssf.usermodel.XSSFRow;
    import org.apache.poi.xssf.usermodel.XSSFSheet;
    import org.apache.poi.xssf.usermodel.XSSFWorkbook;
    import org.apache.poi.ss.usermodel.DataFormatter;


    InputStream ExcelFileToRead = new FileInputStream("D:\\Test.xlsx");
    XSSFWorkbook wb = new XSSFWorkbook(ExcelFileToRead);
    XSSFWorkbook test = new XSSFWorkbook();
    XSSFSheet sheet = wb.getSheetAt(0);
    XSSFRow row;
    XSSFCell cell;

    Iterator rows = sheet.rowIterator();
    while (rows.hasNext())
    {
    row=(XSSFRow) rows.next();
    Iterator cells = row.cellIterator();
    while (cells.hasNext())
    {
    cell=(XSSFCell) cells.next();
    if (cell.getCellType() == XSSFCell.CELL_TYPE_STRING)
    {
    System.out.print(cell.getStringCellValue()+" ");
    }
     else if(cell.getCellType() == XSSFCell.CELL_TYPE_NUMERIC)
     {
     System.out.print(cell.getNumericCellValue()+" ");
     }
    else
     {
     }
    }
    System.out.println();
    }

Please let me know how to resolve this error.

 

regards,

Manali

 

how to determine whether json is jsonArray or jsonObject

$
0
0

Hi All,

 

I am currently stucked at a point where i need to check whether the given json contains array or not.

 

Can any one help me on this:

 

Suppose below is my json:

 

{

"status":"pass",

"code":200,

"data":{

          "abc":[{

          "a1" : "test1"

          "a2" : "test2"

          "a3" : "test3"

          "a4" : "test4"

          },

          {

          "a1" : "test1"

          "a2" : "test2"

          "a3" : "test3"

          "a4" : "test4"

          }],

          "xyz":{

               "b1":"T1"

               "b2":"T2"

               }

     }

}

 

def jsonSlurperTU = new JsonSlurper().parseText(TUResponse)

def expected = jsonSlurperTU.data.abc

def expected1 = jsonSlurperTU.data.xyz

 

i need to check whether xyz is json array or json object as the above json is dummy my json is of 4000 line.

 

 

SoapUI - Run primary Test case (wait for running to finish, Thread safe)

$
0
0
Is it possible to call a test case in groovy and set the property

'Run primary Test case (wait for running to finish, Thread safe)'

Normally this option would be set by checking the flag in a 'Run test case' script, however when calling a test case from a Mock Service dispatch script this is not possible.

Is there a way around this? Many thanks.

SoapUI project keystore password security?

$
0
0

Hi,

 

I have a project where I need to sign my requests using a keystore. For this I need to add a keystore to my project and also enter the password for it.

 

This means that when I save the project to source control, that password gets saved along with it.

 

I tried a few things to avoid this:

* global SSL keystore: can't seem to use this for signatures

* save the password in the global preferences (so it stays on my machine) and use a reference to read it: this works for a lot of other (password) fields, but not this one

* encrypting the entire project: this makes source control fairly useless

* encrypting just selected properties: doesn't work for this password field and I can't put it in a property either because the password field doesn't work with references

 

Any other ways I could do what I want? So either encrypt/hide the password in WSS Config - Keystores, or, in Outgoing WS-Security Configurations - [my configuration] - Signature, select a keystore that doesn't have to be set in my project?

 

Best regards,

 

Kris

Should I use VUs or Rate?

$
0
0

I am trying to create a ramp up load test and I am not sure if I should be using VUs or Rate. I was looking at the documentation for load type and it says VUs are not restarted for a rate type load test. Will the VUs not restarting effect how may requests per second I can send?

 

This is what I am trying to setup:

Single scenario distributed over 2 agents

Scenario has 2 different requests to the same endpoint.

VU: 1200 (600 per agent)

Max requests per second: 1250

Expected response: 250ms

Viewing all 20755 articles
Browse latest View live