This is a migrated thread and some comments may be shown as answers.

Please make sure your test code behind is compiled with your latest changes

1 Answer 72 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ellery
Top achievements
Rank 1
Ellery asked on 09 Oct 2012, 11:31 PM
Developed an abstract class for db connections, i want to use these class in a code step, but logically i can't make an instance of these class, so, in my abstract class inherited from BaseWebAiiTest and then inherited from my abstract class in the main class of my code behind.
For example:
My Abstrac Class
public abstract class ConDB : BaseWebAiiTest
{
private SqlConnection _conn;
private SqlCommand _command;
private bool disposed = false;
public ConDB(string nameConn = "Conn")
{
this._conn = new SqlConnection(ConfigurationManager.AppSettings[nameConn].ToString());
this._command = this._conn.CreateCommand();
this._command.CommandType = System.Data.CommandType.StoredProcedure;
}
public void ExecuteNoQuery(string spName, SqlParameter[] parameters)
{
this._command.CommandType = System.Data.CommandType.StoredProcedure;
this._command.CommandText = spName;
this._command.Parameters.Clear();
this._command.Parameters.AddRange(parameters);
if (this._conn.State != ConnectionState.Open)
{
this._conn.Open();
}
this._command.ExecuteNonQuery();
this._conn.Close();
}
In my codebehind file instead of
public class AltamasEstablecerContraseña : BaseWebAiiTest
I wrote
public class AltamasEstablecerContraseña : ConDB
So, When i try to run the test appear the error:
Please make sure your test code behind is compiled with your latest changes
And all my codebehind files are compiled sucessfully
Please help me, thanks in advance!!

1 Answer, 1 is accepted

Sort by
0
Stoich
Telerik team
answered on 12 Oct 2012, 10:05 AM
Hi Ellery,
I'm not sure why you're getting this error message:
Please make sure your test code behind is compiled with your latest changes
I've seen it before but it's been a while. Are you using Visual Studio 2008? You might simply need to build the project (which might be as simple as pressing F6).

In any case: you probably shouldn't try to modify the code-behind file
public class AltamasEstablecerContraseña : BaseWebAiiTest

The code-behind file has a special relation to the corresponding test and I highly recommend that you don't change the class it inherits. Instead why not put the SQL logic in a separate, non-abstract class. Then you can invoke the logic from a coded step from your BaseWebAiiTest class:
http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/coded_steps.aspx

Or you can even create a separate project for this:
http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/code-samples/general/use-external-dll.aspx

The following article might be of interest for you also:
http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/code-samples/general/access-sql-database.aspx

Kind regards,
Stoich
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Ellery
Top achievements
Rank 1
Answers by
Stoich
Telerik team
Share this question
or