Automated website Testing System-run test cases

Source: Internet
Author: User

previous articles automated website test system-based on selenium and vstt , data driver test , test hard coding test data in Code , you have compiled some code for the test case. In my article automated System This has Functions to open it, select the test cases to be executed in batches. This type of repetitive mechanical work should be eliminated by the Program . After all, the cost of machines is much lower than that of manual work.

First, we need to break down the steps for executing the test case, encode each step, and then concatenate the workflow in batches: (of course, we can also use. NetInsideWorkflowIn that case, we need to add an additional command.-Install. NET Framework 3.0.)

1.Install the latest version of the product. During this test, because the development team did not use any automated daily compilation system, all programmers download the latest code from the code server.Visual StudioWrite debugging websites. Therefore, our test team directly downloads the latest code and usesVisual StudioCompile product code .

 

Of course, in an automated testing system, it is impossible to have a dedicated personF5To compile the entire website. FortunatelyVisual StudioOnly an integrated development environment (IDE), The actual work of compiling a program isMsbuildCompleted by this program,MsbuildThis program is similarAntAndMakeSoftware. You only need to provide the solution file of the Code (. SlnFile) or project file (. CsprojFile ),MsbuildCompile the code based on the dependencies between projects. Therefore, the installation of the latest version of the product is divided:

 

1.1Download the latestSource codeAll client programs of the file version server provide this function. Our project usesHgTo obtain the latest code:

Hg.exe update

 

1.2Compile the Code:

Msbuild/nologo productcode. sln

 

1.3Publish compiled websites or useXcopyCommand to update the website folder, orIISDirect the root directory of the website to the folder of the product code.

 

2.Download and compile the latest test code.1Steps are similar, so the related commands are omitted.

3.Run all automated test cases.VsttProvides a list of Use Cases (Test list), Because it isScrumThe firstSpringSo when we work, we archive all the automated test cases toAutomationList of Use Cases (Test list.

 

When the Automated Testing EngineerVsttWhen executing test cases in batches, follow these steps:

 

A)InVsttOpen the test project file.

B)ClickVisual StudioTest (Test)"->"Window (Windows)"->"Test List editor".

C)Expand"Lists of tests", Hook"Automation"This use case list (Test listIn this way, all automated test cases are selected. As shown in:

d) last click Visual Studio " test ( test ) "-> " Run ( RUN ) "-> " tests in C Urrent context "to run all the use cases.

As mentioned earlier,Visual StudioIt is only an integrated development environment. Basically, all operations on the interface can be completed using the command line tool. For example, you can compile a program and useMsbuild.exe, Debugging programs can be usedMdbg.exe(Of courseVisual StudioThe debugger is a form program, not a command line program.Mstest.exeCompleted. AboveA, B, c, dIn four steps, you can use the following command:

Mstest/runconfig: testrunconfig. testrunconfig/testmetadata: Test. vsmdi/testlist: automation/resultsfile: \ testresults \ % seleniumhost % _ % orchardservice % _ % 1.trx

The following table lists the meanings of the parameters used in the preceding command.

parameter

description

runconfig

When you areVisual StudioA test project (Test Project),VSWill automatically add. TestrunconfigFile. This file is used to configure and execute the test process (Test Run. For example:

 

LWhether the test case is executed on the local machine or on another machine.

LTest data to be copied.

LThe command to be run before and after all test cases are executed-used to prepare the test environment.

LWhether to perform code coverage statistics.

LAnd so on.

 

Use. TestrunconfigThe process will be discussed later.

Testmetadata

VSAdd. TesturnconfigFile, It also adds a metadata called test case (Test meta data). VsmdiFile. This file is used to describe the information of the test case as advertised by all metadata. For example, the list of test cases (Test list), The person in charge of the test case (Owner) Who is it and so on.

 

. VsmdiI will also explain the details of the file in a later article.

testlist

Use Case list. With this parameter, you can specify the list of test cases to be executed. The use case list is a tree structure, that is, the use case list can contain the list of other use cases, for specific examples, see.

Resultsfile

The location where the test result file is saved after the test case is executed.

 

Note:Mstest.exeFor other parameters, seeMsdnDocumentation:

Http://msdn.microsoft.com/zh-cn/library/ms182489%28VS.80%29.aspx

4.Collect test results. Detailed descriptions of this step are described in the next article.

Now that you know how to replace the commands used in each step, the rest of the work is simply to usePowershell, OrWMIOr batch processing can combine these commands to run them.

To be continued ......

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.