Forum Discussion
1 Reply
- rraghvani
Champion Level 3
Refer to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/static you can create a static class, which will be the first thing that will be called before any test scripts are run.
- mengbinhaoContributor
Could you show me a simple example? After I define a static class, How do I use it?
Run static class first , then other testcase can get real-time value of Object inited by this static class?
- rraghvani
Champion Level 3
There's a number of examples shown here https://stackoverflow.com/questions/1479319/simplest-cleanest-way-to-implement-a-singleton-in-javascript which uses singleton class
- mengbinhaoContributor
I know how to define static class or single design pattern, I just don't know how to get static class value in TestCompelte
- rraghvani
Champion Level 3
Using the example shown in stackoverflow, it will be
myInstance.publicMethod1()
And also shown here
- mengbinhaoContributor
I'll try this, Thanks!