Search This Blog

November 26, 2014

Fixed the X.509 Certificate issue in WCF Test Client -The client certificate is not provided. Specify a client certificate in ClientCredentials

In our current project, we implemented X.509 Certificates. In order to test WCF methods, we needed to install X.509 certificates in our laptop. But when using SOAtest to run the tests or using WCF test client to invoke all methods, the following error message appeared:

The client certificate is not provided. Specify a client certificate in ClientCredentials.


How do we fix this issue in WCF Test Client? I assume you have the console app with the X.509 Cert configuration in app.config and the unit tests are working. 

Here are the steps to configure the WCF test client.

  1. Open WCF Test Client.
  2. Go to C:\Users\ray\AppData\Local\Temp\Test Client Projects\12.0.
  3. Open Client.dll.config.
  4. Copy all the contents of app.config into Client.dll.config and click save.
  5. WCF test client will be refreshed and make sure you don’t see any error in Client.dll.config (Modify Contract name if required).
  6. All WCF methods appear.
Input the parameters to invoke one WCF method and it is working without any certificate issue.

Fixed the vsmdi issue : Root element is missing in Visual Studio 2013

Today I used my .vsmdi in Visual Studio 2013 to run unit tests, and I got the following error.

Error loading C:\TestProject\Test\Test.vsmdi: Root element is missing.

After looking into this issue, for some reason, it was empty in the .vsmdi file.

After adding the following elements in vsmdi and running the tests again, the error was going away.

November 24, 2014

Fixed the WCF issue: When the third digit of Milliseconds is 0, it doesn’t appear In WCF response format

Today one test failed in SOAtest. After looking into this interesting issue, we noticed that it was related to Milliseconds with 2 or 3 digits in WCF response format.

  2014-11-14T16:12:01.107

  2014-11-05T12:01:07.43

In DB, when using the SQL query of RTRIM(CONVERT(char(25),FieldName,127)), I could see Milliseconds with 3 digits all the time:

2014-11-14T16:12:01.107

2014-11-05T12:01:07.430


It means in WCF response format, when the third digit is 0, it is ignored and does not appear. It makes our verification test failed.

The quick workaround to fix this issue is to use Case When in SQL query.

After adding this condition in SQL query, all tests in SOAtest pass without any issue.

(CASE WHEN (CONVERT(char(25),FieldName,127) LIKE '%0')  
      THEN RTRIM(CONVERT(char(22), FieldName,127))
      ELSE RTRIM(CONVERT(char(25), FieldName,127))
 ENDAS RequestDate



November 3, 2014

Fixed the battery issue: 0% available (plugged in, not charging)

Last night I noticed that my personal laptop had the battery issue. It showed 0% available (plugged in, not charging). When it was plugged out, it shut down immediately.

After looking into this interesting issue, here are my ways to fix it.

Go to Device Manager-> Uninstall Microsoft ACPI-Compliant Control Method Battery.



Shut down the laptop. Take out the battery about 10-20 seconds. Put the battery back.


Turn on the laptop, go to Device Manager and in Action tab, click Scan for hardware changes and you are all set. 

October 30, 2014

Parasoft SOAtest: Fixed the issue of WCF: Content Type application/soap+xml; charset=utf-8 was not supported.

Today we had the new deployment to Test Environment. After the deployment, running tests via SOAtest showed the following error.

Message: Content Type application/soap+xml; charset=utf-8 was not supported by service http://xxxxxxxx.svc.  The client and service bindings may be mismatched.

Since we didn’t have any change in data contract in WCF, I needed to know what caused this issue. I tried the following ways.

Updated WSDL : the error still appeared.

Service Account: this one had the issue. After we fixed it, the error still appeared.

I  added one SOAP Client and added the URL. This time I got the different SOAP version. It just showed “Find” , not Find SOAP 1.2.  That explained why I saw the error message above.




Our Developer noticed that Bindings section was missing in web.config compared to the last build. After adding it and deploying to Test environment again, the error message above was gone.




October 22, 2014

Parasoft SOAtest: Change the default lock level to Check Out- Prevent other users from checking out and checking in

SOAtest doesn’t integrate with TFS very well and it has the merge issue. Only 1 person can check out one tst file. If 2 persons are working on the same tst file, once A checks in, B will lose his work. In this situation, when we check out the tst file,  we always select lock type- Check Out- Prevent other users from checking out and checking in.


However, the lock type of unchanged-Keep any existing lock is showing up by default. How can we change it to what we want? Here are the easy steps:  

Launch SOAtest-> Click Window->Preference->Team-Team Foundation Server->Source Control-> Choose Check Out- Prevent other users from checking out and checking in.



Next time if you would like to check out the tst file, it will show up by default .

October 16, 2014

SOAtest: Environments setting is below Test (.tst) [bad design]

In Parasoft SOAtest , if I create 1 Test (.tst) file , Environment is added below the .tst file automatically. I can switch to another environment (DEV, TEST, UAT..)  manually. What if I have 10 .tst files? It means that I have 10 environments.


If our developers change the data contracts in some WCF methods and I need to do regression tests in DEV environment first. In this situation, I need to manually change 10 times to point to DEV from TEST. After testing in DEV and we push a new build to TEST, I need to change 10 times back to TEST again.

Why not have a global environment where we can change it one time only?  I would say Environments setting below Test (.tst) is the bad design.


SOAtest, you should make your own product more user-friendly. 

October 10, 2014

Fixed the issue in SOAtest: Element could not be located or did not contain text content.

In SOAtest, I always select Value Assertion from XML Assertor to validate the data accuracy in WCF response format. Recently I have seen the following error message very often. For example,

Element "../PhoneNumberTen" could not be located or did not contain text content.

If I Click “Evaluate XPath” button, “No nodes found” message appears.



If I view the response data in the Traffic Viewer, PhoneNumberTen is blank. It means when the value is blank, SOAtest regards it as “No nodes found”.


Because the data is dynamic from SQL Server, it is possible to make the test failed due to the issue above. How do I fix this issue?

Add a new Conditional Assertion and use the following condition.

If Has Children Assertion = true

Then validate the value of PhoneNumberTen


It means when the data is blank, the validation will be ignored. 

After using this condition above, the tests pass!

October 9, 2014

Fixed the issue: Use Has Children Assertion to validate part of a string in SOAtest

Our Developer changed the error message in the WCF response format. Due to the long Error Message, how did I validate the error message in SOAtest? The best way in my mind was to contain some keywords such as System.NullReferenceException in SOAtest. 


Long Error Message

Text: System.NullReferenceException: Object reference not set to an instance of an object.   at
.................
System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)




