You are on page 1of 36

CS3201/2: Software Engineering Project

Tools for CS3201/2


LN Set #6

SPA Static Program Analysis tool


UI to enter program
source program
in SIMPLE

UI to view
query result

UI to enter
queries

SPA
front-end
query result

query in PQL

design abstractions

Program
Knowledge Base
PKB
23/8/2016

design abstractions

Query Processing
Subsystem

CS3201_02 LN Set #6 Tools

SPA Development
UI to enter program
source program
in SIMPLE

UI to view
query result

UI to enter
queries

Programming Language: C++


SPA
front-end

IDE: Visual Studio 2015


query result

query in PQL

design abstractions

Program
Knowledge Base
PKB
23/8/2016

design abstractions

Query Processing
Subsystem

CS3201_02 LN Set #6 Tools

SPA Code Documentation


UI to enter program
source program
in SIMPLE

UI to view
query result

UI to enter
queries

Doxygen (optional)
SPA
front-end
query result

query in PQL

design abstractions

Program
Knowledge Base
PKB
23/8/2016

design abstractions

Query Processing
Subsystem

CS3201_02 LN Set #6 Tools

SPA Testing
AutoTester

UI to enter program
source program
in SIMPLE

(no UI needed)
UI to view
query result

UI to enter
queries

SPA
front-end
query result
design abstractions

Program
Knowledge Base
PKB
23/8/2016

query in PQL

VS Unit Testing
design abstractions

Query Processing
Subsystem

CS3201_02 LN Set #6 Tools

SPA Version Control System


UI to enter program
source program
in SIMPLE

UI to view
query result

UI to enter
queries

SPA
front-end

Any VCS:
design abstractions

Program
Knowledge Base
PKB
23/8/2016

query result

query in PQL

SVN
Git
design abstractions

Query Processing
Subsystem

CS3201_02 LN Set #6 Tools

List of Tools for CS3201/2


Microsoft Visual Studio 2015
Testing
Autotester
VS Unit Testing
Automatic testing solution

Version control system


Doxygen (optional)

23/8/2016

CS3201_02 LN Set #6 Tools

Microsoft Visual Studio


Get free licence
https://www.dreamspark.com/

Integrated Development Environment


(IDE)
Editor + compiler
Additional features

Required for opening .sln files in


AutoTester / Integrated solution / CppUnit
packages
23/8/2016

CS3201_02 LN Set #6 Tools

Visual Studio Versions


2015
Any version should work - recommended is
Enterprise version
Libraries are well-tested
Let us know if you encounter problems:
Use forum on IVLE
Yifan: e0002178@u.nus.edu
Teams TA

23/8/2016

CS3201_02 LN Set #6 Tools

Configurations in VS
Debug
For debugging your project
Does not optimize the binary it produces (as
optimizations can greatly complicate
debugging), and generates additional data to
aid debugging

Release
For the final build for end users
Enables optimizations and generates less (or
no) extra debug data
23/8/2016

CS3201_02 LN Set #6 Tools

10

Configurations in VS
Debug mode requires libraries built in
Debug mode, while Release mode
requires libraries built in Release mode
We will use release mode for project
evaluation

23/8/2016

CS3201_02 LN Set #6 Tools

11

AutoTester regression testing tool


Regression testing: execute test cases
after program modifications to see if no
new errors introduced
AutoTester:
Runs your SPA
Feeds the proper input into it
Checks the actual results against the
expected results
Prints a log of test cases that failed
23/8/2016

CS3201_02 LN Set #6 Tools

12

AutoTester
Current Version for VS2015: Aug15
Available in "Tools" folder in IVLE Workbin

Important files in this package:


AutoTesterInUse.sln
TestWrapper.cpp
Release/Sample-Source.txt
Release/Sample-Queries.txt
Release/analysis.xsl

23/8/2016

CS3201_02 LN Set #6 Tools

13

23/8/2016

CS3201_02 LN Set #6 Tools

14

Prototype_sample_SIMPLE_source.txt
procedure ABC {
i=1;
b=200 ;
c= a
;
while a
{
while beta {
oSCar = 1 + beta + tmp;
while tmp{
oSCar = I + k + j1k + chArlie; }
while x {
x = x + 1;
while left {
while right {
Romeo = Romeo + 1;
b = 0;
c = delta
+ l + width + Romeo ; }
while c {
c = c +1
; }
x = x+ 1
; }}
a=
2; }
w = w+1 ;
}
}
23/8/2016

CS3201_02 LN Set #6 Tools

\\1
\\2
\\3
\\4
\\5
\\6
\\7
\\8
\\9
\\10
\\11
\\12
\\13
\\14
\\15
\\16
\\17
\\18
\\19
\\20
15

Sample-Queries.txt
Query id and
1 - comment
while w;
Select w such that Parent(w, 7)
none
5000
2 - comment
if ifs;
Select ifs such that Follows(5, ifs)
6
5000

23/8/2016

CS3201_02 LN Set #6 Tools

comment
Declaration
Query
Expected results
Time limit

16

Demo

23/8/2016

CS3201_02 LN Set #6 Tools

19

Unit Testing with VS2015


Native:
https://msdn.microsoft.com/enus/library/hh270864.aspx
https://msdn.microsoft.com/enus/library/hh694604.aspx

