Commit 074eec2c authored by Michele Carignani's avatar Michele Carignani
Browse files

sections numbering is configurable

parent 09204212
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -7,7 +7,8 @@


*** Test Cases ***
*** Test Cases ***
Scale a vnfInstance
Scale a vnfInstance
    [Documentation]    Test Name: Scale VNF The POST method scales a VNF instance.. 
    [Documentation]    Test ID: 9.8.7.6.5
    ...    Test Name: Scale VNF The POST method scales a VNF instance.. 
    ...    Another key: The operation cannot be executed currently, due to a conflict with the state of the VNF instance resource. 
    ...    Another key: The operation cannot be executed currently, due to a conflict with the state of the VNF instance resource. 
    ...    Applicability: Typically, this is due to the fact that the VNF instance resource is in NOT-INSTANTIATED state, or that another lifecycle management operation is ongoing. 
    ...    Applicability: Typically, this is due to the fact that the VNF instance resource is in NOT-INSTANTIATED state, or that another lifecycle management operation is ongoing. 
    ...    Post-conditions: The response body shall contain a ProblemDetails structure, in which the detail attribute should convey more information about the error.
    ...    Post-conditions: The response body shall contain a ProblemDetails structure, in which the detail attribute should convey more information about the error.
@@ -22,7 +23,7 @@ Scale a vnfInstance


Scale a vnfInstance Conflict (Not-Instantiated)
Scale a vnfInstance Conflict (Not-Instantiated)
    # TODO: Need to set the pre-condition of the test. VNF instance shall be in NOT-INSTANTIATED state
    # TODO: Need to set the pre-condition of the test. VNF instance shall be in NOT-INSTANTIATED state
    [Documentation]    Test ID: Conflict. 
    [Documentation]    Test Name: Conflict. 
    ...    Reference: The operation cannot be executed currently, due to a conflict with the state of the VNF instance resource. 
    ...    Reference: The operation cannot be executed currently, due to a conflict with the state of the VNF instance resource. 
    ...    Applicability: Typically, this is due to the fact that the VNF instance resource is in NOT-INSTANTIATED state, or that another lifecycle management operation is ongoing. 
    ...    Applicability: Typically, this is due to the fact that the VNF instance resource is in NOT-INSTANTIATED state, or that another lifecycle management operation is ongoing. 
    ...    Task: The response body shall contain a ProblemDetails structure, in which the detail attribute should convey more information about the error.
    ...    Task: The response body shall contain a ProblemDetails structure, in which the detail attribute should convey more information about the error.

robot2doc/config.py

0 → 100644
+20 −0
Original line number Original line Diff line number Diff line
#!/env/python

VERSION = "0.0.3"

DOC_CLAUSE_LVL_1 = "9"
DOC_CLAUSE_LVL_2 = 8
DOC_CLAUSE_LVL_3 = 7
DOC_CLAUSE_LVL_4 = 6

ANNEX_TITLE_LEVEL = 1
DOC_SUITE_LEVEL = 4
DOC_TC_LEVEL = 5

DOC_TC_FONT_SIZE = 8
DOC_TC_FONT_NAME = "Courier New"

DOC_MAIN_TITLE = '9 Test Cases'
DOC_FILENAME = 'test_spec_from_robot.docx'
FILE = ""
BASE_SPEC = 'basespec.docx'
+27 −14
Original line number Original line Diff line number Diff line
@@ -8,15 +8,20 @@ import os


from robot.api import TestSuiteBuilder
from robot.api import TestSuiteBuilder


from testspec import TestSpec, DOC_BASE_SEC, DOC_TC_LEVEL
from testspec import TestSpec, DOC_TC_LEVEL
from testpurpose import TP
from testpurpose import TP

import config as cfg
# Configuration
# Configuration


DOC_MAIN_TITLE = 'Annex B (informative): Test Cases'
DOC_CLAUSE_LVL_1 = cfg.DOC_CLAUSE_LVL_1
DOC_FILENAME = 'test_spec_from_robot.docx'
DOC_CLAUSE_LVL_2 = cfg.DOC_CLAUSE_LVL_2
FILE = ""
DOC_CLAUSE_LVL_3 = cfg.DOC_CLAUSE_LVL_3
BASE_SPEC = 'basespec.docx'
DOC_CLAUSE_LVL_4 = cfg.DOC_CLAUSE_LVL_4

DOC_MAIN_TITLE = cfg.DOC_MAIN_TITLE
DOC_FILENAME = cfg.DOC_FILENAME
FILE = cfg.DOC_FILENAME
BASE_SPEC = cfg.BASE_SPEC


def keyword_to_line(k):
def keyword_to_line(k):
    '''
    '''
@@ -42,6 +47,7 @@ def gen_doc(src, doc_fn, doc_main_tit):
    doc_main_tit   top level title for the section in the doc
    doc_main_tit   top level title for the section in the doc
    '''
    '''


    print("### robot2doc version " + cfg.VERSION)
    print "Starting.."
    print "Starting.."
    script_dir = os.path.dirname(os.path.realpath(__file__))
    script_dir = os.path.dirname(os.path.realpath(__file__))
    cwd = os.getcwd()
    cwd = os.getcwd()
@@ -61,20 +67,27 @@ def gen_doc(src, doc_fn, doc_main_tit):
        exit(-1)
        exit(-1)


    print "Loaded "+ str(len(workspace.suites)) + " test suites."
    print "Loaded "+ str(len(workspace.suites)) + " test suites."
    sec = DOC_BASE_SEC - 1
    sec = DOC_CLAUSE_LVL_2 - 1


    spec.add_main_heading(doc_main_tit)
    spec.add_main_heading(doc_main_tit)
    for suite in workspace.suites:
    for suite in workspace.suites:
        sec = sec + 1
        sec = sec + 1
        subsec = 0
        subsec = DOC_CLAUSE_LVL_4
        print "  Generating test suite: " + str(suite)
        print "  Generating test suite: " + str(suite)
        spec.add_sub_heading(str(suite), sec)
        spec.add_sub_heading(str(suite), DOC_CLAUSE_LVL_1, sec, DOC_CLAUSE_LVL_3, subsec)
        for i in suite.tests:
        for i in suite.tests:
            print "      Generating test: " + str(i)
            print("      Generating test: " + str(i))
            tp = TP(i.doc)
            if tp.tp_id != None:
                spec.add_heading(str(i), DOC_TC_LEVEL, tp.tp_id)
                print("              Has TP ID: " + tp.tp_id)
            else:
                subsec = subsec + 1
                subsec = subsec + 1
            spec.add_heading(str(i), DOC_TC_LEVEL, sec, subsec)
                print("              Has NO TP ID.")
            TP(i.doc).add_to_spec(spec, keywords_to_text(i.keywords))
                spec.add_heading(str(i), DOC_TC_LEVEL, DOC_CLAUSE_LVL_1, sec, DOC_CLAUSE_LVL_3, subsec)
            tp.add_to_spec(spec, keywords_to_text(i.keywords))


    print "Saving to: " + doc_fn
    spec.save(doc_fn)
    spec.save(doc_fn)
    print "Finished."
    print "Finished."


+33 −0
Original line number Original line Diff line number Diff line
'''
Tests for testpurpose.py
'''

import testpurpose

def test_create_tp():
    '''
    Test creation of a TP object
    '''
    tp_doc = ''' Test ID: X.Y.Z.Y.W\\n\
    Title: my title\\n\
    something: more'''

    tp = testpurpose.TP(tp_doc)

    assert(tp.tp_id.strip() == "X.Y.Z.Y.W")
    assert(len(tp.tp_fields) == 3)


def test_create_tp_with_no_id():
    '''
    Test creation of a TP object with no TP object
    '''
    tp_doc = ''' Test suite: My suite\\n\
    Title: my title\\n\
    something: more'''

    tp = testpurpose.TP(tp_doc)

    assert(tp.tp_id == None)
    assert(len(tp.tp_fields) == 3)
+8 −3
Original line number Original line Diff line number Diff line
@@ -7,11 +7,11 @@ class TpField():
    def __init__(self, text):
    def __init__(self, text):
        split = text.split(":")
        split = text.split(":")
        if len(split) > 1:
        if len(split) > 1:
            self.key = split[0]
            self.key = split[0].strip()
            self.value = split[1]
            self.value = split[1].strip()
        else:
        else:
            self.key = ""
            self.key = ""
            self.value = split[0]
            self.value = split[0].strip()


class TP():
class TP():
    '''
    '''
@@ -22,6 +22,11 @@ class TP():
        t = text.encode('ascii')
        t = text.encode('ascii')
        self.lines = t.split("\\n")
        self.lines = t.split("\\n")
        self.tp_fields = map(TpField, self.lines)
        self.tp_fields = map(TpField, self.lines)
        self.tp_id = None

        for field in self.tp_fields:
            if field.key == "Test ID":
                self.tp_id = field.value
        
        
    def __str__(self):
    def __str__(self):
        return str(self.lines)
        return str(self.lines)
Loading