Could SOAtest handle “String Contain”  like C#?  After looking into this interesting issue, I set up the following variable.



I tried “Has Content Assertion”, and it didn't work. I tried “Has Children Assertion" and it worked perfectly.  I would say it is nice to validate part of a string via Has Children Assertion in SOAtest.



September 26, 2014

Need to reconfigure all settings in SOAtest after TFS 2013 upgrade

Our IT department was doing TFS 2013 upgrade last weekend.  After TFS 2013 upgrade, our team saw some issues of SOAtest this week.

When opening SOAtest, I lost the connection to TFS and it showed the error message all the time.

Another team member could connect to TFS in SOAtest , but she could not get the latest version on the project level because “Get Latest version” or “Get Specific Version” was disabled. The interesting part was that she could still get the latest version in the individual tst file. But that was not helpful.

We need to fix this issue as soon as possible. Therefore, the best way to fix this issue is to create a workspace, import all test cases from TFS and reconfigure the settings. Here are the simple steps:

1)    Create a folder in C drive.

2)    Open SOAtest and use that folder as a workspace.

3)    Click file ->import and I can import all test cases from TFS.

4)    Click Parasoft->Preferences and reconfigure all required settings .

5)    Run BVTs and validate if all tests pass.




Another member mentioned that after TFS 2013 upgrade, if we used SOAtest to reconnect to TFS 2013, we should not be able to see the issues above. I totally agreed. 

Why bother testers to reconfigure all settings in SOAtest after TFS 2013 upgrade? 

September 22, 2014

Parasoft SOAtest issue: the characters after & are truncated in Traffic Viewer-Response- Element

This morning I noticed one test failed in SOAtest. After looking into this issue, I have the confidence to say this is the bug on SOAtest side.

We have the SQL query to get the test data and then pass the data in WCF method.

SQL query:

@Name VARCHAR (100)

….Where RTRIM (Name) like '%&%' (Initially we didn’t have this condition .I added it.)

Test Data:

It contains “&” . For example, Name is Ray FURNITURE & EQUIPMENT

SOAtest (DB tool)

Click Traffic Object -> Traffic Viewer-Response-Literal

Ray FURNITURE & EQUIPMENT

Click Traffic Object -> Traffic Viewer-Response-Tree

It doesn’t show the tree nodes. It only shows NewElement.



Click Traffic Object -> Traffic Viewer-Response- Element

results:
  resultSet:
    rows:
      row:
        Name: Ray FURNITURE

I used different data with & several times and I noticed that the result only showed the characters before &. I believe the characters behind & were truncated in SOAtest.

I used different data without & several times and the complete data appeared.


Next time if you see this & issue, don’t feel surprised in SOAtest.

September 19, 2014

Fixed SQL Query: Adding Group By When Using ROW_NUMBER ( )

If we have ROW_NUMBER ( )  in SQL query, using SELECT DISTINCT shows the duplicate record.

SQL query

SELECT DISTINCT
COL1 AS ID,
ROW_NUMBER( ) OVER( ORDER BY COL1) AS RowNum,
COL2 AS FirstName
FROM table
INNER JOIN table ON xx=xx
INNER JOIN table ON xx=xx
INNER JOIN table ON xx=xx
INNER JOIN table ON xx=xx
WHERE ...

