Hi,
I am using Test Studio Standalone, as per the override app.config guide, i cut and pasted the VB code. I added the references (System.Configuration), System.Reflection namespace already existed.
I am getting a runtime error.....
InnerException:
System.Configuration.ConfigurationErrorsException: An error occurred loading a configuration file: The parameter 'exePath' is invalid.
Parameter name: exePath ---> System.ArgumentException: The parameter 'exePath' is invalid.
code:
Public Sub readExcel_CodedStep3()
'Navigate to : 'http://www.google.com.au/'
ActiveBrowser.NavigateTo("http://www.google.com.au/", true)
Dim [me] As Assembly = Assembly.GetExecutingAssembly()
Log.WriteLine([me].ManifestModule.Name)
Log.WriteLine(Me.ExecutionContext.DeploymentDirectory)
Dim config As Configuration = ConfigurationManager.OpenExeConfiguration(System.IO.Path.Combine(Me.ExecutionContext.DeploymentDirectory, [me].ManifestModule.Name))
Assert.IsNotNull(config)
Dim url As String = config.AppSettings.Settings("LoginPageUrl").Value
'Log.WriteLine(url)
Dim name As String = config.AppSettings.Settings("LoginName").Value
'Log.WriteLine(name)
Dim pw As String = config.AppSettings.Settings("Pass").Value
'Log.WriteLine(pw)
Dim UserId As String = config.AppSettings.Settings("UserId").Value
'Log.WriteLine(UserId)
Dim conn As String = config.ConnectionStrings.ConnectionStrings("ConnectionString").ConnectionString
'Log.WriteLine(conn)
End Sub
Appreciate if someone can provide help please.
Thanks
Govind
I am using Test Studio Standalone, as per the override app.config guide, i cut and pasted the VB code. I added the references (System.Configuration), System.Reflection namespace already existed.
I am getting a runtime error.....
InnerException:
System.Configuration.ConfigurationErrorsException: An error occurred loading a configuration file: The parameter 'exePath' is invalid.
Parameter name: exePath ---> System.ArgumentException: The parameter 'exePath' is invalid.
code:
Public Sub readExcel_CodedStep3()
'Navigate to : 'http://www.google.com.au/'
ActiveBrowser.NavigateTo("http://www.google.com.au/", true)
Dim [me] As Assembly = Assembly.GetExecutingAssembly()
Log.WriteLine([me].ManifestModule.Name)
Log.WriteLine(Me.ExecutionContext.DeploymentDirectory)
Dim config As Configuration = ConfigurationManager.OpenExeConfiguration(System.IO.Path.Combine(Me.ExecutionContext.DeploymentDirectory, [me].ManifestModule.Name))
Assert.IsNotNull(config)
Dim url As String = config.AppSettings.Settings("LoginPageUrl").Value
'Log.WriteLine(url)
Dim name As String = config.AppSettings.Settings("LoginName").Value
'Log.WriteLine(name)
Dim pw As String = config.AppSettings.Settings("Pass").Value
'Log.WriteLine(pw)
Dim UserId As String = config.AppSettings.Settings("UserId").Value
'Log.WriteLine(UserId)
Dim conn As String = config.ConnectionStrings.ConnectionStrings("ConnectionString").ConnectionString
'Log.WriteLine(conn)
End Sub
Appreciate if someone can provide help please.
Thanks
Govind
9 Answers, 1 is accepted
0
Hi Govind,
I believe the error message is trying to tell you that it could not find the target DLL at the path indicated. In your case the it's expecting to find is "C:\Telerik\vb-code\vb-code.dll". Can you confirm that DLL is located in that folder?
In addition it's expecting to find the config file in the same folder i.e. "C:\Telerik\vb-code\vb-code.dll.config". Did you put your config file in this folder and give it that name?
Regards,
Cody
Telerik
I believe the error message is trying to tell you that it could not find the target DLL at the path indicated. In your case the it's expecting to find is "C:\Telerik\vb-code\vb-code.dll". Can you confirm that DLL is located in that folder?
In addition it's expecting to find the config file in the same folder i.e. "C:\Telerik\vb-code\vb-code.dll.config". Did you put your config file in this folder and give it that name?
Regards,
Cody
Telerik
0
Govind
Top achievements
Rank 1
answered on 28 Aug 2014, 12:16 AM
Hi Cody,
The dll is located in the below folder
Assembly Found: C:\Telerik\vb-code\bin\vb-code.dll
I made a copy of the vb-code.dll and placed in under
C:\Telerik\vb-code\vb-code.dll
I didn't get runtime error but now got Null Reference Error
System.NullReferenceException: Object reference not set to an instance of an object
Please advice how can i set the values and how do i see the config under the properties explorer in Telerik Test Studio. I am using a standalone version.
Why did Test Studio throw an error when the vb-code.dll was placed in bin folder by default?
I need to get moving on the config appreciate your speedy reply.
thanks
govind
The dll is located in the below folder
Assembly Found: C:\Telerik\vb-code\bin\vb-code.dll
I made a copy of the vb-code.dll and placed in under
C:\Telerik\vb-code\vb-code.dll
I didn't get runtime error but now got Null Reference Error
System.NullReferenceException: Object reference not set to an instance of an object
Please advice how can i set the values and how do i see the config under the properties explorer in Telerik Test Studio. I am using a standalone version.
Why did Test Studio throw an error when the vb-code.dll was placed in bin folder by default?
I need to get moving on the config appreciate your speedy reply.
thanks
govind
0
Govind
Top achievements
Rank 1
answered on 28 Aug 2014, 12:40 AM
Hi Cody,
I come from Java background with lot of selenium experience. We use properties file in java for intial setup of environments, test login, password, etc. The main program will just read and load from the properties, this way we can run the same test against any environment (dev, test, qa, prod, etc).
Please advice through override app.config, can we emulate the same in Test Studio using VB.net. I am not able to see the config in properties explorer in test studio for the code that i shared. Please share if you have any video which can help us to get over this config problems.
thanks
govind
I come from Java background with lot of selenium experience. We use properties file in java for intial setup of environments, test login, password, etc. The main program will just read and load from the properties, this way we can run the same test against any environment (dev, test, qa, prod, etc).
Please advice through override app.config, can we emulate the same in Test Studio using VB.net. I am not able to see the config in properties explorer in test studio for the code that i shared. Please share if you have any video which can help us to get over this config problems.
thanks
govind
0
Hello Govind,
Thank you for the additional information.
Cody will update this ticket shortly.
Thank you for your patience.
Regards,
Boyan Boev
Telerik
Thank you for the additional information.
Cody will update this ticket shortly.
Thank you for your patience.
Regards,
Boyan Boev
Telerik
0
Hello Govind,
We need to update our code sample. Here is the correct code:
Also here is the app.config file I used with it:
Regards,
Cody
Telerik
We need to update our code sample. Here is the correct code:
'Navigate to : 'http://www.google.com.au/'
ActiveBrowser.NavigateTo(
"http://www.google.com.au/"
,
True
)
Dim
[me]
As
Assembly
=
Assembly
.GetExecutingAssembly()
Dim
exePath
As
String
= [me].ManifestModule.
Assembly
.Location
Log.WriteLine(exePath)
Dim
config
As
Configuration = ConfigurationManager.OpenExeConfiguration(exePath)
Assert.IsNotNull(config)
Dim
url
As
String
= config.AppSettings.Settings(
"LoginPageUrl"
).Value
Log.WriteLine(url)
Dim
name
As
String
= config.AppSettings.Settings(
"LoginName"
).Value
Log.WriteLine(name)
Dim
pw
As
String
= config.AppSettings.Settings(
"Pass"
).Value
Log.WriteLine(pw)
Dim
UserId
As
String
= config.AppSettings.Settings(
"UserId"
).Value
Log.WriteLine(UserId)
Dim
conn
As
String
= config.ConnectionStrings.ConnectionStrings(
"ConnectionString"
).ConnectionString
Log.WriteLine(conn)
Also here is the app.config file I used with it:
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
configuration
>
<
appSettings
>
<
add
key
=
"LoginPageUrl"
value
=
"URL value"
/>
<
add
key
=
"LoginName"
value
=
"Login name value"
/>
<
add
key
=
"Pass"
value
=
"Pass value"
/>
<
add
key
=
"UserId"
value
=
"UserId value"
/>
<
add
key
=
"ConnectionString"
value
=
"ConnectionString value"
/>
</
appSettings
>
<
connectionStrings
>
<
add
name
=
"ConnectionString"
providerName
=
"System.Data.ProviderName"
connectionString
=
"Valid Connection String;"
/>
</
connectionStrings
>
</
configuration
>
Regards,
Cody
Telerik
0
Govind
Top achievements
Rank 1
answered on 04 Sep 2014, 02:53 AM
Hi Cody,
am getting a different error, have attached the source code, file directory, etc. I made changes to the ArtOftest.Runner.exe.config, replaced the original one with your recommendation.
thanks
govind
am getting a different error, have attached the source code, file directory, etc. I made changes to the ArtOftest.Runner.exe.config, replaced the original one with your recommendation.
thanks
govind
0
Hello Govind,
First you should not be modifying ArtOftest.Runner.exe.config. Your app.config file needs to be placed in the test projects bin folder and named the same as the test dll that gets compiled. It appears in your case you should be naming your config file "vb-code.dll.config" and placing it in the bin folder, right next to your actual vb-code.dll file.
The next problem I see is that inside of readExcel.tstest.vb is this line of code:
Dim config As Configuration = ConfigurationManager.OpenExeConfiguration(System.IO.Path.Combine(Me.ExecutionContext.DeploymentDirectory, [me].ManifestModule.Name))
This must be replaced with this:
Dim config As Configuration = ConfigurationManager.OpenExeConfiguration(exePath)
As I showed you in my last code sample.
Regards,
Cody
Telerik
First you should not be modifying ArtOftest.Runner.exe.config. Your app.config file needs to be placed in the test projects bin folder and named the same as the test dll that gets compiled. It appears in your case you should be naming your config file "vb-code.dll.config" and placing it in the bin folder, right next to your actual vb-code.dll file.
The next problem I see is that inside of readExcel.tstest.vb is this line of code:
Dim config As Configuration = ConfigurationManager.OpenExeConfiguration(System.IO.Path.Combine(Me.ExecutionContext.DeploymentDirectory, [me].ManifestModule.Name))
This must be replaced with this:
Dim config As Configuration = ConfigurationManager.OpenExeConfiguration(exePath)
As I showed you in my last code sample.
Regards,
Cody
Telerik
0
Govind
Top achievements
Rank 1
answered on 08 Sep 2014, 12:23 AM
Hi Cody,
Finally able to see the config value. This is working now.
Thank you very much.
regards
Govind
Finally able to see the config value. This is working now.
Thank you very much.
regards
Govind
0
Hi Govind,
Wonderful! Thank you for the update. I am closing this ticket as resolved.
Regards,
Cody
Telerik
Wonderful! Thank you for the update. I am closing this ticket as resolved.
Regards,
Cody
Telerik