Mapping Tool Test Cases - codemetropolis/CodeMetropolis GitHub Wiki


Test ID: MAP-001

Test name: Run Mapping Tool with valid input and valid mapping file

Precondition: The input has been generated by the Converter Tool.

Steps:

  • Open a command line.
  • Run Mapping Tool with a valid input and valid mapping file, for example: java -jar codemetropolis-toolchain-mapping-1.3.jar -i Modules\converterOutput.xml -m mapping.xml

Expected Result:

  • The Mapping tool will be successfully executed with the following messages:
    -- Mapping: Reading map file...
    -- Mapping: Reading map file done.
    -- Mapping: Reading graph file...
    -- Mapping: Reading graph file done.
    -- Mapping: Linking metrics to buildables...
    -- Mapping: Linking metrics to buildables done.
    -- Mapping: Generating input for placing...
    -- Mapping: Generating input for placing done.
  • Output will be the default, mappingToPlacing.xml.

Test ID: MAP-002

Test name: Run Mapping Tool with valid input and invalid mapping file

Precondition: The input has been generated by the Converter Tool.

Steps:

  • Open a command line.
  • Run Mapping Tool with a valid input and invalid mapping file, for example: java -jar codemetropolis-toolchain-mapping-1.3.jar -i Modules\converterOutput.xml -m 12345.xml

Expected Result: Mapping tool will display an error message: Error: No mapping file was found on the given path.


Test ID: MAP-003

Test name: Run Mapping Tool with invalid input and valid mapping file

Precondition: The input has been generated by the Converter Tool.

Steps:

  • Open a command line.
  • Run Mapping Tool with an invalid input and valid mapping file, for example: java -jar codemetropolis-toolchain-mapping-1.3.jar -i Modules\converterOutput3333.xml -m mapping.xml

Expected Result:

  • Message on command line:
    -- Mapping: Reading map file...
    -- Mapping: Reading map file done.
    -- Mapping: Reading graph file...
    -- Error: No CDF file was found on the given path.

Test ID: MAP-004

Test name: Run Mapping Tool with valid input and mapping file, and with help

Precondition: The input has been generated by the Converter Tool.

Steps:

  • Open a command line.
  • Run Mapping Tool with a valid input, valid mapping file and with -h parameter, for example: java -jar codemetropolis-toolchain-mapping-1.3.jar -i Modules\converterOutput.xml -m mapping.xml -h

Expected Result:

  • Message on command line:
    -- CodeMetropolis Toolchain Mapping (c) University of Szeged, Department of Software Engineering
    -- Usage: java -jar mapping.jar -i <cdfFile> -m <mappingFile> [-o <outputFile>]

Test ID: MAP-005

Test name: Run Mapping Tool with valid input and mapping file, and with valid output

Precondition: The input has been generated by the Converter Tool.

Steps:

  • Open a command line.
  • Run Mapping Tool with a valid input, valid mapping file and with valid -o parameter, for example: java -jar codemetropolis-toolchain-mapping-1.3.jar -i Modules\converterOutput.xml -m mapping.xml -o Modules\Mapping_output.xml

Expected Result:

  • The Mapping tool will be successfully executed with the following messages:
    -- Mapping: Reading map file...
    -- Mapping: Reading map file done.
    -- Mapping: Reading graph file...
    -- Mapping: Reading graph file done.
    -- Mapping: Linking metrics to buildables...
    -- Mapping: Linking metrics to buildables done.
    -- Mapping: Generating input for placing...
    -- Mapping: Generating input for placing done.
  • The output will be the given output file, in Modules folder, Mapping_output.xml.

Test ID: MAP-006

Test name: Run Mapping Tool with valid input and mapping file, and with invalid output

Precondition: The input has been generated by the Converter Tool.

Steps:

  • Open a command line.
  • Run Mapping Tool with a valid input, valid mapping file and with invalid -o parameter, for example: java -jar codemetropolis-toolchain-mapping-1.3.jar -i Modules\converterOutput.xml -m mapping.xml -o \Mapping_output.xml

Expected Result:

  • The Mapping tool will display an error message:
    -- Mapping: Reading map file...
    -- Mapping: Reading map file done.
    -- Mapping: Reading graph file...
    -- Mapping: Reading graph file done.
    -- Mapping: Linking metrics to buildables...
    -- Mapping: Linking metrics to buildables done.
    -- Mapping: Generating input for placing...
    -- Error: An error has occurred while writing the output file. For more information please check the log file.

Test ID: MAP-007

Test name: Run Mapping Tool with valid input and valid mapping file, with valid scale value.

Precondition: The input has been generated by the Converter Tool.

Steps:

  • Open a command line.
  • Run Mapping Tool with a valid input and valid mapping file, and with valid scale value, for example: java -jar codemetropolis-toolchain-mapping-1.3.jar -i Modules\converterOutput.xml -m mapping.xml -s 1.1

Expected Result:

  • The Mapping tool will be successfully executed with the following messages:
    -- Mapping: Reading map file...
    -- Mapping: Reading map file done.
    -- Mapping: Reading graph file...
    -- Mapping: Reading graph file done.
    -- Mapping: Linking metrics to buildables...
    -- Mapping: Linking metrics to buildables done.
    -- Mapping: Generating input for placing...
    -- Mapping: Generating input for placing done.
  • Output will be the default, mappingToPlacing.xml.

Test ID: MAP-008

Test name: Run Mapping Tool with valid input and valid mapping file, with invalid scale value.

Precondition: The input has been generated by the Converter Tool.

