Sending Ether to SCs from testSuite on Remix IDE


pragma solidity ^0.5.3; 
contract STFB5 {     
function transferToFallback(address payable _to) public payable {          
    _to.transfer(msg.value);     }     

function getBalance() public view returns (uint) {         
   return address(this).balance;     
constructor () payable public{     } 


pragma solidity ^0.5.3;  
contract F5 {           

constructor () payable public {}     
function getBalance() public view returns (uint) {         
  return address(this).balance;     


// SPDX-License-Identifier: GPL-3.0      
pragma solidity >=0.4.22 <0.9.0;  
// This import is automatically injected by Remix 
import "remix_tests.sol";   
// This import is required to use custom transaction context 
// Although it may fail compilation in 'Solidity Compiler' plugin 
// But it will work fine in 'Solidity Unit Testing' plugin 
import "remix_accounts.sol"; 
import "./STFB5.sol"; 
import "./F5.sol"; // File name has to end with '_test.sol', 
this file can contain more than one testSuite contracts  
contract testSuite {      
/// 'beforeAll' runs before all other tests     
/// More special functions are: 'beforeEach', 'beforeAll', 'afterEach' & 'afterAll'     
F5 obj1;     
STFB5 obj2;      
function beforeAll() public payable {                
   uint a = 100;        
   obj1 = new F5.value(a)();        
   obj2 = new STFB5.value(a)();       
function initialValueofObj1ShouldBe100() public returns (bool) {        
   return Assert.equal(obj1.getBalance(), 100, "initial value is not correct");     
function initialValueofObj2ShouldBe100() public returns (bool) {        
   return Assert.equal(obj2.getBalance(), 100, "initial value is not correct");     } 

I am getting the error:
Gives error:

contracts/STFB5_test.sol:32:19: DeclarationError: Identifier not found or not unique.

obj1 = new F5.value(a)();


Somebody please guide me how to solve this problem.


I don’t understand what is going on there. There are two smart contracts, and there is a test file that is a .sol file that should deploy the other 2 smart contracts and send them some currency?

What is F5.value?

Hi @cryptokid,
Thanks a lot for your response. I am sending Ether from the testSuite SC and then testig if the other SCs received the Ether. Is it correct to use F5.value(a)() for sending Ether and initializing the SC. Kindly guide me the correct syntax.