Managed:
https://msdn.microsoft.com/enus/library/hh598960.aspx

23/8/2016

CS3201_02 LN Set #6 Tools

20

23/8/2016

CS3201_02 LN Set #6 Tools

21

Unit Testing Example

Create solution containing Student class


Add a new test project; choose Native
Write your tests
Run tests from Tests menu

23/8/2016

CS3201_02 LN Set #6 Tools

22

Making Your Own Testing Example


Student.cpp

getStuName();
getStuNumber();
assignGrade(courseName, grade);
getGrade(courseName);

Course.cpp
getCourseGrade();
getCourseName();

23/8/2016

CS3201_02 LN Set #6 Tools

23

Making Your Own Testing Example


TestStudent.cpp

TEST_CLASS(TestStudent)
{
public:

TEST_METHOD(testConstructor)
{
Student stu("Tan Meng Chee", "94-1111B-13");
// check that the object is constructed correctly - Note 6
std::string student_name = stu.getStuName();
Assert::AreEqual (student_name, (std::string)"Tan Meng Chee");
std::string student_number = stu.getStuNumber();
Assert::AreEqual (student_number, (std::string)"94-1111B-13");
return;
}

23/8/2016

CS3201_02 LN Set #6 Tools

24

Making Your Own Testing Example


TestStudent.cpp
TEST_METHOD(testAssignAndRetrieveGrades)
{
// create a student
Student stu("Jimmy", "946302B");
// assign a few grades to
stu.assignGrade("cs2102",
stu.assignGrade("cs2103",
stu.assignGrade("cs3215",

this student
60);
70);
80);

// verify that the assignment is correct - Note 7


Assert::AreEqual(60, stu.getGrade("cs2102"));
Assert::AreEqual(70, stu.getGrade("cs2103"));
// attempt to retrieve a course that does not exist
Assert::AreEqual(-1, stu.getGrade("cs21002"));
return;
}

23/8/2016

CS3201_02 LN Set #6 Tools

25

Demo

23/8/2016

CS3201_02 LN Set #6 Tools

26

Automatic Testing Solution


Version for VS2015:
Available in "Tools" folder in IVLE Workbin

Empty SPA solution Integrated with


AutoTester
Unit Testing

Important files:
EmptyGeneralTesting.sln
Read AutoTesterDocumentation.pdf
23/8/2016

CS3201_02 LN Set #6 Tools

27

23/8/2016

CS3201_02 LN Set #6 Tools

28

Automatic Testing Solution


AutoTester:
Build to get AutoTester.exe for
your SPA
IntegrationTesting:
Implement IntegrationTest.cpp and
test classes, build to get
IntegrationTesting.exe for your SPA
Empty SPA solution:
Fill in the code for your SPA

23/8/2016

UnitTesting:
Implement UnitTest.cpp and test
classes, build to get UnitTesting.exe
for your SPA

CS3201_02 LN Set #6 Tools

29

Start-up your Development


Fastest

23/8/2016

CS3201_02 LN Set #6 Tools

30

Version Control Systems


Version control system
Keep track of different versions of code
Facilitate sharing of code
Serve as a backup

Examples:
SVN, CVS
Git, Mercurial

23/8/2016

CS3201_02 LN Set #6 Tools

32

TortoiseSVN
Current Version 1.9.3
http://tortoisesvn.net/

Subversion repository in SoC


https://subversion.comp.nus.edu.sg/svn/cs32
01/cs3201gXX/trunk/
Use VPN to access from home
Accounts created for all teams on-demand

Centralized architecture of SVN


One centralized repository at one server
23/8/2016

CS3201_02 LN Set #6 Tools

33

Centralized Version Control


Repository at the server
AST.cpp: v1

Import

Check-out

Code Directory
of Member A
AST.cpp (v1)

23/8/2016

Code Directory
of Member B
AST.cpp (v1)

CS3201_02 LN Set #6 Tools

34

Centralized Version Control


Repository at the server
AST.cpp:
AST.cpp:v1,
v1v2

Commit

Update

Code Directory
of Member A
(v1)
AST.cpp (v2)

23/8/2016

Code Directory
of Member B
AST.cpp (v2)
(v1)

CS3201_02 LN Set #6 Tools

35

Centralized Version Control


Repository at the server
AST.cpp: v1, v2
Parser.cpp: v1

Update

Commit

Code Directory
of Member A
AST.cpp (v2)
Parser.cpp (v1)

23/8/2016

Code Directory
of Member B
AST.cpp (v2)
Parser.cpp (v1)

CS3201_02 LN Set #6 Tools

Add

36

TortoiseSVN Commands
Import
Initialize the repository

Check-out
Obtain a copy of code from repository

Commit
Send the updates into the repository

Update
Obtain the updated files from the repository

Add/Delete (Must be followed by a "commit")


Add/Delete a file/directory into/from the repository
23/8/2016

CS3201_02 LN Set #6 Tools

37

VCS use in CS3201/02


All teams must setup and use a version
control system
You are free to choose any version control
software and / or repository
Repository is private
Team tutor has to receive access by 26 Aug
2016

Let Parvathy know by 25 Aug if you need


account on SoC SVN repository
23/8/2016

CS3201_02 LN Set #6 Tools

38

Thank you!
Q&A

23/8/2016

CS3201_02 LN Set #6 Tools

39

You might also like