The online community for software testing & quality assurance professionals
 
 
Calendar   Today's Topics
Sponsors:




Lost Password?

Home
BetaSoft
Blogs
Jobs
Training
News
Links
Downloads



Software Testing >> Unit Testing

Pages: 1
Jonghyun
Newbie


Reged: 08/30/11
Posts: 1
New Mock, BDD Lib for Embedded C
      #683587 - 08/30/11 08:55 AM

I have developed Mock Library, Parameterized Test Library and BDD framework for embedded C.
First, Mock Library can be used x86 and Arm(Arm/Thumb instruction Set) CPU. It supports both Configurable Mock which mean you can use mock by just specify expected value or return value. (And it also supports Manual Mock). Most of all, it can REPLACE FUNCTION WITH MOCK FUNCTION WITHOUT RECOMPILE. Multiple executable is not needed to test a function which needs to be a mock function on other test. It was possible only OOP Language which have polymorphism. It needs some improvements but it is working and used in Samsung Electronics.
Sample)
Code:

int fly(int speed) { //function to be mocked
return speed;
}
..
It_may_(fly, int, speed, and_return_type_of_(int));//declare mock function

//in test case
And_it_(fly, the_(3,int), then_return(1,int));times_(1);// when fly is called with input 3 then it will return 1.


Parameterized Test Library support List, Set, Table and Random Generation Value. Based on these values you can test combination of vales or each value at least once. It also currently used in Samsung Electronics.
Sample)
Code:

Feature(Story_table_set_each) {
Description(
"This Test Case test table and list parameterized test."
"'with_each_of' is used to test all elements of table and list at least once.")
int i =0;
int toCompareWing[] = {2,3,2};
int toCompareMortor[] = {3,4,3};
int toCompareTailB[] = {5,6,7};
Given()
A_table_(
tail,
{int a; int b;},
{1,5},
{1,6},
{1,7}
)
A_list_(int, wing , 2,,3 )
A_list_(int, motor , 3,,4)

Scenario (fly, with_each_of, wing, motor, tail) {
Given()

Expect_equal_(toCompareWing[i], a_(wing));
Expect_equal_(toCompareMortor[i], a_(motor));
Expect_equal_(toCompareTailB[i++], tail->b);
}
}


Finally, I made BDD Framework. My BDD Test Framework is more focus on documentation. Please let me know if you have a better word or phrase for the API. It is target to embedded system. So, it is very small. Currently, it can execute whole or individual test cases. In feature, it will generation Word or Excel file for better documentation. It will also support remote execution.
In structure perspective, it has Features (Test Suite). Each Feature has Scenarios (Test Case) or other Features. Each Scenario (TEST CASE) IS NOT NEED TO BE REGITERED which C Language base Test Frameworks always needed.
Sample)
Code:

Feature(When) {
Description("xxxxx"
"YYYY")
Given()
A_list_(int, tail)
A_list_(int, wing , 2,,3 )
A_list_(int, motor , 3,,4)

Scenario (fly, with_each_of, wing, motor, tail) {
Given()
The_list_(tail , 5,,7 )

It_return_(an_integer, wing*motor) when_it_(fly, wing, motor, tail) {
// Expected Action
}
Expect_equal_(1,isFlyDone);

}

Scenario (function_using_mock) {
It_return_(an_integer, 1) when_it_(move, 3) it_cause {
And_it_(fly, the_(3,int), then_return(1,int));
}
}
}


I will soon release these APIs. But I want see how many people interest on these Unit Test Tools before I put more effort on it.


Post Extras: Print Post   Remind Me!   Notify Moderator  
micronpn
Newbie


Reged: 11/28/11
Posts: 1
Re: New Mock, BDD Lib for Embedded C [Re: Jonghyun]
      #692100 - 11/28/11 01:38 AM

I am interested in your library/work. Have you released any library release?

Edited by Administrator (11/28/11 02:09 PM)


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 1 anonymous users are browsing this forum.

Moderator:  AJ, Jeanj 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 2883

Rate this topic

Jump to

Contact Us | Privacy statement SQAForums

Powered by UBB.threads™ 6.5.5