reqT FAQ

bjornregnell edited this page Sep 14, 2014 · 37 revisions
Clone this wiki locally

Frequently asked questions on reqT

Create, read, update, delete

How to create a model?

How to add an entity?

Export/Import

How to export from console?

Errors and exceptions

What do I do if I get a IncompatibleClassChangeError exception?


Create, read, update, delete

How to create a model?

Type this in the reqT console at the reqT> prompt after downloading and launching reqT:

var m = Model(Feature("x"), Feature("y") requires Feature("x"))

Or launch the reqT GUI editor from the reqT console using the edit command. gui create model

How to add an entity?

Type this in the reqT console to first create an empty model and then add a feature:

reqT> var m = Model()
m: reqT.Model = Model()

reqT> m += Feature("x") has Gist("a nice feature")

reqT> m
res1: reqT.Model = Model(Feature("x") has Gist("a nice feature"))

Export/Import

###How to export from console? You can export models using the GUI, but it is also possible to export your scala model to PDF/dot/csv/html etc. using the command line as shown below.

reqT> val m = Model(Spec("hej"))
m: reqT.Model = Model(Spec("hej"))

reqT> m.toGraph.save("myModel.dot")
Saved string to file: C:/Users/bjornr/tmp/myModel.dot

reqT> sys.exit    

PS C:\Users\bjornr\tmp> dot -Tpdf -o myModel.pdf myModel.dot

PS C:\Users\bjornr\tmp> ./myModel.pdf

//the last two steps step, here at the windows PS (similar on MacOS/Linux bash) 
//requires that you have graphviz installed on your path: http://graphviz.org/

You can also see which exporters are available using tab completion and using the export obect like this:

reqT> reqT.export.   //press TAB after dot to see methods on object export
Exporter        GraphVizNested        ScalaGenerators    toHtml               toScalaPaired
ExporterUtils   HtmlExporter          StringExporter     toPathTable          toStringCompact
FileExporter    ModelToString         TableExporter      toScalaCompact       toStringPaired
GraphViz        ModelToTextExporter   toGraphVizFlat     toScalaCompactBody   toStringSimple
GraphVizFlat    NewLineEnding         toGraphVizNested   toScalaExpanded      toText

reqT> val m = rndModel(5)
m: reqT.Model =
Model(
  Story("v1"),
  Probability(8),
  Story("f7") verifies (Text("Redo."), Spec("Ti.")),
  Breakpoint("k5"),
  MockUp("s2") excludes (Design("s3"), Value(7)))

reqT> reqT.export.toPathTable(m)
res1: String =
/;Story;"v1"
/;Probability;8
Story("f7").verifies/;Text;"Redo."
Story("f7").verifies/;Spec;"Ti."
/;Breakpoint;"k5"
MockUp("s2").excludes/;Design;"s3"
MockUp("s2").excludes/;Value;7


reqT> reqT.export.toPathTable(m).save("myPathTable.csv")
Saved string to file: C:/Users/bjornr/tmp/myPathTable.csv

//you also have the m.toTable which gives the same string as export.toPathTable(m)

The exporter implementations are here, which should be somewhat readable for a java-knowledgeable (scala crash course: methods of a scala object is similar to static methods in java; a trait is similar to an interface; an object with an apply method can be called like a function).

Errors and exceptions

What to do if I get a java.lang.IncompatibleClassChangeError exception?

You are probably using a different version of java than 1.7. You can check this in a terminal window with the command:

java -version

You can download Java SE 1.7 here:

On Linux Debian/Ubuntu/Mint etc. you can have several different java runtime systems installed and configure which one you invoke by default. Use these terminal commands to ...

  • download openjdk-7: sudo apt-get install openjdk-7-jre.
  • change default java: sudo update-alternatives --config java and choose /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java in the list of options.