Hello,
I am trying to aumate UI tests to mu Silverlight App.
I'll need to setup my Oracle database before I run some tests. And cleanup my database after I run the test.
I have a C# sample code that does this operation but the compilation is not correct.
I created a script step and I copy this code there as:
[CodedStep(@"New Coded Step")]
public void connectDB_CodedStep()
{
string connectionString = "User Id=myusername;Password=mypassword;Data Source=(DESCRIPTION=" +
"(ADDRESS=(PROTOCOL=myprotocol)(HOST=myhost)(PORT=myport))" +
"(CONNECT_DATA=(SID=mysid)));";
using (OracleConnection connection = new OracleConnection())
{
connection.ConnectionString = connectionString;
connection.Open();
Console.WriteLine("State: {0}", connection.State);
Console.WriteLine("ConnectionString: {0}",
connection.ConnectionString);
OracleCommand command = connection.CreateCommand();
OracleCommand command1 = connection.CreateCommand();
string sql = "CREATE TABLE TABLE_NAME (First_Name char(50))";
command.CommandText = sql;
OracleDataReader reader = (command).ExecuteReader();
while (reader.Read())
{
string myField = (string)reader["MYFIELD"];
Console.WriteLine(myField);
}
}
}
I know that this code is correct because I've already tried on a Visual Studio project.
My doubt is where I need to copy this sample to create my new table and delete it after the test.
Can you help me?
Thank you.
Best regards,
Marie
I am trying to aumate UI tests to mu Silverlight App.
I'll need to setup my Oracle database before I run some tests. And cleanup my database after I run the test.
I have a C# sample code that does this operation but the compilation is not correct.
I created a script step and I copy this code there as:
[CodedStep(@"New Coded Step")]
public void connectDB_CodedStep()
{
string connectionString = "User Id=myusername;Password=mypassword;Data Source=(DESCRIPTION=" +
"(ADDRESS=(PROTOCOL=myprotocol)(HOST=myhost)(PORT=myport))" +
"(CONNECT_DATA=(SID=mysid)));";
using (OracleConnection connection = new OracleConnection())
{
connection.ConnectionString = connectionString;
connection.Open();
Console.WriteLine("State: {0}", connection.State);
Console.WriteLine("ConnectionString: {0}",
connection.ConnectionString);
OracleCommand command = connection.CreateCommand();
OracleCommand command1 = connection.CreateCommand();
string sql = "CREATE TABLE TABLE_NAME (First_Name char(50))";
command.CommandText = sql;
OracleDataReader reader = (command).ExecuteReader();
while (reader.Read())
{
string myField = (string)reader["MYFIELD"];
Console.WriteLine(myField);
}
}
}
I know that this code is correct because I've already tried on a Visual Studio project.
My doubt is where I need to copy this sample to create my new table and delete it after the test.
Can you help me?
Thank you.
Best regards,
Marie