Getting build error: The name 'TestCase' does not exist in the current context after migrating our scripts to Ranorex 8

Ask general questions here.
chiranthurs
Posts: 18
Joined: Mon Oct 29, 2018 1:09 pm

Getting build error: The name 'TestCase' does not exist in the current context after migrating our scripts to Ranorex 8

Post by chiranthurs » Fri Dec 21, 2018 8:43 am

Hi Team,

I am getting a build error saying "The name 'TestCase' does not exist in the current context" after migrating our scripts from Ranorex 5.3.2 to Ranorex 8.3.1 . Please help.

Code:
public void Validate_DocumentContext()
{
string strDocNo, strSoldToPartner;

TestCase.Current.DataContext.Parameters.TryGetValue("DocNumber", out strDocNo);
TestCase.Current.DataContext.Parameters.TryGetValue("SoldToPartner", out strSoldToPartner);

var strTempStr = strDocNo + ".*" + strSoldToPartner;

var label_DocNum = repo.GenericDocument.Object.CaptionGrid.Label_DocNum;
Validate.Attribute(label_DocNum, "innertext", new Regex(strTempStr));
}

Note: Attaching screen shot of the problematic code and build error.

Regards,
Chiranth
Attachments
Build Error.jpg
Build Error.jpg (104.93 KiB) Viewed 93 times
Context Error.jpg
Context Error.jpg (65.08 KiB) Viewed 93 times

qwertzu
Posts: 223
Joined: Wed Jan 25, 2017 11:08 am

Re: Getting build error: The name 'TestCase' does not exist in the current context after migrating our scripts to Ranor

Post by qwertzu » Thu Dec 27, 2018 10:03 am

hey Chiranth,

Seems like your code is already obsolete.

Retrieving a parameter's value of the current test case:

Code: Select all

TestSuite.CurrentTestContainer.Parameters.TryGetValue();
Retrieve a global parameter's value:

Code: Select all

TestSuite.Current.Parameters.TryGetValue();
Hope, this helps ;-)
regards, qwertzu