Commit ec2359d5 authored by Ghislain MARY's avatar Ghislain MARY

Allow execution of a single test case.

parent 249a88f4
......@@ -48,12 +48,15 @@ void Mediastreamer2TesterNative::setOutputTraceListener(OutputTraceListener^ tra
sTraceListener = traceListener;
}
void Mediastreamer2TesterNative::run(Platform::String^ name, Platform::Boolean verbose)
void Mediastreamer2TesterNative::run(Platform::String^ suiteName, Platform::String^ caseName, Platform::Boolean verbose)
{
std::wstring all(L"ALL");
std::wstring suitename = name->Data();
char cname[MAX_SUITE_NAME_SIZE] = { 0 };
wcstombs(cname, suitename.c_str(), sizeof(cname));
std::wstring wssuitename = suiteName->Data();
std::wstring wscasename = caseName->Data();
char csuitename[MAX_SUITE_NAME_SIZE] = { 0 };
char ccasename[MAX_SUITE_NAME_SIZE] = { 0 };
wcstombs(csuitename, wssuitename.c_str(), sizeof(csuitename));
wcstombs(ccasename, wscasename.c_str(), sizeof(ccasename));
if (verbose) {
ortp_set_log_level_mask(ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
......@@ -63,7 +66,7 @@ void Mediastreamer2TesterNative::run(Platform::String^ name, Platform::Boolean v
ortp_set_log_handler(Mediastreamer2NativeOutputTraceHandler);
CU_set_trace_handler(nativeOutputTraceHandler);
mediastreamer2_tester_run_tests(suitename == all ? 0 : cname, 0);
mediastreamer2_tester_run_tests(wssuitename == all ? 0 : csuitename, wscasename == all ? 0 : ccasename);
}
unsigned int Mediastreamer2TesterNative::nbTestSuites()
......
......@@ -20,6 +20,6 @@ namespace mediastreamer2_tester_native
unsigned int nbTests(Platform::String^ suiteName);
Platform::String^ testSuiteName(int index);
Platform::String^ testName(Platform::String^ suiteName, int testIndex);
void run(Platform::String^ name, Platform::Boolean verbose);
void run(Platform::String^ suiteName, Platform::String^ caseName, Platform::Boolean verbose);
};
}
\ No newline at end of file
......@@ -26,8 +26,17 @@ namespace cain_sip_tester_wp8
{
base.OnNavigatedTo(e);
string suiteName = NavigationContext.QueryString["SuiteName"];
string caseName;
if (NavigationContext.QueryString.ContainsKey("CaseName"))
{
caseName = NavigationContext.QueryString["CaseName"];
}
else
{
caseName = "ALL";
}
bool verbose = Convert.ToBoolean(NavigationContext.QueryString["Verbose"]);
var suite = new UnitTestSuite(suiteName, verbose, new OutputDisplayDelegate(OutputDisplay));
var suite = new UnitTestSuite(suiteName, caseName, verbose, new OutputDisplayDelegate(OutputDisplay));
suite.run();
}
......@@ -42,22 +51,23 @@ namespace cain_sip_tester_wp8
public class UnitTestSuite : OutputTraceListener
{
public UnitTestSuite(string SuiteName, bool Verbose, OutputDisplayDelegate OutputDisplay)
public UnitTestSuite(string SuiteName, string CaseName, bool Verbose, OutputDisplayDelegate OutputDisplay)
{
this.SuiteName = SuiteName;
this.CaseName = CaseName;
this.Verbose = Verbose;
this.OutputDisplay = OutputDisplay;
}
async public void run()
{
var tup = new Tuple<String, bool>(SuiteName, Verbose);
var tup = new Tuple<string, string, bool>(SuiteName, CaseName, Verbose);
var t = Task.Factory.StartNew((object parameters) =>
{
var tester = (Application.Current as App).tester;
tester.setOutputTraceListener(this);
var p = parameters as Tuple<String, bool>;
tester.run(p.Item1, p.Item2);
var p = parameters as Tuple<string, string, bool>;
tester.run(p.Item1, p.Item2, p.Item3);
}, tup);
await t;
}
......@@ -72,6 +82,7 @@ namespace cain_sip_tester_wp8
}
private string SuiteName;
private string CaseName;
private bool Verbose;
private OutputDisplayDelegate OutputDisplay;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment