Sdílet prostřednictvím


Opakování testu s odlišnými daty

Při psaní ruční test, je často potřeba k určení, že test by měl být opakovaně s daty různé zkušební.Například pokud uživatelé mohou přidat různých množství produktu do nákupního košíku, pak chcete zkontrolovat, zda množství 200 funguje stejně dobře jako množství 1.

Chcete-li to provést, vložte parametry v testovací kroky.Společně s testovací kroky poskytnete tabulku hodnot parametrů.

Team Web Access s použitím Team Foundation Server 2013 Update 2 nebo Visual Studio Online, můžete také sdílet parametry a jejich dat mezi testovacích případů.Tímto způsobem můžete spustit několik testovacích případů se stejnými daty.

Do testovacího případu přidat parametry

Create a parameter by typing a name preceded by "@" in the actions and expected results of your test steps.

Vytvoření parametry akcí a výsledky.

Underneath the list of steps, add combinations of parameter values.You might need to scroll down to see them.

Share parameters between test cases

Convert existing parameters to shared parameters, so that you can use them and the associated data in other test cases.

V části hodnoty parametru klepněte na tlačítko Převést

Po vytvoření sdílené parametr nastavit, otevřete jinou testovacích případů a přidejte parametr sdílené nastaven v takovém případě test.You can search for the shared parameter set by name.

Z hodnoty parametru klepněte na tlačítko Přidat

The shared parameter set is displayed in the Parameter values section after you add it.You can now use these parameters in your test case steps.

If the test case already has different parameter names for these shared parameters, map the shared parameter to the local parameter to use the shared parameter data.

Pomocí rozevíracím seznamu vyberte sdílený parametr pro mapování

When they are correctly mapped the data associated with the shared parameter will be displayed.

Přidání, úpravy a přejmenovat sady sdílené parametr na kartě Parametry.Zobrazte testovací případy, které odkazovat na ně v podokně testovacích případů.

V testovacím centru zvolte parametry

Každá sada sdílené parametru je pracovní položku.Z vlastnosti kartu, můžete zobrazit nebo změnit tuto pracovní položku.Například můžete přiřadit vlastníci a sledovat změny.

[!POZNÁMKA]

Z nástroje Microsoft Test Manager pomocí Test Professional 2013 Update 2 nebo Visual Studio Ultimate 2013 Update 2, můžete zobrazit sdílené parametry pro testovacího případu, ale není možné aktualizovat.Chcete-li aktualizovat sdílené parametry, je nutné použít Team Web Access.V aplikaci Microsoft Test Manager, který přejdete na správné umístění upravovat sdílené parametry není hypertextový odkaz.

Run a test case with parameters

When you run a test case with parameters, test runner shows the first row of parameter values.

Test spustit iterací s hodnotami parametrů.

When you’ve completed the steps, mark the test passed or failed.

Předat nebo došlo k chybě iterační testování a přejít další

Then go on to the next iteration of the test, which uses the next row of parameter values.

Následující test iteraci má jiné hodnoty parametru

Some of the parameter values are wrong. Can I fix them without canceling the test?

Ano.Choose Edit from the context menu of the step.

Review the test results

If you marked any test iteration as failed, then the outcome of the whole test is shown as failed.

Všechny neúspěšné test iterace se zobrazí jako neúspěšné test.

If you inspect the test results in Microsoft Test Manager, you can see the different results for each iteration:

Zobrazení výsledků testů pro Test s iterací

Speed up test iterations by using record/playback

It can be error-prone and tedious to work through a long table of parameter combinations.To speed things up, create an action recording when you run the test with the first set of parameter values, and then play it back for the other sets.

Here’s how:

  1. Use Microsoft Test Manager to run the test.

  2. Select Create action recording before you press the Start button.

  3. Complete the first test iteration and move on to the next.

    Mark each step as passed or failed as you work.Enter parameter values in the application exactly as they are displayed in the test script.

  4. Choose Play to run the test with the next set of parameter values.

    Your actions will be played back automatically, but you still have to verify the results.

Record/playback doesn’t work with all applications.Podrobnosti naleznete v tématu Podporované konfigurace a platformy pro programové testy uživatelského rozhraní a zaznamenávání akcí.

Dotazy a A

  • Q: Are parameters the best way to specify that the test should be run on Windows 7 and Windows 8? And with different browsers, databases, and so on?
    A: It’s better to use Test Configurations for that.With test case parameters, you run the different parameter values one after another, which makes it difficult to switch from one platform to another.

  • Q: Can I use parameters in shared steps?
    O: Ano.You set the parameter values in the test cases where you use the shared steps.

  • Q: Can I import parameter values from an Excel spreadsheet to my shared parameter sets?
    O: Ano.Copy the data from your Excel spreadsheet and paste it into your shared parameters grid.You can also copy the data from your grid back into Excel if you need to.