Lesson 4 - UT Execution
Lesson 4 - UT Execution
Agenda
Software testing levels
Manual unit testing
Unit Testing based on UT cases
Automated Unit Testing
Automated Unit Testing with NUnit
Automated Tests vs. Manual Tests
Best Practices
Process Process
Write code
Uploading the code to some place
Build it
Running the code manually (in many cases filling
up forms etc step by step)
Check Log files, Database, External Services,
Values of variable names, Output on the screen
etc
If it does not work, repeat the above process
Để giải quyết vấn đề trên Mỗi khi developer test xong phải viết
tài liệu mô tả test case trên word hoặc excel !
Điều này giúp team rất dễ dàng review.. Tuy nhiên, cách làm
này sẽ phát sinh ra rất nhiều hạn chế!
Các dự án lớn thì số lượng tài liệu test case thường cũng
rất lớn!
Các dự án lớn thì requirement thường hay thay đổi
Mỗi khi requirement thay đổi Phải sửa code phải cập
nhật lại tài liệu testcase và lại manual retest , rất tốn
effortCàng đến cuối dự án, lượng việc sinh ra càng
nhiều , viết test case document trở thành “địa ngục “
thực sự ! dev không còn đủ effort update test case
document, tài liệu nhanh chóng bị lạc hậu, hoặc việc
update chỉ là đối phó!
Một số trường hợp không thể dùng Excel Unit TestCase
UT Tools for
references:
Java: JUnit, J2MEUnit
C/C++: cppUnit
Python: pyUnit
Perl: PerlUnit
Visual Basic: vbUnit
C# .NET: Nunit,csUnit
Refferences:
http://www.testingfaqs.org/t-unit.html
www.junit.org
http://www.codeproject.com/gen/design/autp5.asp
Let’s go to website:
http://www.nunit.org/index.php?p=download
Yeahh, I got it
mumm, it is
easy
Yeahh, It tastes
good
Who knows…
Let’s me go…
[Test]
public void testCase1()
{
Assert.AreEqual(0, intA);
}
[Test]
public void testCase2()
{
Assert.AreEqual(0, divides(intA, intB));
}
Beer Please !!!
[SetUp]
protected void SetUp()
{
intA = 0;
intB = 0;
objCal = new CaculatesSomeThings();
}
[Test]
Public void TestCase1()
{
Assert.AreEqual(0, objCal.Multifly(intA, intB))
}
I don’t believe…
Q&A