We can increase the speed from the following aspects:
First, reduce operational steps, such as through the San Sibu to open the page we want to test, then we will be able to open directly through the Web site, reducing unnecessary operations.
Second, break the page loads, if the page loaded content too much, we can look at the reasons for slow loading, if the loaded content does not affect our test, we set the timeout interrupt the page loads.
Third, set the wait time, they can sleep a fixed time, and can detect an element after an interruption wait can also improve speed.
Fourth, configure testNG implement multithreading. In the preparation of test cases, we must achieve loose coupling, and in the case of server allows, try to set up multi-threaded operations and increase execution speed.
First, speed problem: Sometimes pages load more slowly, elements in the program execution to be operated not showing up. This situation is more common, a speed run through the good times, run it again, the page does not open, do not pass up. In order to improve the stability, we can only run time of sacrifice, plus waiting time before an element often fails to detect, and so after the emergence of the elements to be operated again to perform the following operations.
Second, the reason Selelnium: Selenium1.0 and 2.0 there are differences, some children do sometimes run function effectively under 2.0, when the surface is invalid. If mouseover () function, as is the case, we need to avoid the use of such functions.
Third, multi-threading, when the test case between influence each other. Although multithreading when run faster, but if the coupling between the cases with no good design, will affect, if the use case A prior to the time the use case B executed, it will affect the use cases B; otherwise there is no problem. This situation, if your test automation project intends to multithreading, when tested in advance to make a test case of the relatively loose coupling, as far as possible without any relationship, because the execution order of multiple threads is uncontrolled.
First, the automated test is used to monitor and, in this, we'll automated test set to the timing of the execution, If every five minutes or one hour once, you can create a scheduled task on jenkins.
Second, we must return to the use cases. Some children test cases, such as BVT test cases, before we change our products on line any need to return to perform. Then we put the test set to trigger execution, the bindings will jenkins our task to build test automation tasks development. When the developer in the upper part of the code simulation environment, our automated execution of test cases will be triggered.
Third, do not need to test frequently performed. Like the full amount of the test case, we do not need to return have been executed, after all, still have time to consume, and some non-main business lines do not need to constantly return. Such artificial test we perform, create a task jenkins, when the need to perform manual to build to.
By studying selenium-webdriver source code, I found that in fact the realization of the principle webdriver not unfathomable not try to speculate. Here to webdriver Ruby the Binding of firefox-webdriver achieved, for example, briefly explain the working principle of webdriver.
-
When the test script to start firefox, selenium-webdriver firefox browser will first start in the new thread. If the test script specifies the firefox profile, then start with the profile, otherwise it will start a new profile, and start firefox;
-
firefox -no-remote general method is started after starting selenium-webdriver firefox will bind to a specific port, firefox bound After completion of the instance as it exists webdriver a remote server;
-
The client (i.e., a test script) to create a session, the session request sent by http request restful to the remote server, remote server resolution request, and returns the corresponding operation is completed Response;
-
The client accepts response, and analyze its return value to determine whether to go to step 3 or the end of the script;
This is webdriver workflow, it seems very complicated to understand when in fact the realization of the principle of webdriver after understanding the above-mentioned problems should be relatively simple.
webdriver in accordance with the server - classic design mode client design.
end server is remote server, it can be any browser. When our script to start the browser, the browser is the remote server, its duty is to wait for the client sends a request and respond accordingly;
client end it simply is our test code, we tested the code of some of the acts, such as opening a browser, to jump to a specific url and other operations http request is sent to be tested the way the browser, which is the remote server; remote server accepts the request and perform the appropriate action, and return execution status response, the return value information and the like;
28, the difference between get and post? (Feeling may not answer)
- because the GET request does not produce any action. No action means that the HTTP GET request will not produce any results on the server. But security is not a method of action is not produced here simply refers to a method of security does not modify the information. POST requests may modify resources on the server. For example, CSDN blog, the user submits an article or a reader to submit a review is achieved through a POST request, because then submit the article or the comments submitted resources (ie, a page) different, or that resources have been modified.
Difference between the two ways of request:
1, GET request, the requested data will be appended to the URL, to? URL and transmit the divided data, a plurality of parameters & connect. URL encoding format uses ASCII encoding instead uniclde, and then transfer that is to say after all the non-ASCII characters to be encoded.
POST request: POST request will request data packet is placed in the body of the HTTP request packet. The above item = bandsaw is the actual data transmission. Therefore, GET requested data will be exposed in the address bar, and POST request does not.
2, the size of data transmission
In the HTTP specification, there is no limitation on the length and size of the transmission data of the URL. But in the actual development process, for GET, specific browsers and servers have restrictions on the length of the URL. Thus, when using the GET request, the transmission data is limited by the length of the URL.
For POST, because the URL is not traditional values, in theory, is not restricted, but in fact each server will require the submission of data to limit the size of the POST, Apache, IIS has its own configuration.
3, security
Security is higher than the GET POST
29, in the company has been using the test system (B / S architecture) suddenly can not visit, you need to troubleshoot and restore, tell your inspection methods
A: First, can not access the site directly enter the domain name, the website also normal before, suddenly can not access