Steps:

  • Open a command line.
  • Run Mapping Tool with a valid input and valid mapping file, and with invalid scale value, for example: java -jar codemetropolis-toolchain-mapping-1.3.jar -i Modules\converterOutput.xml -m mapping.xml -s teszt

Expected Result:

  • Error: Incorrect command line arguments.
  • Usage: java -jar mapping.jar -i <cdfFile> -m <mappingFile> [-o <outputFile>]
***

Test ID: MAP-009

Test name: Run Mapping Tool with valid input and valid mapping file, with too big scale value.

Precondition: The input has been generated by the Converter Tool.

Steps:

  • Open a command line.
  • Run Mapping Tool with a valid input and valid mapping file, and with invalid scale value, for example: java -jar codemetropolis-toolchain-mapping-1.3.jar -i Modules\converterOutput.xml -m mapping.xml -s 1000000000000

Expected Result: Error: a given scale value is too big.


Test ID: MAP-010

Test name: Run Mapping Tool with valid input and valid mapping file, with valid nested value.

Precondition: The input has been generated by the Converter Tool.

Steps:

  • Open a command line.
  • Run Mapping Tool with a valid input and valid mapping file, and with valid nested value, for example: java -jar codemetropolis-toolchain-mapping-1.3.jar -i Modules\converterOutput.xml -m mapping.xml -n

Expected Result:

  • The Mapping tool will be successfully executed with the following messages:
    -- Mapping: Reading map file...
    -- Mapping: Reading map file done.
    -- Mapping: Reading graph file...
    -- Mapping: Reading graph file done.
    -- Mapping: Linking metrics to buildables...
    -- Mapping: Linking metrics to buildables done.
    -- Mapping: Generating input for placing...
    -- Mapping: Generating input for placing done.
  • Output will be the default, mappingToPlacing.xml.

Test ID: MAP-011

Test name: Run Mapping Tool with valid input and valid mapping file, with invalid nested value.

Precondition: The input has been generated by the Converter Tool.

Steps:

  • Open a command line.
  • Run Mapping Tool with a valid input and valid mapping file, and with invalid nested value, for example: java -jar codemetropolis-toolchain-mapping-1.3.jar -i Modules\converterOutput.xml -m mapping.xml -n false

Expected Result:

  • The tool will display an error message:
    -- Error: Incorrect command line arguments.
    -- Usage: java -jar mapping.jar -i <cdfFile> -m <mappingFile> [-o <outputFile>]

Test ID: MAP-012

Test name: Run Mapping Tool with empty input and valid mapping file.

Precondition: The input has been generated by the Converter Tool.

Steps:

  • Open a command line.
  • Run Mapping Tool with an empty input and valid mapping file, for example: java -jar codemetropolis-toolchain-mapping-1.3.jar -i -m mapping.xml

Expected Result:

  • The tool will display an error message:
    -- Error: Incorrect command line arguments.
    -- Usage: java -jar mapping.jar -i <cdfFile> -m <mappingFile> [-o <outputFile>]

Test ID: MAP-013

Test name: Run Mapping Tool with valid input and empty mapping file.

Precondition: The input has been generated by the Converter Tool.

Steps:

  • Open a command line.
  • Run Mapping Tool with a valid input and empty mapping file, for example: java -jar codemetropolis-toolchain-mapping-1.3.jar -i Modules\converterOutput.xml -m

Expected Result:

  • The tool will display an error message:
    -- Error: Incorrect command line arguments.
    -- Usage: java -jar mapping.jar -i <cdfFile> -m <mappingFile> [-o <outputFile>]

Test ID: MAP-014

Test name: Run Mapping Tool with valid input, valid mapping file and with empty output.

Precondition: The input has been generated by the Converter Tool.

Steps:

  • Open a command line.
  • Run Mapping Tool with a valid input, valid mapping file and with empty output, for example: java -jar codemetropolis-toolchain-mapping-1.3.jar -i Modules\converterOutput.xml -m mapping.xml -o

Expected Result:

  • The tool will display an error message:
    -- Error: Incorrect command line arguments.
    -- Usage: java -jar mapping.jar -i <cdfFile> -m <mappingFile> [-o <outputFile>]

Test ID: MAP-015

Test name: Run Mapping Tool with valid input, valid mapping file and with empty scale.

Precondition: The input has been generated by the Converter Tool.

Steps:

  • Open a command line.
  • Run Mapping Tool with a valid input, valid mapping file and with empty scale parameter, for example: java -jar codemetropolis-toolchain-mapping-1.3.jar -i Modules\converterOutput.xml -m mapping.xml -s

Expected Result:

  • The tool will display an error message:
    -- Error: Incorrect command line arguments.
    -- Usage: java -jar mapping.jar -i <cdfFile> -m <mappingFile> [-o <outputFile>]

Test ID: MAP-016

Test name: Run Mapping Tool with invalid type definition in input, and with valid mapping file

Precondition: The input has been generated by the Converter Tool.

Steps:
-- Open the converterOutput.xml
-- Rewrite a line like the following: <property name=""LOC"" type=""int"" value=""16""/> to <property name=""LOC"" type=""int"" value=""test""/>
-- Save the xml.
-- Open a command line.
-- Run Mapping Tool with the changed input, valid mapping file, for example: java -jar codemetropolis-toolchain-mapping-1.3.jar -i Modules\converterOutput.xml -m mapping.xml

Expected Result: The tool will display an error message: Error: Incorrect type definition in input file.

⚠️ **GitHub.com Fallback** ⚠️