Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 12 Next »

IN PROGRESS

Testing

To ensure reliability and stability of Safety Analysis a variety of tests are performed. We are using JUnit, Pi-test and other Java extensons connected with tests. Actually we started to introduce Cucumber as a new tool for acceptable tests.

During execution of all tests bugs and issues are found. Analysis of tests results is available here.

Acceptance tests

Software testing method conducted to determine if the requirements of a specification or contract are met. It may involve User Acceptance Testing (UAT), Operational Acceptance Testing (OAT), Acceptance testing in extreme programming, alpha and beta testing. You write acceptance tests to check if your code is passing the requirements of project. You should run these tests in integration-test phase. Naming param is *className*ATest.java.

Unit tests

Software testing method by which individual units of source code, sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures, are tested to determine whether they are fit for use.Unit testing is commonly automated, but may still be performed manually. The objective in unit testing is to isolate a unit and validate its correctness. You should write JUnit to check every function that you use in your code. JUnit must be fast, it should be matters of seconds to run that test. JUnit should test only define unit of system. Naming param is *className*JUTest.java.

Command Line Use Case Tests Specification

This page contains documentation for CLI Use Case Tests in order of appearance in code.

TestParser test - unrecognized argument
DescriptionThis test checks GNU Parser for use of unrecognized argument.
ConditionsArgument must be one of given in tables above.
Test procedure
      1. Pass the argument to CLI "-l"
      2. Compare result with expected result
Expected resultsOutput string: "Encountered exception while parsing using GnuParser:\nUnrecognized option: -l"

TestAnalyze Fault Tree - no tree loaded
DescriptionThis test checks correctness of Fault Tree Analysis.
ConditionsNo tree loaded.
Test procedure
      1. Pass the argument to CLI "-a"
      2. Call the method
      3. Compare result with expected result
Expected resultsOutput string: "There is no tree that I could analyze."

TestCheck the Cohesion of Event Tree - no tree loaded
DescriptionThis test checks cohesion of Event Tree.
ConditionsNo tree loaded.
Test procedure
      1. Pass the argument to CLI "-c"
      2. Call the method
      3. Compare result with expected result
Expected resultsOutput string: "There is no tree that I could analyze."

TestGet Fuzzy Importance Index of Fault Tree - no tree loaded
DescriptionThis test gets fuzzy importance index of fault tree.
ConditionsNo tree loaded.
Test procedure
      1. Pass the argument to CLI "-i"
      2. Call the method
      3. Compare result with expected result
Expected resultsOutput string: "There is no tree that I could analyze."


TestLoad Event Tree - wrong tree
DescriptionThis test checks Event Tree loading from file.
Conditions-
Test procedure
      1. Pass the argument to CLI "-e wrong.xml"
      2. Call the method
      3. Compare result with expected result
Expected resultsOutput string: "\nRead Event Tree file from: wrong.xml Fail"

TestLoad Fault Tree - wrong tree
DescriptionThis test checks Fault Tree loading from file.
Conditions-
Test procedure
      1. Pass the argument to CLI "-f wrong.xml"
      2. Call the method
      3. Compare result with expected result
Expected resultsOutput string: "\nRead Fault Tree file from: wrong.xml Fail"

TestLoad Event Tree - correct tree
DescriptionThis test checks Event Tree loading from file.
Conditions-
Test procedure
      1. Pass the argument to CLI "-e treeXmltest2.xml"
      2. Call the method
      3. Compare result with expected result
Expected resultsOutput string: "\nRead Event Tree file from: treeXmltest2.xml Success"

TestCheck Cohesion of Event Tree
DescriptionThis test checks cohesion of Event Tree.
ConditionsSucesfully load Event Tree from file.
Test procedure
      1. Pass the argument to CLI "-e treeXmltest2.xml -c"
      2. Call the method
      3. Compare result with expected result
Expected resultsOutput string: "\nRead Event Tree file from: treeXmltest2.xml Success\n"Result of the analysis Events Tree: \nEvents tree is ok"

TestCheck Report generation
DescriptionThis test checks report generation.
Conditions-
Test procedure
      1. Pass the argument to CLI "-r Report.odt"
      2. Call the method
      3. Compare result with expected result
Expected resultsOutput string: "\nCreated file: Report.odt"

TestLoad Fault Tree - correct tree
DescriptionThis test checks Fault Tree loading from file.
Conditions-
Test procedure
      1. Pass the argument to CLI "-f exampleFaultTree.xml"
      2. Call the method
      3. Compare result with expected result
Expected resultsOutput string: "\nRead Fault Tree file from: exampleFaultTree.xml Success"

TestGet Fuzzy Importance Index of Fault Tree
DescriptionThis test gets fuzzy importance index of fault tree.
ConditionsSucesfully loaded Fault Tree.
Test procedure
      1. Pass the argument to CLI "-f exampleFaultTree.xml -i"
      2. Call the method
      3. Compare result with expected result
Expected resultsOutput string: "\nRead Fault Tree file from: exampleFaultTree.xml Success\nResult of the analysis Fault Tree: \nKey: root = Value: "

Cucumber

Cucumber is a tool that we used for write acceptable tests. It runs automated acceptance tests written in a behavior-driven development (BDD) style. Cucumber defines application behavior using simple English text, defined by a language called Gherkin, which make tests easy to read and understood for peoples that doesn't have much experience with programming. Another advantage of this tests environment is, that it automatically generate report for the conducted test.

More informations about Cucumber are available in documentation.

Testing with cucumber

WIP


  • No labels