cancel
Showing results for 
Search instead for 
Did you mean: 

how to compare a string in a resource.dll

Highlighted
Occasional Contributor

how to compare a string in a resource.dll

Hi,



what I'd like to be able to do is compare a string for a control with its associated string in the resource.dll file



I'm using VB script in TestComplete our Tested Application is written in C# and we have lots of resource files for the different languages our application runs under.



I'd like to check that a particular string is correctly being translated and that the translation is in the relevant resource file



If anybody has any clue on how to do this it would be very much appreciated!!



many thanks in advance



regards

K







Kay Chamberlain
Leica Microsystems Cambridge Ltd
1 REPLY 1
Highlighted

RE: how to compare a string in a resource.dll

Hello Kay,




You can use the script below to get all resources in the specified assembly. Before you run the script, you need to specify the full path to the needed assembly in the 'assemblyPath' variable.




Sub Test


Dim i, assemblyPath, assembly, names, stream, resourceReader, enumerator




assemblyPath = "C#_ASSEMBLY_PATH"




Set assembly = dotNET.System_Reflection.Assembly.LoadFile(assemblyPath)


Set names = assembly.GetManifestResourceNames()


For i = 0 To names.Length - 1


Log.AppendFolder("Resource: " + names.GetValue(i))


Set stream = assembly.GetManifestResourceStream(names.GetValue(i))


Set resourceReader = dotNET.System_Resources.ResourceReader.zctor_2(stream)


Set enumerator = resourceReader.GetEnumerator


While enumerator.MoveNext()


Log.Message("Key: " & enumerator.Key & vbCrLf & "Value: " & enumerator.Value)


Wend


Log.PopLogFolder


Next


End Sub





To compare two strings, you can use the aqString.Compare method. Please read the "aqString.Compare" article fore more information.
--
Dmitry Nikolaev

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!

Challenge Status

Changing options from outside of TestComplete

Participate!

How to execute remote test and obtain results via Test Runner REST API

Participate!

Comparing content of HTML table with Excel file data

Participate!

Compare HTML table with Excel file and correct data in the file

Participate!
Top Kudoed Authors