User:Rhe/Nitrate Migration Script

From FedoraProject

Jump to: navigation, search

Contents

Introduction

This page shows the usage of the migration script which is used to transfer the test case from wiki page to Nitrate tcms system.

Source Code

You can get the script named wiki_to_nitrate_xml.py from the repo:

git clone git://fedorapeople.org/~rhe/repo.git

After modification, checkin the code by:

git add <file>
git commit -m '<comment>'
git push fedorapeople

Usage

Important.png
author name
In the script, the author name of each test case is 'rhe@redhat.com', change it to your own need in the real case.

The main input parameter is the wiki page title, and the output is a output.xml file under current ./ path which can be imported to Nitrate tcms system. The usage is as below:

[root@repo]# ./wiki_to_nitrate_xml.py --help
Usage: wiki_to_nitrate_xml.py [options] <action> [options]

Options:
  -h, --help            show this help message and exit
  -v, --verbose         Enable more verbose output
  -d, --debug           Enable debugging output
  --url=URL             API URL

General options:
  -l LIMIT, --limit=LIMIT
                       Limit recursion depth (5)

Options for 'categorymembers' command::
  -c CATEGORIES, --category=CATEGORIES
                       Wiki category name to covert all its members(test
                       cases) to Nitrate xml file

Options for 'migration'::
  -t TITLE, --title=TITLE
                       Page title to convert this test case to Nitrate xml
                       file

Options for 'pagelinks'::
  -p PAGE, --page=PAGE
                       Page name to convert all its links(test cases) to
                       Nitrate xml file


Transfer one test case from wiki page to a xml file

For example, run the following command:

#./wiki_to_nitrate_xml.py migration -t QA:Testcase_Boot_Methods_Boot_Iso

Then a output.xml will be generated under its ./ path with the content:

<?xml version="1.0" ?>
<testopia version="1.1">
        <testcase author="rhe@redhat.com" automated="" priority="P1" status="PROPOSED">
                <summary>
                        QA:Testcase_Boot_Methods_Boot_Iso
                </summary>
                <categoryname>
                        --default--
                </categoryname>
                <defaulttester/>
                <notes>
                        <p>This tests starting the anaconda installation program using <code>boot.iso</code> or <code>netinst.iso</code> </p>
                </notes>
                <testplan_reference type="xml_description">
                        Fedora 15 Install Test Plan
                </testplan_reference>
                <action>
                        <ol><li> Insert the optical (or USB) media into the appropriate device (optical drive or USB drive), and boot the system under test. </li></ol>
                </action>
                <expectedresults>
                        <ol><li> Graphical boot menu is displayed for users to select install options. Navigating the menu and selecting entries must work. If no option is selected, the installer should load after a reasonable timeout </li><li> Installer boots into <a href="http://fedoraproject.org/wiki/Anaconda/Stage&quot; class=quot;external text">loader</a> and prompts for language, keymap </li><li> Installer transitions to <a href="http://fedoraproject.org/wiki/Anaconda/Stage&quot; class="external text">anaconda</a> without error </li></ol>
                </expectedresults>
                <setup>
                        <ol><li> Prepare your system for booting a <code>boot.iso</code&gt:/<code>netinst.iso</code> image. This may involve writing the image to a USB key, or using <code>cdrecord</code> to write to an optical disk. </li><li> Check your system boot order preferences to ensure that the optical CD drive (or USB drive) boot target is enabled. </li></ol>
                </setup>
                <breakdown/>
                <tag>
                        Installer_Boot_Methods
                </tag>
                <tag>
                        UEFI_Test_Cases
                </tag>
        </testcase>
</testopia>

This file can be imported directly to Nitrate system to generate a test case.

Transfer a category which has its own test case members to a xml file

Input a test case category page name to transfer all its members, for example:

#./wiki_to_nitrate_xml.py -c Category:Installation_Repository_DVD categorymembers
QA:Testcase install repository DVD default
QA:Testcase install repository DVD graphical
QA:Testcase install repository DVD variation

Then, its three test cases will be transferred to nitrate xml format included in the output.xml file.

Transfer a test run page which has test cases to a xml file.

Input a page(eg. test result/test run page) which has test cases links, the output will be the output.xml file containing all the test cases. For example:

#./wiki_to_nitrate_xml.py pagelinks -p Test_Results:Fedora_16_Alpha_RC2_Base 
The page 'QA:Base validation results template' is not a test case
The page 'QA:Base validation testing' is not a test case
The page 'QA:SOP blocker bug process' is not a test case

As a result, it judged all its links and only convert test cases to the xml file.