In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article analyzes "what is the script structure of groovy in nGrinder". The content is detailed and easy to understand. Friends who are interested in "what is the script structure of groovy in nGrinder" can follow the editor's train of thought to read it in depth. I hope it will be helpful to you after reading. Follow the editor to learn more about "what is the script structure of groovy in nGrinder".
The structure of the groovy script in ngrinder is similar to junit, while encapsulating its own annotations on the basis of junit to control the execution of the script.
1. The running logic diagram is as follows:
Only the logic of the groovy script is listed here, and the jython script is similar and will not be covered separately here.
II. Comparison of the use of various notes
III. Focus
In ngrinder, using single-process multithreading is usually sufficient for most tests, so:
What we need to pay attention to most is @ Test, which is the body of the loop.
The second is @ Before, where shared variables for multiple loop bodies are set.
Next are @ BeforeThread and @ AfterThread, which are used to set the behavior of each thread before and after execution.
IV. Specific code structure
@ RunWith (GrinderRunner) / / add this annotation to every test class
Class TestRunner {
@ BeforeProcess / / execute before each process starts
Public static void beforeProcess () {
/ / load resource files, initialize GTest, etc.
}
@ BeforeThread / / execute before each thread executes
Public void beforeThread () {
/ / Log in, set cookie and so on
}
@ Before / / execute before each @ Test annotated method is executed
Public void before () {
/ / set variables, logic shared by multiple @ Test methods, etc.
}
@ Test / / keep running until the test ends. The methods of each @ Test annotation are executed asynchronously.
Public void foo () {
/ /...
}
@ Test
Public void bar () {
/ /...
}
@ After / / execute after each @ Test annotated method is executed
Public void after () {
/ / rarely used
}
@ AfterThread
Public void afterThread () {
/ / logging out and so on
}
@ AfterProcess / / execute after the end of each process
Public static void afterProcess () {
/ / close resources
}
So much for sharing what is the script structure of groovy in nGrinder. I hope the above content can improve everyone. If you want to learn more knowledge, please pay more attention to the editor's updates. Thank you for following the website!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.