Migrate Test Case Issue

May 29, 2014 at 5:39 AM
I am following below steps but still I see Migrate Testcases Button Disabled. Please Help
Opened the tool
Browsed TFS Team Project and specified test plan
Click on “Migrate Test Cases” tab
Selected Source Team Foundation Server Project
Selected Source Test Plan
Selected Destination Team Foundation Server Project
Selected Destination Test Plan
Selected Default JSON files folder
Click on Migrate Shared Steps - As no steps were shared so nothing happened. works fine
Click on Migrate Test Suites - Suits were migrated successfully.
Click on Migrate Test Cases - This is still disabled , don't know when and how it gets enabled whereas Add Test Cases To Suites button was enabled. please help.
May 30, 2014 at 4:27 AM
Please respond
Coordinator
May 30, 2014 at 8:19 AM
Hi there,

Looking at the code, it seems that clicking the Migrate Shared Steps button enables the "Migrate Test Cases" button. If this is still not working I can tell you where to change 1 row in the code to make it enabled always or wait until noon when I get home to troubleshoot it more detailed.

Please tell me which variant is ok for you. :)

Anton
May 31, 2014 at 10:06 AM

Thanks for the quick reply. I am fine with both, if you can guide me to change the code then it's fine.

Coordinator
May 31, 2014 at 10:19 AM
Ok man,

Find download the source code. Open the TesstCaseManager project. Under the views folder you will find the file TestCasesMigrationView.xaml. Open it.

Search for the following row of xaml:
<Button Content="Migrate Test Cases" Name="btnMigrateTestCases" Margin="25" Width="180" Height="30" Click="btnMigrateTestCases_Click" Grid.Row="3" Grid.Column="0" IsEnabled="{Binding IsSharedStepsMigrationFinished}"/>

Change IsEnabled="{Binding IsSharedStepsMigrationFinished} with IsEnabled="True" or just remove it because the default value is true.

I have set it in order to make the migration process more safe, because if you had shared steps it was going to be mandatory to migrate them before the test cases.

Please write me back if the fix worked for you. :)

Anton
Jun 3, 2014 at 4:51 AM
Thanks Anton,

Followed the steps suggested by you and it does enable the button 'Migrate Test Cases' but when i clicked on the button , under Current Progress it just kept on saying Prepare Source test Cases.., waited for 2 hours to get the operation completed but without any success. Note : - I was only trying to migrate 4 test cases in the sample suite.

Please advise..

Thanks,
Prashant
Coordinator
Jun 3, 2014 at 10:08 AM
Edited Jun 3, 2014 at 10:09 AM
Hi Prashant,

There is definitely a problem. Can you please find the app log located here: %USERPROFILE%\Documents\TestCaseManager\ExecutionLog.log.
Can you paste it here or sent it to my email to review it. You can try also to figure it out alone of course. I believe that it is a local problem with your TFS version or TFS template or something TFS related, I don't know. Because I tried the tool multiple times against my private VS Team Foundation Services in the cloud, different Team project, TFS 2012 version. And two times against different corporate TFS team projects, TFS version 2010 where I used it to to transfer over 3000 test cases and 2000 shared steps. :)

Anton
Jun 3, 2014 at 11:51 AM
Edited Jun 4, 2014 at 4:29 PM
Removed these as already sent in email
Jun 3, 2014 at 11:52 AM
Thanks Anton,

Above Log file is not complete.. I will send you the whole file on your email shortly.
Coordinator
Jun 3, 2014 at 1:12 PM
Yep I will need the complete log :)

use the following email: angelov.st.anton @ hotmail.com
(without spaces)

Anton
Jun 4, 2014 at 11:56 AM
Hi Anton,

Please find complete log attached.

Thanks,
Prashant


Coordinator
Jun 4, 2014 at 4:57 PM
Hi man,

I have looked into your log. No related errors are logged.

I cannot tell much if I don't debug the code. However you can do it yourself.
Open the project "TestCaseManagerCore" under the folder ViewModels you will find the file TestCasesMigrationViewModel. Search for the method MigrateTestCasesFromSourceToDestinationInternal. Place a breakpoint in the begining of the method and observe what will happen. I believe it's possible that your current TFS user don't have permission to one of the TFS Team Projects because the log stops to the methods which use the TFS API to get all test cases from the first Team Project.
Also be sure that you follow the documentation exactly. If you already have used the migration, browse the specific step JSON log files because there is kept the entire state of the migration.