Result:


  
How can I remove the duplicate record when using ROW_NUMBER( ) in SQL query? The answer is to use Group By.

Modify SQL query: adding Group By
SELECT
COL1 AS ID,
ROW_NUMBER( ) OVER( ORDER BY COL1) AS RowNum,
COL2 AS FirstName
FROM table
INNER JOIN table ON xx=xx
INNER JOIN table ON xx=xx
INNER JOIN table ON xx=xx
INNER JOIN table ON xx=xx
WHERE ...
GROUP BY COL1, COL2

Result:

September 15, 2014

Fixed the issue- Order by string ( 1,11,2,21,3), not by number (1,2,3,4)

Today I ran the SOAtest and found one test failed.I checked the SQL query and it used 
Order by FieldName. The data is returned as follows (order by string)

1149
1180
1339
135
1365
140
23
.....

When I opened WCF test client and invoked the web service, it returned the following data (order by number)

23
53
60
78
135
140
271
292
453
.....

After looking into this interesting issue, I modified the following SQL query and it is working perfectly.


Order by FieldName *1

August 28, 2014

Fixed the issue in SQL Server 2008- Conversion failed when converting date and/or time from character string.

Today when I executed one SQL query, sometimes it worked, but sometimes it didn’t. It showed the following error:

Conversion failed when converting date and/or time from character string.

After looking into this interesting issue, I found the SQL query used

CONVERT(char(20),FieldDateName,127)

In SQL Server 2008, it is better to use CAST and Datetime2 Type. After using the following way, the error disappeared.

CAST(FieldDateName as Datetime2)

August 27, 2014

WCF: Skip Take Sort in SQL Server 2008

In WCF method, we have an interesting feature called Skip Take Sort.

If we input one member ID, skip=30, take= 40, sort by one Field name and then consume the WCF , the data for that member returned will skip first 30 rows and take the next 40 rows after a sort. 

How can I do it in SQL query? Here is the simple example : Skip 1 and Take 3 after a sort.. It is working perfectly.




August 23, 2014

Fixed the issue: iTunes could not back up iPhone because the backup was corrupt or not compatible with the iPhone

This morning my wife spoke to me that our 2 iPhones are quailed for “iPhone 5 Battery Replacement Program” and told me to back up my iPhone 5 into my laptop via iTunes.

Therefore, I connected my iPhone 5 to Windows 7 laptop, opened iTunes and clicked “Back up now “ button. But  I got the following error message.

iTunes could not back up iPhone because the backup was corrupt or not compatible with the iPhone.


After looking into this issue, here are my steps to fix it.

Close iTunes , disconnect and reconnect iPhone 5 to laptop

Delete the files below the Backup folder

C:\Users\ray\AppData\Roaming\Apple Computer\MobileSync\Backup

Copy the files of video and photos from iPhone 5 to D drive 

Delete all video and photos


Open iTunes , do the backup again and you are all set.

August 19, 2014

WCF Test: Fixed the issue of Zulu Time in Parasoft SOAtest

 If I declare DATE and DATETIME variables, they will display the following date format in SQL Server.  

DECLARE @MyLowDt DATE, @MyHighDt DATETIME

MyLowDt: 2004-02-11
MyHighDt: 2004-02-11 00:00:00.000

In SOAtest, if I get (MyLowDt) DATE variable from SQL query and use it in WCF method, the interesting part is that SOAtest uses Zulu time as an input and never returns the rows I want to see.

MyLowDt: 2004-02-11T08:00:00.000Z  (Zulu Time)

If I get (MyHighDt) DATETIME variable from SQL query and use it in WCF method, SOAtest uses Timestamp with T as an input and can return the rows I want to see.

MyHighDt: 2014-02-11T00:00:00.0

In SQL Server, If I use Zulu time to query the data, I can still get the data back.

Open WCF test Client , input Zulu time and I can get the data back.

But in SOAtest, input Zulu time and I can’t get the data back.

Parasoft  SOAtest, you should make testing life easier. 

August 18, 2014

WCF Test Date Range: Parasoft SOAtest doesn’t return the correct rows in Response Element

Today I found out an interesting issue in Parasoft SOAtest.

Scenario:  Input 2 date fields and one parameter to see if the rows returned from WCF method are correct.

Here is the basic SQL query to get the data where the condition is using 2 different dates. It returns 9 rows and also includes the MinDate.

Field1_name >=’MinDate’ and Field2_name <=’MaxDate’

Open WCF test client, do the same Scenario ,  invoke the WCF method and I get the same result: 9 rows.

What happens to Parasoft SOAtest 9.7?  In SOAtest, double click Traffic View-Traffic Viewer-> Click Request: I see 3 input parameters.

Click Response - >Click Element: I only see 7 rows which do not include the MinDate.

I have the confidence to say my configuration is correct in SOAtest. 

After modifying the following SQL query, all tests in SOAtests pass.

Field1_name >’MinDate’ and Field2_name <=’MaxDate’