Change DataContext of Parent TestCase

Ask general questions here.
anja
Posts: 67
Joined: Fri Nov 26, 2010 3:39 pm

Change DataContext of Parent TestCase

Post by anja » Mon Mar 04, 2013 3:56 pm

Hi,

I've got following Testcase-Structure within my Testsuite:
Testsuite:
- MainTestcase
- Testcase1
- Testcase2

On the main Testcase level I've attached via Databinding a file with more than one datarow.
During the tests, there should only be one datarow used. (its a language file containing all strings in different languages)
Within Testcase2 I change the language of my Application, so I need to change the datacontext of the MainTestcase. How can I access the Parent of the current Testcase?

I know, I can change the DataContext of the actual Testcase by using:
TestCase.Current.DataContext.SetRange(min, max);

Thank you for your assistance.

Regards
Anja

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Change DataContext of Parent TestCase

Post by Support Team » Tue Mar 05, 2013 2:58 pm

Hello,

Could you please describe why you want to change the range of a parent Test Case in a subsidiary Test Case?

A possible design would be that you set the data binding on the 'Main Test Case' (as parent) and use one iteration (row) per language. Testcase1 and Testcase2 should be executed for each language.

Regards,
Markus (T)
.
Image

anja
Posts: 67
Joined: Fri Nov 26, 2010 3:39 pm

Re: Change DataContext of Parent TestCase

Post by anja » Tue Mar 19, 2013 2:59 pm

Hi,
Sorry for my late response...

Why I want to do this, is to be able to change the language of the application and use the "new" language for all following testcases.
A possible design would be that you set the data binding on the 'Main Test Case' (as parent) and use one iteration (row) per language. Testcase1 and Testcase2 should be executed for each language.
I already thought of this solution, but I do not want to iterate over all testcases within my Main Test Case. Only one of the testcases needs to be iterated (the one where I change the language and check if the strings are correctly displayed). For the other testcases I only need to know which languge is actually chosen.

Thank you in advance
Anja

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Change DataContext of Parent TestCase

Post by Support Team » Wed Mar 20, 2013 4:41 pm

Hello,

I'm afraid, that I don't understand the use case of your test.

If you only want to iterate a specific test case you could use the data source only for this test case.
In order to check which language is currently selected you could use global parameters.

It is not recommended to change the data range of your Main Test case from another test case because the workflow of the test would be broken.

We would need detailed information what you want to do in your test cases.

Regards,
Markus (T)
.
Image