Anton
Sep 7, 2014 at 2:26 PM
I am having the same issue. The "Migrate Test Case" button is disabled. I tried to download the source code to change the xaml file but it won't compile.
Please help...
It worked once but won't work after that...

Vik
Coordinator
Sep 7, 2014 at 5:08 PM
Edited Sep 7, 2014 at 5:11 PM
Hi Vik,

I read your execution logs. First you cannot delete shared steps and test cases as you wrote in your email, you can remove only the suites. Shared steps and test cases are TFS test items which cannot be deleted.

I saw in your logs that 3 steps are executed -> test cases migration, suites migration and test case = suites association.

However there are several exceptions in the suites migration and in the test case migration.
Suites migration:
Duplicate suite name detected in suite 8408. Suite names must be unique within a common parent.

You can check the log to find the exact ids. This means that there are suites with the same name under common parent which is potentially a bug and it is not allowed by the TFS API and I don't know how you managed to do it. However I believe that you can fix the issue by renaming the names of the wrong suites with same names.

Next about the test case migration, it seems that there are test cases with not allowed characters in their titles:

_2014-09-06 20:06:36,045 [FSXM1\gwason] [9] INFO TestCaseManagerCore.ViewModels.TestCasesMigrationViewModel - Start Migrating Test Case with Source Id= 3048
2014-09-06 20:06:36,217 [FSXM1\gwason] [9] ERROR TestCaseManagerCore.ViewModels.TestCasesMigrationViewModel - System.Xml.XmlException: The ':' character, hexadecimal value 0x3A, cannot be included in a name.

2014-09-06 20:06:36,954 [FSXM1\gwason] [9] INFO TestCaseManagerCore.ViewModels.TestCasesMigrationViewModel - Start Migrating Test Case with Source Id= 3051
2014-09-06 20:06:37,098 [FSXM1\gwason] [9] ERROR TestCaseManagerCore.ViewModels.TestCasesMigrationViewModel - System.Xml.XmlException: The ':' character, hexadecimal value 0x3A, cannot be included in a name.

2014-09-06 20:06:37,585 [FSXM1\gwason] [9] ERROR TestCaseManagerCore.ViewModels.TestCasesMigrationViewModel - System.Xml.XmlException: The ':' character, hexadecimal value 0x3A, cannot be included in a name.
at System.Xml.XmlDocument.CheckName(String name)

2014-09-06 20:06:39,287 [FSXM1\gwason] [9] INFO TestCaseManagerCore.ViewModels.TestCasesMigrationViewModel - Start Migrating Test Case with Source Id= 3058
2014-09-06 20:06:39,528 [FSXM1\gwason] [9] ERROR TestCaseManagerCore.ViewModels.TestCasesMigrationViewModel - System.Xml.XmlException: The ':' character, hexadecimal value 0x3A, cannot be included in a name._


You can check the logs for more examples. You can find the exact IDs of the problematic test cases and try to fix their names.

In order to execute the procedure correctly, you need to do it after the initial run and you to load the first generated JSON files for every step where the migration mappings are kept.
For example source test case id = destination test case id and if the migration is successful. If you don't load the JSON file you potentially are going to end with duplicated test cases. Again just to remind you, test cases and shared steps cannot be deleted.

You can find more information about how the migration works in my blog post: http://aangelov.com/2014/05/05/migrate-tfs-test-cases-tfs-team-projects-tfs-servers-test-case-manager/

One more thing even if you don't have shared steps in your project you need to execute the step. Please follow the exact instructions in the article.

I hope that this information helps you. Please write back about the result.

Best regards,

Anton
Sep 10, 2014 at 6:10 PM
Thanks Anton - for the reply. I am not sure about the shared steps but I used destroywi command to delete the test cases from the destination project. There are a total of 1700 test cases to be migrated but the tool stopped after 1550. So I deleted them command-line. And I also deleted the test suites.

I will look at the log and will clean-up the test case with duplicate names and/or special characters.

What do I need to do now to enable the "Migrate Test Cases" button? I can try loading the original JSON file if that helps.

Thanks,

