Passing Class Object between Test Cases
Posted: Tue Jul 24, 2018 10:16 pm
Is it possible to pass a class object between test cases?
Software Testing Forum
https://www.ranorex.info/
using System; namespace SharingAClass { public class myClass { static myClass _instance= new myClass(); public static myClass Instance { get { return _instance; } } myClass() { } public string myVariable_one=""; public string myVariable_two=""; } }You should now be able to set and read the values from that class from anywhere in the test suite. In some random test case you could set myClass.Instance.myVariable_one="Test_one", in another one you could set myClass.Instance.myVariable_two="Test_two"; without having to declare a new instance of the class. Then again, somewhere completely different you can access them:
Report.Info(myClass.Instance.myVariable_one); Report.Info(myClass.Instance.myVariable_two);Is this useful to you?