Vik
Sep 10, 2014 at 6:30 PM
I am following the guide exactly. And everytime I am executing all the steps including 'shared steps'. Since I deleted the test cases I shouldn't use the old JSON file as then it'll skip the already migrated cases (which don't exist in the destination project anymore).

The biggest issue is the Migrate Test Case button is disabled.
Coordinator
Sep 11, 2014 at 10:36 AM
Hi man,

I can build you a special version of the tool with enabled buttons but I don't know what will happen when you run it after the cmd deletion tool.
If that is ok with you when I come back from work I will build you a special build and send it to you by email.

Just confirm that you are ok with that solution and I will do it.

Thank you!

Anton
Sep 11, 2014 at 11:13 AM
Yes, please that should work.
Coordinator
Sep 11, 2014 at 11:02 PM
Hi man here you go, as I promised. https://testcasemanager.codeplex.com/releases/view/122083 The latest added zip.

Please write me back if everything is ok.

Good luck.

Anton
Sep 12, 2014 at 12:25 AM
Thank you so much Anton. First, I am going to remove the special characters in the names and remove the duplicate test suites. Then I'll the export/import. Again - I really appreciate your help.
Sep 12, 2014 at 12:54 AM
The tool also complained of hexadecimal values in the names.

2014-09-06 20:06:27,308 [FSXM1\gwason] [9] ERROR TestCaseManagerCore.ViewModels.TestCasesMigrationViewModel - System.Xml.XmlException: The ':' character, hexadecimal value 0x3A, cannot be included in a name.

But when I checked the test cases it errored on I didn't find any hexadecimal values.

1.1.01 Recent Filings section under Mgmt Dashboard for a Complaint
1.1.02 General tab of Filing Details for a Complaint Filing
1.1.03 Notifications tab of Filing Details for a Complaint Filing
1.1.04 Notifications tab of Filing Details for a SUBF Filing
Coordinator
Sep 12, 2014 at 6:37 AM
Can you save somewhere your current names and try to change them with something simple- one word. the 0x3A is the hex representation of ":". However I have a lot of test cases in my TFS with special characters like the mentioned one.

The most easiest way the understand the problem is to debug it but we can find it with the probe effect.

I have one more thing on my mind. I don't know your nationality but is it possible in some of the names to have letters from different language which visually are looking like the English one.


Anton
Sep 12, 2014 at 10:49 AM
When I saw the errors for ":" I checked the 1550 migrated test cases and a lot of them had the special character in the title. I am in US but have development/test team in India. I have asked them to see if they can clean the titles of the 53 test cases from the execution log.
Coordinator
Sep 12, 2014 at 12:41 PM
Ok man. Keep me updated. I will help you with whatever I can.

Good luck!

Anton :)
Sep 13, 2014 at 3:33 PM
While we still cleaning up the test cases I downloaded and installed the latest release but when I start the application the "Migrate Test Case" button is still disabled.
Coordinator
Sep 14, 2014 at 7:40 PM
Hi mate,

Can you try to run the exe from the zip directly, don't install it, because I didn't create it like click-once application and it is not registered in the site. I have uninstalled my previously installed version and ran it directly from the zip and the button is enabled.

Anton
Sep 15, 2014 at 2:15 PM
Yes - the button is enabled running the exe. Now waiting for test team to clean-up the test cases so I can do the import. Thanks so much for your help!! Will keep you posted..
Sep 18, 2014 at 10:44 PM
I had the team run a query to find all test case titles with ":" in the names and remove them to fix the special character issue. However I picked one test case 4115 from the execution log that wasn't fixed by the team. The log says there's a special character in the name but I don't see it.

Title from VS - 1.1.04 Notifications tab of Filing Details for a SUBF Filing

Execution log ---
2014-09-06 20:08:25,728 [FSXM1\gwason] [9] INFO TestCaseManagerCore.ViewModels.TestCasesMigrationViewModel - Start Migrating Test Case with Source Id= 4115
2014-09-06 20:08:26,177 [FSXM1\gwason] [9] ERROR TestCaseManagerCore.ViewModels.TestCasesMigrationViewModel - System.Xml.XmlException: The ':' character, hexadecimal value 0x3A, cannot be included in a name.
at System.Xml.XmlDocument.CheckName(String name)
at System.Xml.XmlElement..ctor(XmlName name, Boolean empty, XmlDocument doc)
at System.Xml.XmlDocument.CreateElement(String prefix, String localName, String namespaceURI)
at System.Xml.XmlDocument.CreateElement(String qualifiedName, String namespaceURI)
at Microsoft.TeamFoundation.TestManagement.Client.HtmlParser.ParseHtmlContent()
at Microsoft.TeamFoundation.TestManagement.Client.HtmlToXamlConverter.ConvertHtmlToXaml(String htmlString, Boolean asFlowDocument)
at Microsoft.TeamFoundation.TestManagement.Client.ParameterizedString..ctor(String value)
at Microsoft.TeamFoundation.TestManagement.Client.ParameterizedString.op_Implicit(String value)
at TestCaseManagerCore.BusinessLogic.Managers.TestCaseManager.Save(TestCase sourceTestCase, ITestManagementTeamProject testManagementTeamProject, ITestPlan testPlan, Boolean createNew, Nullable1 suiteId, ICollection1 testSteps, Boolean shouldAssignArea)
at TestCaseManagerCore.ViewModels.TestCasesMigrationViewModel.MigrateTestCasesFromSourceToDestinationInternal()

I am confused now..??
Coordinator
Sep 21, 2014 at 5:49 PM
Hi,

We can try two things in order to understand the problem. It's really hard to suggest a fix without debugging. However I searched again the internet for similar exception messages. As you know the TFS API is not public and there is not much information on the matter.
So can you try to duplicate the problematic test case. I believe the same exception should appear? Second, it is it possible some of the suite names to contain special symbols because the above exception message I'm not quite sure that it is about the title of the test cases. You should know that this is internal error of the TFS API and it's not from a code that I wrote which makes the resolution much harder.

Any way I will try to help you as much as I can. :)

Regards,
Anton
Sep 21, 2014 at 6:15 PM
We cleaned up all the test cases with ":" in the title. And I have told the team to remove any other special characters from the title (other than hyphen, period or comma). Hopefully that will help.

Does the tool migrate any custom fields? We have some custom fields that exist in both source and destination and we would like them to be migrated. Is there a way to specify custom fields?

Thanks,

Vik
Coordinator
Sep 21, 2014 at 6:57 PM
Hm, custom fields you say. Maybe the whole problem comes from there... Currently the tool only migrate the base TFS Test Case Item fields.

The exception is too generic and it's related to the XML representation of the test case items in TFS storage (TFS 2012). Maybe this is related to your custom item template.
It's best if you can debug the code if nothing else help and if it's important for you to add additional logic to the tool for your custom fields.

However can you try the two suggested steps in my previous post in order to see what will happen.

Thank you.,
Anton
Sep 21, 2014 at 9:01 PM
More than 50 test cases failed due to special characters in the titles. I am not sure what you mean by duplicating the problematic one.....
Coordinator
Sep 21, 2014 at 9:10 PM
When you open the initial view of the test case manager, find the test case and right click on it in order to display the context menu where you are going to find the duplicate command. Or just select the test case and use the button duplicate. The duplicate function will create a copy of your test case + your new changes. The migration logic uses almost the same code as the duplicate, just in large scale. It will be easier to resolve the problem just for one test case first and then proceed with the fix for all of them.

Anton
Sep 21, 2014 at 10:41 PM
Image
Sep 22, 2014 at 2:36 PM
We have now removed all special characters from titles. I'll try the migration this weekend and let you know how it goes.
Sep 25, 2014 at 7:04 PM
We searched thru all the test suites and there are over 700 suites with duplicate names. And it seems to make sense. Think about suites as folders. And you may have folders for production, beta testing, integration etc. The functionalities you test under these folders/areas will be similar except the servers, URLs, test data etc. may change.

In short, I could have a suite named "Change password" under each of the above 4 suites. This is how test cases are organized.

We can't think of any easy way to fix the duplicate names and are planning on giving the migration another try.

Any thoughts/suggestions.

Vik
Coordinator
Sep 25, 2014 at 9:34 PM
Hi Vik,

I don't think that you have fully understand me. I will try one more time.
Here you can find more information about the "Initial Test Case Manager View"/All Test Cases View what ever- https://testcasemanager.codeplex.com/wikipage?title=All%20Test%20Cases%20View&version=4
There you can find the "Duplicate" button or just select the desired test case and click "Duplicate" from the context menu.

The point about this is to find one of the failed synced test cases and try to duplicate it. I believe that most probably when you try to save the new test case the creation will fail. However you can try to remove different things from the test case- test steps, different title, additional fields. When you try it a couple of times, I assume that we can find the main reason behind the failing migration.

The suite title duplication isn't a problem because internally the suites are represented with unique IDs and the migration use them, so I believe that you don't need to change the suite names.

I hope this helps you.

All the best,
Anton
Sep 26, 2014 at 2:40 PM
Ok - got it now. I'll try these steps tonight. Should I pick one of the test cases that failed due to special characters? Although we have cleaned up all special characters.
Coordinator
Sep 26, 2014 at 2:50 PM
Yep, get one of the failing test cases- select it by id or whatever, the exception is misleading, the problem might be somewhere else.

Anton :)
Sep 26, 2014 at 2:56 PM
Thanks again for your help - can't wait to try it out....
Sep 26, 2014 at 8:31 PM
I tried to duplicate one of the errored test case - got this error..
Image
Coordinator
Sep 27, 2014 at 7:16 AM
Hi man,

Can you please send me the picture to my mail- attached. Because I don't know why, I cannot open the images.

Thank you!

Anton
Coordinator
Sep 27, 2014 at 2:27 PM
Ok... can you try to change 1 by 1 the different properties and try to duplicate again.
Example:
  1. Change the whole title -> duplicate
    IF error is there again
  2. Delete All Test Steps -> Duplicate
    If error is still there
  3. Change another properties and so on...
Anton :)
Sep 27, 2014 at 2:44 PM
Trying now....
Sep 27, 2014 at 2:50 PM
Changed the title but got the same error......

Deleted 1-4 steps....same error....

Deleted 5-8 steps...same error...

Deleted 9-11 steps..........worked.......it let me save it.....

So let me figure out exactly which step is causing it
Sep 27, 2014 at 3:01 PM
Found the test step causing the issue....

Select any document type with stat fee=$0 from the document type drop down
Comments:<Doc Type: Affidavit:($0.00)> User should be able to select any document with stat fee =$0 from the 'Document type' drop down

What to do now?
Sep 27, 2014 at 5:14 PM
So I removed all the ":" from steps and it seems to be working. But I don't see any execution log. There a few errors but I can't find the execution log...??
Coordinator
Sep 28, 2014 at 8:20 AM
Hm... I see the problem now. In the new versions of TFS the test case and its test steps are saved in TFS DB as XML. I use TFS method for escaping but probably it doesn't escape the ":". So you can use "Find and Replace" functionality in Test Case Manager (see the documentation) and replace the ":"- only in test steps, don't turn-on the other options.

About the execution log- have you deleted? You cannot find it documents folder is that right? Try to search it in the entire directory if you don't find it, try to give greater permissions to the folder where it is usually placed. If that doesn't work, mm I don't know, maybe you can restart the computer and try again with simple step like creating new test case to see if the log is created. If that doesn't help try to pre-install the Test Case Manager this should work.

Anton
Sep 28, 2014 at 1:21 PM
Ok, so most of the things got migrated. The only thing that remains is some of the test cases didn't get added to the suites.
Sep 28, 2014 at 3:34 PM
For the execution log....remember I never installed the application? I am just running the exe from the new downloaded files that you provided with the migrate test case button enabled. Is that why there's no execution log?
Coordinator
Sep 28, 2014 at 4:28 PM
I don't think so... Can you give permissions to the folder of the execution log and probably run the app as administrator. Try to create a new test case or edit existing one to see if the log is created. :)

Anton
Sep 28, 2014 at 4:45 PM
The folder has permissions as that's where the json files are being saved. I'm trying running it as admin...
Coordinator
Sep 28, 2014 at 5:55 PM
MM just one question. By execution log you mean the file that is saved in Documents under your Users folder right?
Sep 28, 2014 at 6:30 PM
yep....
Coordinator
Sep 28, 2014 at 6:58 PM
I really don't know what can be the problem because I'm using log4net which is a .NET solution for logging. Nobody until now has such a problem.

Have you tried to restart the machine?

Hmm another thing you can do is to find the following file: Log4Net.config if you edit it you can hardcode the path to the log ;)

Just change the value of the following row:

<param name="File" value="${USERPROFILE}/Documents/TestCaseManager/ExecutionLog.log"/>

Anton :)
Sep 28, 2014 at 8:43 PM
Haven't been able to restart the machine as there some other stuff I am working on. I did try and edit the log4net.config file and hard coded the path but still no luck.
The execution log was being produced before when I had installed the app - but I am directly using the downloaded app - is that making a difference?

Most of the things worked so we are in a good shape but if we can get the test cases added to the suites that'll be really wonderful. Will reboot the machine later today and try....

Thanks a lot for your help!!